Skip to content

gpt-5.1 and gpt-5.1-codex always receive reasoning_effort="minimal", causing failures with the OpenAI API #2120

@shun-tak

Description

@shun-tak

Git provider

Github Cloud

System Info

  • GPT 5.1 / GPT 5.1 Codex
  • GitHub Actions

Bug details

PR Agent always sends "minimal" to the OpenAI API, which results in a request failure because gpt-5.1-codex does not support "minimal".

Ref : https://openai.com/index/gpt-5-1-for-developers/

This makes the model completely unusable with PR Agent.

Error message

Unsupported value: 'minimal' is not supported with the 'gpt-5.1-codex' model.
Supported values are: 'low', 'medium', and 'high'.

How to reproduce

.pr_agent.toml:

[config]
model = "gpt-5.1-codex"
reasoning_effort = "high"

Run any PR Agent command that triggers an LLM call.

Root cause

The issue originates from this block in litellm_ai_handler.py:

if model.startswith('gpt-5'):
if model.endswith('_thinking'):
thinking_kwargs_gpt5 = {
"reasoning_effort": 'low',
"allowed_openai_params": ["reasoning_effort"],
}
else:
thinking_kwargs_gpt5 = {
"reasoning_effort": 'minimal',
"allowed_openai_params": ["reasoning_effort"],
}
model = 'openai/'+model.replace('_thinking', '') # remove _thinking suffix

if model.startswith('gpt-5'):
    if model.endswith('_thinking'):
        thinking_kwargs_gpt5 = {
            "reasoning_effort": 'low',
            "allowed_openai_params": ["reasoning_effort"],
        }
    else:
        thinking_kwargs_gpt5 = {
            "reasoning_effort": 'minimal',
            "allowed_openai_params": ["reasoning_effort"],
        }
    model = 'openai/'+model.replace('_thinking', '')  # remove _thinking suffix

This forces gpt-5 / gpt-5.1-codex to send:

{"reasoning_effort": "minimal"}

regardless of the user’s configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions