Repository navigation
Released: 2026-11-02
Behavior changes
Clients that relied on the previous behavior should review these changes.
- Return an error when Codex reports a failure during a Chat Completion, instead
of a successful completion that could carry truncated text or tool arguments.
Streams end with an error chunk and nofinish_reason; non-streaming requests
and image generation return an HTTP error with the upstreamcode. Failed
completions are not stored./v1/responsesstill returns the failed response
object, and now returns an HTTP error instead of an empty completed response
when Codex sends only anerrorevent. - Treat a Codex stream that closes without a terminal event as an error instead
of a successful response built from partial output. - Return a real HTTP error from streaming requests when Codex fails before any
output, soopenai-pythonraises its typed errors and honorsRetry-After. - Apply
timeoutbetween stream events instead of to the whole stream, so a
long response that keeps producing events is no longer cut off at 300 seconds. - Retry transient Codex failures before any output reaches the client, up to
max_retriestimes (--max-retries,OPENAI_VIA_CODEX_MAX_RETRIES, default
2,0disables).response.creatednow waits for the first output so a retried
attempt stays invisible. - Return the official
function_callfinish reason for legacyfunctions
responses instead oftool_calls. - Return
finish_reason: content_filterfor responses stopped by a content
filter, and forwardRetry-After,code,type, andparamfrom Codex errors. - Keep legacy
functionsstreams to a single call. Requests withfunctionsor
function_callnow defaultparallel_tool_callstofalse, and streaming no
longer merges further calls into one invalidfunction_call.
Fixes
- Stream tool call arguments in Chat Completions when Codex sends them only on
response.output_item.done. Codex does this for parallel tool calls, so
streaming clients previously received every parallel call with empty
arguments. - Number streamed Chat Completions
tool_callscontiguously from 0. Calls that
followed text or reasoning previously started at a higher index, which made
theopenai-pythonchat.completions.stream()helper raiseIndexError. - Keep assistant text that precedes tool calls in non-streaming and stored Chat
Completions. When replaying history, send that text before its calls so each
call stays adjacent to its result. - Give replayed legacy
function_callmessages unique call ids, so calling the
same function more than once in a conversation no longer sends duplicate ids,
and stop adding an empty assistant message next to them. - Treat requests with
toolsas tool requests even when they also send
functionsorfunction_call, and ignore emptyfunctions, so their calls
keep ids instead of becoming a legacyfunction_call. - Stop reading a Codex stream at its terminal event, so a later connection failure
cannot discard a completed response. - Log
chat.stream.tool_arguments_mismatch, with sizes only, when streamed tool
arguments differ from the final item in a way later chunks cannot correct.