Commit c76f05c
committed
fix: route codex models to Responses API in OpenAI Compatible handler
Azure-hosted GPT-5.x codex models (e.g., gpt-5.3-codex) do not support
the Chat Completions API and return a 400 error. This change detects
codex models by checking if the model ID contains "codex" and routes
them through the OpenAI Responses API (responses.create) instead of
chat.completions.create.
Changes:
- Add _isCodexModel() helper to detect codex model IDs
- Add handleCodexMessage() that uses the Responses API with full
streaming event processing (text, reasoning, tool calls, usage)
- Add _formatConversationForResponsesApi() to convert Anthropic
message format to Responses API input format
- Add _convertToolsForResponsesApi() to convert tools from Chat
Completions nested format to Responses API flat format
- Update completePrompt() to also use Responses API for codex models
- Add comprehensive tests for all new code paths
Fixes #119511 parent 8b12f21 commit c76f05c
File tree
2 files changed
+931
-2
lines changed- src/api/providers
- __tests__
2 files changed
+931
-2
lines changed
0 commit comments