Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

OpenAI Batch API returns 404 with GPT-5.x models

Aperta
#3,071 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
python

Direzione di ricerca

Inizia riproducendo il problema con le chiamate Python mostrate a client.files.create e client.batches.create per /v1/chat/completions e /v1/responses. Confronta il modo in cui la richiesta batch gestisce i nomi dei modelli GPT-5.x rispetto a GPT-4o e determina se la trasformazione del modello -batch avviene nella libreria o nel servizio. Il lavoro è completato quando è stato identificato il livello responsabile e quando è stato confermato un batch chat-completions GPT-5.x funzionante oppure è stato documentato l’upstream fix necessario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug upstream
Confirm this is an issue with the Python library and not an underlying OpenAI API
  • This is an issue with the Python library
Describe the bug

/v1/responses API with GPT 5.4 mini or GPT 5.4 nano - works as expected
/v1/chat/completions API with GPT 5.4 mini or GPT 5.4 nano - fails with following error:

{"id": "batch_req_69d553dfec588190b461bf17c6c2602b", "custom_id": "20260318_0", "response": {"status_code": 404, "request_id": "465a86c2-ef40-4dfc-854f-a2f57977fb58", "body": {"error": {"message": "The model `gpt-5-mini-2025-08-07-batch` does not exist or you do not have access to it.", "type": "invalid_request_error", "param": null, "code": "model_not_found"}}}, "error": null}

I confirmed our token do have access to GPT-5-mini model.

I also see as per OpenAI public documentation https://developers.openai.com/api/docs/models/compare GPT-5.1, GPT-5.4-mini and GPT-5.4-nano supports /v1/chat/completions, /v1/responses and /v1/batch APIs but still we are facing issue.

Observations:

This looks like a Open Bug to me - GPT-5.x model is having -batch where as GPT 4.x models are not doing that. However, due to this existing Batch API is failing because the model gpt-5-2025-08-07-batch does not exist!

OpenAI's backend automatically resolves the model to a {model}-batch variant internally and the batch model is not available hence we see model not found 404 error.

Interestedly -batch is not appended when we use /v1/responses with GPT-5.x models

Can you please help to look into this issue further?

To Reproduce

Follow the public OpenAI Batch API documentation with following settings:

1. Use /v1/chat/completions with gpt-5 in jsonl sample: >> Results to 404

Batch Details:

Batch(id='batch_69d63cf462e88190b38365f5d52e432b', completion_window='24h', created_at=1775647988, endpoint='/v1/chat/completions', input_file_id='file-DcVD2SZBnBbM1qFLjJdFnq', object='batch', status='completed', cancelled_at=None, cancelling_at=None, completed_at=1775648130, error_file_id='file-YEubDCUtGwo1aXqQ5zE1EK', errors=None, expired_at=None, expires_at=1775734388, failed_at=None, finalizing_at=1775648128, in_progress_at=1775648050, metadata={'description': 'nightly eval job'}, model='gpt-5-2025-08-07', output_file_id=None, request_counts=BatchRequestCounts(completed=0, failed=2, total=2), usage=BatchUsage(input_tokens=0, input_tokens_details=InputTokensDetails(cached_tokens=0), output_tokens=0, output_tokens_details=OutputTokensDetails(reasoning_tokens=0), total_tokens=0))

Batch errors:

{"id": "batch_req_69d63d81f74c8190be387e6c8a69a94d", "custom_id": "20260318_0", "response": {"status_code": 404, "request_id": "9407df48-bc25-4091-85b1-db2af30c14cb", "body": {"error": {"message": "The model `gpt-5-2025-08-07-batch` does not exist or you do not have access to it.", "type": "invalid_request_error", "param": null, "code": "model_not_found"}}}, "error": null}
{"id": "batch_req_69d63d81f3788190b84d4e9d31c98ea5", "custom_id": "20260318_1", "response": {"status_code": 404, "request_id": "3b813cf8-9d80-4163-aaac-02054549f62e", "body": {"error": {"message": "The model `gpt-5-2025-08-07-batch` does not exist or you do not have access to it.", "type": "invalid_request_error", "param": null, "code": "model_not_found"}}}, "error": null}

