Commit 696f7eb
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 44fd975 commit 696f7eb
2 files changed
Lines changed: 931 additions & 2 deletions
0 commit comments