fix(openrouter): fix crash of gpt-5.2-codex by using mode "chat" (#20577)

Commit 1cdda28b6 changed "openrouter/openai/gpt-5.2-codex" to mode "responses",
but this broke GPT-5.2-Codex with OpenRouter:

```
response = await litellm.acompletion(
            model="openrouter/openai/gpt-5.2-codex",
            messages=[{"role": "user", "content": "Hello"}],
            api_key=os.environ.get("OPENROUTER_API_KEY"),
)
```
crashes with: `OpenrouterException - argument of type 'NoneType' is not iterable`

Responses API is in beta in OpenRouter and no other OpenRouter models use "responses"
mode. The commit that changed this probably did it by mistake.

Therefore change the mode to "chat" and fix the crash.
This commit is contained in:
Piotr Grabowski 2026-02-07 08:17:04 +01:00 • committed by GitHub
parent 405bb4b7b6
commit 3114eb336e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 8 deletions

View file

@ -24610,11 +24610,8 @@
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "responses",
"mode": "chat",
"output_cost_per_token": 1.4e-05,
"supported_endpoints": [
"/v1/responses"
],
"supported_modalities": [
"text",
"image"

View file

@ -24640,11 +24640,8 @@
"max_input_tokens": 272000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "responses",
"mode": "chat",
"output_cost_per_token": 1.4e-05,
"supported_endpoints": [
"/v1/responses"
],
"supported_modalities": [
"text",
"image"