Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#3,071 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
python

调研方向

首先,使用所示的 Python client.files.create 和 client.batches.create 调用,对 /v1/chat/completions 和 /v1/responses 复现该问题。比较 batch 请求如何处理 GPT-5.x 与 GPT-4o 的模型名称,并确定 -batch 模型转换发生在库中还是服务中。完成标准是识别出负责的层,并确认一个可正常工作的 GPT-5.x chat-completions batch,或记录所需的 upstream fix。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Python
星标
31.8k
派生
7.3k
平均合并
1 天 3 小时
30 天内合并 PR
131

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openai/openai-python 的其他 Issue

查看 openai/openai-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。