Use OpenRouter with Codex from the terminal
Connect your OpenRouter account once, then choose its model when launching Codex. You need the Mandri CLI and an OpenRouter API key. Model requests use your OpenRouter account and its billing limits.
Add OpenRouter
Section titled “Add OpenRouter”mandri provider add openrouterPaste your key at the provider API key: prompt. The key is entered interactively rather than included in the command. Mandri verifies the connection before saving it.
If you already registered this name, check the existing connection:
mandri provider verify openrouterTo add a different OpenRouter account, use a distinct name and specify its type:
mandri provider add second-router --kind openrouterList models and start Codex
Section titled “List models and start Codex”mandri provider models openrouterChoose a model intended for tool use. Replace <model-id> with its exact ID, keeping any slashes inside it:
mandri run --model "openrouter/<model-id>" codexRun this command from your project folder. Codex is included with Mandri. Enter your task when its terminal interface opens.
For Pi, install it using the official instructions, make sure pi is available on your PATH, then use:
mandri run --model "openrouter/<model-id>" piOpenRouter and the provider serving the model receive the model requests. Available capabilities depend on the selected model and tool. The OpenRouter Codex guide describes model compatibility; Mandri supplies the connection configuration for the commands above.
If setup fails
Section titled “If setup fails”Verification fails: check the key’s status in OpenRouter and read the error in the terminal.
The model is listed but the task fails: check its availability, tool use support, your account balance and key limits. Listing models does not test a coding task.
For the graphical interface, use OpenRouter in the app.