Skip to content

Using codex-cli 0.121.0 with openrouter fails #18228

@johnynek

Description

@johnynek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions