diff --git a/conf/openai_models.json b/conf/openai_models.json index 848fb96..2f47aa2 100644 --- a/conf/openai_models.json +++ b/conf/openai_models.json @@ -232,6 +232,81 @@ "supports_temperature": true, "max_image_size_mb": 20.0, "use_openai_response_api": true + }, + { + "model_name": "gpt-5.1", + "friendly_name": "OpenAI (GPT-5.1)", + "aliases": [ + "gpt5.1", + "gpt-5.1", + "5.1" + ], + "intelligence_score": 18, + "description": "GPT-5.1 (400K context, 128K output) - Flagship reasoning model with configurable thinking effort and vision support.", + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_system_prompts": true, + "supports_streaming": true, + "supports_function_calling": true, + "supports_json_mode": true, + "supports_images": true, + "supports_temperature": true, + "max_image_size_mb": 20.0, + "default_reasoning_effort": "medium", + "allow_code_generation": true, + "temperature_constraint": "fixed" + }, + { + "model_name": "gpt-5.1-codex", + "friendly_name": "OpenAI (GPT-5.1 Codex)", + "aliases": [ + "gpt5.1-codex", + "gpt-5.1-codex", + "gpt5.1code", + "gpt-5.1-code", + "codex-5.1" + ], + "intelligence_score": 19, + "description": "GPT-5.1 Codex (400K context, 128K output) - Agentic coding specialization available through the Responses API.", + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_system_prompts": true, + "supports_streaming": false, + "supports_function_calling": true, + "supports_json_mode": true, + "supports_images": true, + "supports_temperature": true, + "max_image_size_mb": 20.0, + "use_openai_response_api": true, + "default_reasoning_effort": "high", + "allow_code_generation": true, + "temperature_constraint": "fixed" + }, + { + "model_name": "gpt-5.1-codex-mini", + "friendly_name": "OpenAI (GPT-5.1 Codex mini)", + "aliases": [ + "gpt5.1-codex-mini", + "gpt-5.1-codex-mini", + "codex-mini", + "5.1-codex-mini" + ], + "intelligence_score": 16, + "description": "GPT-5.1 Codex mini (400K context, 128K output) - Cost-efficient Codex variant with streaming support.", + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_system_prompts": true, + "supports_streaming": true, + "supports_function_calling": true, + "supports_json_mode": true, + "supports_images": true, + "supports_temperature": true, + "max_image_size_mb": 20.0, + "allow_code_generation": true, + "temperature_constraint": "fixed" } ] } diff --git a/conf/openrouter_models.json b/conf/openrouter_models.json index aaa1d66..0d7f33e 100644 --- a/conf/openrouter_models.json +++ b/conf/openrouter_models.json @@ -366,6 +366,72 @@ "description": "GPT-5 nano (400K context, 128K output) - Fastest, cheapest version of GPT-5 for summarization and classification tasks", "intelligence_score": 8 }, + { + "model_name": "openai/gpt-5.1", + "aliases": [ + "gpt5.1", + "gpt-5.1", + "5.1" + ], + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_json_mode": true, + "supports_function_calling": true, + "supports_images": true, + "max_image_size_mb": 20.0, + "supports_temperature": true, + "temperature_constraint": "fixed", + "default_reasoning_effort": "medium", + "allow_code_generation": true, + "description": "GPT-5.1 (400K context, 128K output) - Flagship reasoning model with configurable thinking effort and vision support", + "intelligence_score": 18 + }, + { + "model_name": "openai/gpt-5.1-codex", + "aliases": [ + "gpt5.1-codex", + "gpt-5.1-codex", + "gpt5.1code", + "gpt-5.1-code", + "codex-5.1" + ], + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_json_mode": true, + "supports_function_calling": true, + "supports_images": true, + "max_image_size_mb": 20.0, + "supports_temperature": true, + "temperature_constraint": "fixed", + "use_openai_response_api": true, + "default_reasoning_effort": "high", + "allow_code_generation": true, + "description": "GPT-5.1 Codex (400K context, 128K output) - Agentic coding specialization available through the Responses API", + "intelligence_score": 19 + }, + { + "model_name": "openai/gpt-5.1-codex-mini", + "aliases": [ + "gpt5.1-codex-mini", + "gpt-5.1-codex-mini", + "codex-mini", + "5.1-codex-mini" + ], + "context_window": 400000, + "max_output_tokens": 128000, + "supports_extended_thinking": true, + "supports_json_mode": true, + "supports_function_calling": true, + "supports_images": true, + "max_image_size_mb": 20.0, + "supports_temperature": true, + "temperature_constraint": "fixed", + "allow_code_generation": true, + "description": "GPT-5.1 Codex mini (400K context, 128K output) - Cost-efficient Codex variant with streaming support", + "intelligence_score": 16 + }, { "model_name": "x-ai/grok-4", "aliases": [ diff --git a/providers/openai.py b/providers/openai.py index f7e61f4..7acb19c 100644 --- a/providers/openai.py +++ b/providers/openai.py @@ -115,20 +115,51 @@ class OpenAIModelProvider(RegistryBackedProviderMixin, OpenAICompatibleProvider) if category == ToolModelCategory.EXTENDED_REASONING: # Prefer models with extended thinking support - # GPT-5-Codex first for coding tasks - preferred = find_first(["gpt-5-codex", "gpt-5-pro", "o3", "o3-pro", "gpt-5"]) + # GPT-5.1 Codex first for coding tasks + preferred = find_first( + [ + "gpt-5.1-codex", + "gpt-5.1", + "gpt-5-codex", + "gpt-5-pro", + "o3-pro", + "gpt-5", + "o3", + ] + ) return preferred if preferred else allowed_models[0] elif category == ToolModelCategory.FAST_RESPONSE: # Prefer fast, cost-efficient models - # GPT-5 models for speed, GPT-5-Codex after (premium pricing but cached) - preferred = find_first(["gpt-5", "gpt-5-mini", "gpt-5-codex", "o4-mini", "o3-mini"]) + # GPT-5.1 models for speed, GPT-5.1-Codex after (premium pricing but cached) + preferred = find_first( + [ + "gpt-5.1", + "gpt-5.1-codex-mini", + "gpt-5", + "gpt-5-mini", + "gpt-5-codex", + "o4-mini", + "o3-mini", + ] + ) return preferred if preferred else allowed_models[0] else: # BALANCED or default # Prefer balanced performance/cost models - # Include GPT-5-Codex for coding workflows - preferred = find_first(["gpt-5", "gpt-5-codex", "gpt-5-pro", "gpt-5-mini", "o4-mini", "o3-mini"]) + # Include GPT-5.1 family for latest capabilities + preferred = find_first( + [ + "gpt-5.1", + "gpt-5.1-codex", + "gpt-5", + "gpt-5-codex", + "gpt-5-pro", + "gpt-5-mini", + "o4-mini", + "o3-mini", + ] + ) return preferred if preferred else allowed_models[0]