2. Use /v1/chat/completions with GPT-4o >> Results to 200

Batch Details:

Batch(id='batch_69d63eb8f8d48190a308eaff77d87d4f', completion_window='24h', created_at=1775648440, endpoint='/v1/chat/completions', input_file_id='file-B75LM1cgyUbGcqui7xwEEz', object='batch', status='completed', cancelled_at=None, cancelling_at=None, completed_at=1775648570, error_file_id=None, errors=None, expired_at=None, expires_at=1775734840, failed_at=None, finalizing_at=1775648569, in_progress_at=1775648502, metadata={'description': 'nightly eval job'}, model='gpt-4o-2024-08-06', output_file_id='file-63VdpMgDEiTFEL5TPx2Hoe', request_counts=BatchRequestCounts(completed=2, failed=0, total=2), usage=BatchUsage(input_tokens=208, input_tokens_details=InputTokensDetails(cached_tokens=0), output_tokens=2, output_tokens_details=OutputTokensDetails(reasoning_tokens=0), total_tokens=210))
{"id": "batch_req_69d63f3a09d08190ad8763cec4122455", "custom_id": "20260318_0", "response": {"status_code": 200, "request_id": "8bad7825-fc45-4eb4-a5e5-fe8d6ac6cbd7", "body": {"id": "chatcmpl-DSLZymKB4dL7HY3ifyItvRelUV7v3", "object": "chat.completion", "created": 1775648506, "model": "gpt-4o-2024-08-06", "choices": [{"index": 0, "message": {"role": "assistant", "content": "No", "refusal": null, "annotations": []}, "logprobs": {"content": [{"token": "No", "logprob": -0.001268089865334332, "bytes": [78, 111], "top_logprobs": [{"token": "No", "logprob": -0.001268089865334332, "bytes": [78, 111]}, {"token": "Yes", "logprob": -6.673142910003662, "bytes": [89, 101, 115]}]}], "refusal": null}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 84, "completion_tokens": 1, "total_tokens": 85, "prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": 0}, "completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}}, "service_tier": "default", "system_fingerprint": "fp_b07aafcada"}}, "error": null}
{"id": "batch_req_69d63f3a05d881909a3dedc84fb8fbb0", "custom_id": "20260318_1", "response": {"status_code": 200, "request_id": "4ef6e663-28a4-4822-8ad6-d6f2a91ff833", "body": {"id": "chatcmpl-DSLaxjh7pFB08FahxYbflpj4eDebx", "object": "chat.completion", "created": 1775648567, "model": "gpt-4o-2024-08-06", "choices": [{"index": 0, "message": {"role": "assistant", "content": "No", "refusal": null, "annotations": []}, "logprobs": {"content": [{"token": "No", "logprob": -0.008623439818620682, "bytes": [78, 111], "top_logprobs": [{"token": "No", "logprob": -0.008623439818620682, "bytes": [78, 111]}, {"token": "Yes", "logprob": -4.7586236000061035, "bytes": [89, 101, 115]}]}], "refusal": null}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 124, "completion_tokens": 1, "total_tokens": 125, "prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": 0}, "completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}}, "service_tier": "default", "system_fingerprint": "fp_4d38c3c00d"}}, "error": null}

3. Use /v1/responses with gpt-5.1 in jsonl sample: >> Results to 200

{"id": "batch_req_69d54dfc41748190905c15b13af35002", "custom_id": "20260318_0", "response": {"status_code": 200, "request_id": "9a3e55ba-f770-4c4f-890a-6c90fc93cb2b", "body": {"id": "resp_059ba18e9e3f57c80069d54df03d9081968de7d01ad772ba2c", "object": "response", "created_at": 1775586800, "status": "completed", "background": false, "billing": {"payer": "developer"}, "completed_at": 1775586800, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-5.4-nano-2026-03-17", "output": [{"id": "msg_059ba18e9e3f57c80069d54df060788196b87e157e1eb5acdd", "type": "message", "status": "completed", "content": [{"type": "output_text", "annotations": [], "logprobs": [], "text": "Yes."}], "phase": "final_answer", "role": "assistant"}], "parallel_tool_calls": true, "presence_penalty": 0.0, "previous_response_id": null, "prompt_cache_key": null, "prompt_cache_retention": null, "reasoning": {"effort": "none", "summary": null}, "safety_identifier": null, "service_tier": "default", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}, "verbosity": "medium"}, "tool_choice": "auto", "tools": [], "top_logprobs": 0, "top_p": 0.98, "truncation": "disabled", "usage": {"input_tokens": 58, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 6, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 64}, "user": null, "metadata": {}}}, "error": null}
Code snippets

/v1/chat/completions -

batch_json_test-chat.jsonl

{"custom_id": "20260318_0", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o", "messages": [{"role": "system", "content": "Answer the question using following rule:1) The brand is a retail brand if it sells own product.2) A retail brand or chain is a store that sells other products.3) Generate output response in Yes/NoDo not give reasoning in response."},{"role": "user", "content": "Question: Does this Brand: lucky nurse st patrick's day nursing gnome outfit has a retail chain"}],"max_completion_tokens": 250, "logprobs": true, "top_logprobs": 2, "temperature": 0}}
{"custom_id": "20260318_1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o", "messages": [{"role": "system", "content": "Answer the question using following rule:1) The brand is a retail brand if it sells own product.2) A retail brand or chain is a store that sells other products.3) Generate output response in Yes/NoDo not give reasoning in response."},{"role": "user", "content": "Question: Does this Brand: infantino oxo tot ezpz aeiou aeiou aeiou dr. brown's ubbi philips avent the first years the first years lalo nuk lalo mam infantino infantino infantino infantino infantino infantino infantino infantino has a retail chain"}],"max_completion_tokens": 250, "logprobs": true, "top_logprobs": 2, "temperature": 0}}
batch_input_file = client.files.create(
    file=open("batch_json_test-chat.jsonl", "rb"),
    purpose="batch"
)

create_batch = client.batches.create(
    input_file_id=batch_input_file_id,
    endpoint="/v1/chat/completions",
    completion_window="24h",
    metadata={
        "description": "nightly eval job"
    }
)
print(f"Batch created: {create_batch.id} | status: {create_batch.status}")

while True:
    batch = client.batches.retrieve(create_batch.id)
    print(f"batch: \n{batch}")
    print(f"Status: {batch.status} | "
          f"completed: {batch.request_counts.completed}/"
          f"{batch.request_counts.total}")

    if batch.status in ("completed", "failed", "expired", "cancelled"):
        break
    time.sleep(30)

/v1/responses -

batch_json_test-responses.jsonl

{"custom_id": "20260318_0", "method": "POST", "url": "/v1/responses", "body": {"model": "gpt-5.4-nano", "input": "Answer the question using following rule:1) The brand is a retail brand if it sells own product.2) A retail brand or chain is a store that sells other products.3) Generate output response in Yes/NoDo not give reasoning in response."}}
{"custom_id": "20260318_1", "method": "POST", "url": "/v1/responses", "body": {"model": "gpt-5.4-nano", "input": "Answer the question using following rule:1) The brand is a retail brand if it sells own product.2) A retail brand or chain is a store that sells other products.3) Generate output response in Yes/NoDo not give reasoning in response."}}
batch_input_file = client.files.create(
    file=open("batch_json_test-responses.jsonl", "rb"),
    purpose="batch"
)

create_batch = client.batches.create(
    input_file_id=batch_input_file_id,
    endpoint="/v1/responses",
    completion_window="24h",
    metadata={
        "description": "nightly eval job"
    }
)
print(f"Batch created: {create_batch.id} | status: {create_batch.status}")

while True:
    batch = client.batches.retrieve(create_batch.id)
    print(f"batch: \n{batch}")
    print(f"Status: {batch.status} | "
          f"completed: {batch.request_counts.completed}/"
          f"{batch.request_counts.total}")

    if batch.status in ("completed", "failed", "expired", "cancelled"):
        break
    time.sleep(30)
OS

macOS

Python version

Python v3.13.5

Library version

openai v2.21.0

Lingua principale
Python
Stelle
31.7k
Fork
6.8k
Merge medio
2g 8h
PR unite (30g)
121

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/openai-python

Tutte le issue di openai/openai-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.