Route tool calls on reasoning models to the Responses API
openai_think is a codex provider in API-key mode, which posts to
/v1/chat/completions. That endpoint rejects the request outright when a
reasoning model is given function tools:
400 "Function tools with reasoning_effort are not supported for
gpt-5.6-sol in /v1/chat/completions. To use function tools, use
/v1/responses or set reasoning_effort to 'none'."
aisbf never sends reasoning_effort -- the model applies it server-side --
so there is nothing to strip from the payload; the endpoint is the
problem. Setting it to 'none' would work but silently disables reasoning
on a provider chosen for it, so route these requests to /v1/responses
instead, which supports tools and reasoning together.
OAuth mode already spoke this protocol against the ChatGPT backend, so
_handle_request_oauth2_mode is now a thin wrapper over a shared
_handle_request_responses_api(); only the URL and auth headers differ
between the two. The flattened tool format the codex converter already
produces is what /v1/responses expects.
Fix double-counted failures. codex's handle_request recorded a failure
and re-raised, and the caller in handlers.py recorded it again, so one
failed request counted twice and the three-strikes cooldown tripped
after two requests instead of three. The handler layer records for every
provider, so the provider-level call is the redundant one. Note the same
pattern exists in google/qwen/kilo/openai/ollama/coderai and is left
alone here -- fixed only where it was reproduced.
Bump version to 0.99.91.
Co-Authored-By:
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment