Error occurred when connecting to the OpenRouter model

Resolved 💬 3 comments Opened Dec 8, 2025 by xxxlwb Closed Dec 8, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.65.0

What subscription do you have?

openrouter api key

Which model were you using?

openai/gpt-5.1-codex-max

What platform is your computer?

_No response_

What issue are you seeing?

my ~/.codex/config.toml is bellow:
model_provider="openrouter"
model="openai/gpt-5.1-codex-max"

[model_providers.openrouter]
name="openrouter"
base_url="https://openrouter.ai/api/v1"
env_key="OPENROUTER_API_KEY"

What does the following error message mean?

{"error":{"message":"Provider returned error","code":400,"metadata":
{"raw":"{\n \"error\": {\n \"message\": \"Invalid 'input[4].name':
empty string. Expected a string with minimum length 1, but got an
empty string instead.\",\n \"type\": \"invalid_request_error\",
\n \"param\": \"input[4].name\",\n \"code\":
\"empty_string\"\n }\n}","provider_name":"OpenAI"}},"user_id":"user_35x92YP6MlA
GxK4s537Io3nKbei"}

What steps can reproduce the bug?

Add the following lines to ~/.codex/config.toml:

model_provider = "openrouter"
model = "openai/gpt-5.1-codex-max"

[model_providers.openrouter]
name="openrouter"
base_url="https://openrouter.ai/api/v1"
env_key="OPENROUTER_API_KEY"

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 8 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #7721

Powered by Codex Action

xxxlwb · 8 months ago

ok, After adding "wire_api = 'responses'" in config.toml, the error disappeared. However, my response was too slow. I waited for ten minutes for this result

<img width="572" height="136" alt="Image" src="https://github.com/user-attachments/assets/717322db-28ee-495e-a8d4-9ebdc502264d" />

etraut-openai contributor · 8 months ago

This has been fixed in the latest prerelease version 0.66.0-alpha.11 if you want to give it a try.