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 Sameer Kankute
parent 6fc335030a
commit 8a5feb18e3
2 changed files with 2 additions and 8 deletions

View file

@ -24707,11 +24707,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

@ -24707,11 +24707,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"