fix: add gpt-5.1-mini and gpt-5.1-nano registry entries with supports_none_reasoning_effort

Per OpenAI's parameter compatibility guide, the gpt-5.1 family
(including gpt-5.1-mini and gpt-5.1-nano) supports `temperature` when
reasoning_effort is omitted or set to 'none'. LiteLLM's pre-flight
check correctly applies this for the bare `gpt-5.1` slug (which has
`supports_none_reasoning_effort: true` in the registry), but
`gpt-5.1-mini` and `gpt-5.1-nano` are absent from
`model_prices_and_context_window.json` entirely, so they fall back to
strict rejection — `litellm.UnsupportedParamsError` even when
reasoning_effort is null.

Adds the two missing entries with the same flag matrix as the existing
`gpt-5.1` entry — most importantly `supports_none_reasoning_effort:
true`. Pricing is anchored to the gpt-5-mini and gpt-5-nano siblings
(same scale tier, same provider) until OpenAI publishes explicit 5.1
mini/nano pricing; this matches the conservative "match the 5.0
generation siblings" rule rather than inventing numbers. Context
window (272000 input / 128000 output) matches the rest of the gpt-5.1
family.

Also extends two existing tests in tests/test_litellm/llms/openai/
test_gpt5_transformation.py:
  - test_gpt5_1_model_detection: asserts gpt-5.1-mini and
    gpt-5.1-nano now resolve through
    `_supports_reasoning_effort_level(model, "none")` as True.
  - test_gpt5_1_mini_nano_temperature_with_reasoning_effort_none:
    new test mirroring the existing
    test_gpt5_1_temperature_with_reasoning_effort_none, asserting
    temperature pass-through for these two new slugs.

Repro and full curl evidence in #27351.
This commit is contained in:
Daniel Naves de Carvalho 2026-05-11 11:04:17 -03:00
parent 50ef2d51a2
commit 9268dfc08a
3 changed files with 187 additions and 0 deletions

View file

@ -20746,6 +20746,89 @@
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.1-mini": {
"cache_read_input_token_cost": 2.5e-08,
"cache_read_input_token_cost_flex": 1.25e-08,
"cache_read_input_token_cost_priority": 4.5e-08,
"input_cost_per_token": 2.5e-07,
"input_cost_per_token_flex": 1.25e-07,
"input_cost_per_token_priority": 4.5e-07,
"litellm_provider": "openai",
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 2e-06,
"output_cost_per_token_flex": 1e-06,
"output_cost_per_token_priority": 3.6e-06,
"supported_endpoints": [
"/v1/chat/completions",
"/v1/batch",
"/v1/responses"
],
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_service_tier": true,
"supports_vision": true,
"supports_web_search": true,
"supports_none_reasoning_effort": true,
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.1-nano": {
"cache_read_input_token_cost": 5e-09,
"cache_read_input_token_cost_flex": 2.5e-09,
"input_cost_per_token": 5e-08,
"input_cost_per_token_flex": 2.5e-08,
"input_cost_per_token_priority": 2.5e-06,
"litellm_provider": "openai",
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4e-07,
"output_cost_per_token_flex": 2e-07,
"supported_endpoints": [
"/v1/chat/completions",
"/v1/batch",
"/v1/responses"
],
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true,
"supports_web_search": true,
"supports_none_reasoning_effort": true,
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.2-codex": {
"cache_read_input_token_cost": 1.75e-07,
"cache_read_input_token_cost_priority": 3.5e-07,

View file

@ -20760,6 +20760,89 @@
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.1-mini": {
"cache_read_input_token_cost": 2.5e-08,
"cache_read_input_token_cost_flex": 1.25e-08,
"cache_read_input_token_cost_priority": 4.5e-08,
"input_cost_per_token": 2.5e-07,
"input_cost_per_token_flex": 1.25e-07,
"input_cost_per_token_priority": 4.5e-07,
"litellm_provider": "openai",
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 2e-06,
"output_cost_per_token_flex": 1e-06,
"output_cost_per_token_priority": 3.6e-06,
"supported_endpoints": [
"/v1/chat/completions",
"/v1/batch",
"/v1/responses"
],
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_service_tier": true,
"supports_vision": true,
"supports_web_search": true,
"supports_none_reasoning_effort": true,
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.1-nano": {
"cache_read_input_token_cost": 5e-09,
"cache_read_input_token_cost_flex": 2.5e-09,
"input_cost_per_token": 5e-08,
"input_cost_per_token_flex": 2.5e-08,
"input_cost_per_token_priority": 2.5e-06,
"litellm_provider": "openai",
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4e-07,
"output_cost_per_token_flex": 2e-07,
"supported_endpoints": [
"/v1/chat/completions",
"/v1/batch",
"/v1/responses"
],
"supported_modalities": [
"text",
"image"
],
"supported_output_modalities": [
"text"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true,
"supports_web_search": true,
"supports_none_reasoning_effort": true,
"supports_xhigh_reasoning_effort": false,
"supports_minimal_reasoning_effort": true
},
"gpt-5.2-codex": {
"cache_read_input_token_cost": 1.75e-07,
"cache_read_input_token_cost_priority": 3.5e-07,

View file

@ -276,6 +276,8 @@ def test_gpt5_1_model_detection(gpt5_config: OpenAIGPT5Config):
assert gpt5_config._supports_reasoning_effort_level("gpt-5.1", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.1-2025-11-13", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.1-chat-latest", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.1-mini", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.1-nano", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.2", "none")
assert gpt5_config._supports_reasoning_effort_level("gpt-5.2-2025-12-11", "none")
# codex/pro/chat variants do not support none
@ -304,6 +306,25 @@ def test_gpt5_1_temperature_with_reasoning_effort_none(config: OpenAIConfig):
assert params["reasoning_effort"] == "none"
def test_gpt5_1_mini_nano_temperature_with_reasoning_effort_none(
config: OpenAIConfig,
):
"""Test that gpt-5.1-mini and gpt-5.1-nano support temperature when
reasoning_effort='none' (registry parity with bare gpt-5.1)."""
for model in ["gpt-5.1-mini", "gpt-5.1-nano"]:
for temp in [0.0, 0.7, 1.0, 1.5]:
params = config.map_openai_params(
non_default_params={"temperature": temp, "reasoning_effort": "none"},
optional_params={},
model=model,
drop_params=False,
)
assert params["temperature"] == temp, (
f"{model} should preserve temperature={temp} with effort='none'"
)
assert params["reasoning_effort"] == "none"
def test_gpt5_2_temperature_with_reasoning_effort_none(config: OpenAIConfig):
"""Test that GPT-5.2 aligns with GPT-5.1 temperature rules when effort='none'."""
for temp in [0.0, 0.3, 0.7, 1.0, 1.5]: