Use OpenRouter with Pi or Codex in Mandri
Add OpenRouter in Mandri’s settings, then choose its model in your session. This guide uses Pi and also covers the shorter setup for Codex.
Before you start
Section titled “Before you start”You need the Mandri desktop app, a project folder and an OpenRouter API key. Model usage is charged to your OpenRouter account according to the model you select. OpenRouter and the provider serving the model receive the model requests.
For Pi, follow the official installation instructions. Pi must be installed on the computer running Mandri, with its command available on the system’s PATH. If you prefer Codex, it is included with Mandri.
Add OpenRouter in Settings
Section titled “Add OpenRouter in Settings”- Open Settings, then Providers.
- Select Add provider.
- Enter a Name, such as
openrouter. You will use this name to find the provider in the model menu. - Set Kind to OpenRouter.
- Paste your key into API key (required).
- Select Save and verify.
After saving, the provider appears in the list. Click its name to view its model catalog. This checks the connection and access to the model catalog. It does not establish that every model will work with every tool.
The app’s provider form with demonstration data. Use your own key when following the steps.
Choose Pi and a model
Section titled “Choose Pi and a model”- Return to New chat and select your project folder.
- Open the tool selector in the message composer and choose Pi.
- Open the model menu, find the provider name you just added and select a model that supports tool use.
- Choose Accept edits to allow Pi to edit files without asking for each change. This permits the
editandwritetools; other actions can still require your approval.
The model is selected for the session. The provider’s model catalog in Settings is for browsing only.
Send a request about your project, describing the result you expect.
Follow the tool calls in the conversation and respond if the agent asks for permission. For a task that changes files, inspect the changes before continuing.
Use Codex with the same provider
Section titled “Use Codex with the same provider”You can reuse the OpenRouter connection. Start a new chat, choose Codex, then select a model from your OpenRouter provider in the model menu. Choose Ask for approval to be asked about actions that require approval.
You do not need to configure OpenRouter again. Model capabilities and behavior can differ between Pi and Codex, even with the same model selected.
If the setup does not work
Section titled “If the setup does not work”- Verification fails: check that the key belongs to OpenRouter and is still active. Read the error shown in the form before retrying.
- The provider is verified but a task fails: check the model’s availability, your account balance and any limits on the key in OpenRouter. Verification does not run a task with the model.
- Pi cannot start: check its installation on the computer running Mandri and whether the
picommand is available there. Codex is an alternative if you want to begin with the tool included in the app. - The model replies but does not use tools correctly: choose a model intended for tool use. Being listed in the catalog does not guarantee reliable coding behavior.
For another connection method, see Add a model provider. For the rest of the app workflow, see Run your first task.