Using codex-cli 0.121.0 with openrouter fails

Resolved 💬 1 comment Opened Apr 16, 2026 by johnynek Closed Apr 16, 2026

What version of Codex CLI is running?

0.121.0

What subscription do you have?

pro

Which model were you using?

gpt-5.3-codex

What platform is your computer?

Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

ghostty

What issue are you seeing?

I did the official suggestions: https://openrouter.ai/docs/guides/coding-agents/codex-cli

I can start and when I issue any message at the cli I get:

■ {"error":{"code":"invalid_prompt","message":"Invalid Responses API request"},"metadata":{"raw":"[\n  {\n    \"code\": \"invalid_union\",\n    \"errors\":[\n      [\n        {\n          \"code\": \"invalid_union\",\n          \"errors\": [],\n          \"note\": \"No matching discriminator\",\n\"discriminator\": \"type\",\n          \"path\": [\n            \"type\"\n          ],\n          \"message\": \"Invalid input\"\n        }\n      ],\n[\n        {\n          \"code\": \"invalid_value\",\n          \"values\": [\n            \"openrouter:datetime\"\n          ],\n          \"path\": [\n\"type\"\n          ],\n          \"message\": \"Invalid input: expected \\\"openrouter:datetime\\\"\"\n        }\n      ],\n      [\n        {\n\"code\": \"invalid_value\",\n          \"values\": [\n            \"openrouter:image_generation\"\n          ],\n          \"path\": [\n\"type\"\n          ],\n          \"message\": \"Invalid input: expected \\\"openrouter:image_generation\\\"\"\n        }\n      ],\n      [\n        {\n\"code\": \"invalid_value\",\n          \"values\": [\n            \"openrouter:experimental__search_models\"\n          ],\n          \"path\": [\n\"type\"\n          ],\n          \"message\": \"Invalid input: expected \\\"openrouter:experimental__search_models\\\"\"\n        }\n      ],\n      [\n{\n          \"code\": \"invalid_value\",\n          \"values\": [\n            \"openrouter:web_search\"\n          ],\n          \"path\": [\n\"type\"\n          ],\n          \"message\": \"Invalid input: expected \\\"openrouter:web_search\\\"\"\n        }\n      ]\n    ],\n    \"path\": [\n\"tools\",\n      15\n    ],\n    \"message\": \"Invalid input\"\n  }\n]"}}

When I downgrade back to 0.120.0 it works as expected.

What steps can reproduce the bug?

Install 0.121.0, set up a ~/.codex/config.toml matching: https://openrouter.ai/docs/guides/coding-agents/codex-cli and then start with your openrouter API key.

What is the expected behavior?

It should respond to the message without hitting any errors.

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