feat: add GPT-5-Codex support with Responses API integration

Adds support for OpenAI's GPT-5-Codex model which uses the new Responses API
endpoint (/v1/responses) instead of the standard Chat Completions API.

Changes:
- Add GPT-5-Codex to MODEL_CAPABILITIES with 400K context, 128K output
- Prioritize GPT-5-Codex for EXTENDED_REASONING tasks
- Add aliases: codex, gpt5-codex, gpt-5-code
- Update tests to expect GPT-5-Codex for extended reasoning

Benefits:
- 40-80% cost savings through Responses API caching
- 3% better performance on coding tasks (SWE-bench)
- Leverages existing dual-API infrastructure
This commit is contained in:
aberemia24
2025-10-03 13:59:44 +03:00
parent 95d98a9bc0
commit f2653427ca
4 changed files with 30 additions and 8 deletions

View File

@@ -95,8 +95,8 @@ class TestModelSelection:
ModelProviderRegistry.register_provider(ProviderType.OPENAI, OpenAIModelProvider)
model = ModelProviderRegistry.get_preferred_fallback_model(ToolModelCategory.EXTENDED_REASONING)
# OpenAI prefers o3 for extended reasoning
assert model == "o3"
# OpenAI prefers GPT-5-Codex for extended reasoning (coding tasks)
assert model == "gpt-5-codex"
def test_extended_reasoning_with_gemini_only(self):
"""Test EXTENDED_REASONING prefers pro when only Gemini is available."""
@@ -192,7 +192,7 @@ class TestFlexibleModelSelection:
"env": {"OPENAI_API_KEY": "test-key"},
"provider_type": ProviderType.OPENAI,
"category": ToolModelCategory.EXTENDED_REASONING,
"expected": "o3",
"expected": "gpt-5-codex", # GPT-5-Codex prioritized for coding tasks
},
# Case 2: Gemini provider for fast response
{