Overview
OmniMux uses a single gateway Base URL:
https://api.omnimux.ai (OpenAI-compatible clients typically use https://api.omnimux.ai/v1). Console: omnimux.ai/dashboard. Model IDs in this guide are examples — confirm with the console or GET /v1/models.pi) is an open-source, terminal-native coding agent (a command-line tool) from Earendil Works. It supports multiple model providers, custom providers, and pluggable tools, making it well-suited for code assistance and task automation from the command line.
Pi supports custom model providers and the Anthropic Messages API. By configuring OmniMux as a custom provider in ~/.pi/agent/models.json, you can use OmniMux’s Claude model family in Pi while retaining Pi’s complete agent tool-calling capabilities.
Pi’s official focus is the terminal CLI (four run modes: interactive / print / JSON / RPC, plus embedding via the Node.js SDK), and this guide follows the CLI.
Before You Begin
Before starting the configuration, make sure you have completed the following preparations:1. Install the Pi Coding Agent CLI
Pi requires Node.js ≥ 22.19.0. First check your version withnode -v; below this version, npm install -g prints an EBADENGINE warning and the installed CLI may fail to run, so upgrade Node first.
npm warn deprecated node-domexception@1.0.0, you can safely ignore it — it comes from an upstream dependency and does not affect installation or usage. As long as you see added N packages at the end and pi --version prints a version number, the install succeeded.
The official install command includes --ignore-scripts (which skips dependencies’ lifecycle scripts during installation; Pi’s normal installation doesn’t need them). On first run, Pi automatically downloads two native tools — ripgrep and fd — as needed.
Make sure you get the package name @earendil-works/pi-coding-agent right — npm also has a same-named fork @oh-my-pi/pi-coding-agent (a different version line) and the deprecated @mariozechner/pi-coding-agent (whose maintainer has noted you should switch to the earendil-works version). Don’t install the wrong one.
Once installation is complete, confirm the pi command is available:
2. Get an OmniMux API Key
- Log in to the OmniMux console
- Find API Keys in the console, click the “Create New Key” button, then copy the generated key
- The API Key usually starts with
sk-. Please keep it safe.
Step 1: Configure the OmniMux Provider
Pi defines providers and models through a config file namedmodels.json, located in the .pi/agent/ folder inside your home directory (full path ~/.pi/agent/models.json). Claude models frequently use tool_use / tool_result in Pi, so this guide uses OmniMux’s Anthropic Messages-compatible API and configures it as a custom provider of type anthropic-messages.
~ stands for your home directory (/Users/your-username on macOS, /home/your-username on Linux). .pi starts with a dot, making it a hidden folder that Finder / File Explorer won’t show by default — so the easiest way to create the file below is via the command line. Just copy and paste.
This file does not exist by default (the .pi folder usually isn’t created until Pi runs), so you need to create it manually. Follow these three steps:
- macOS: Press
Command + Spaceto open Spotlight, typeTerminal, and press Enter. - Windows: Search for
PowerShellin the Start menu and open it.
models.json in a text editor:
nano editor (a simple text editor inside the terminal).
- nano (macOS / Linux): Press
Control + Othen Enter to save, thenControl + Xto exit. - Notepad (Windows): Press
Control + Sto save, then close the window.
api: "anthropic-messages"— uses OmniMux’s Anthropic Messages-compatible route, so Pi uses Claude’s nativetool_use/tool_resultprotocol.- Set
baseUrlonly to the domain roothttps://api.omnimux.ai— do not manually add/v1or/v1/messages. Pi appends/v1/messagesautomatically; adding it manually duplicates the path and causes a404 Invalid URL. authHeader: trueis required. This field makes Pi attach anAuthorization: Bearerrequest header. OmniMux’s/v1/messagesonly accepts Bearer authentication, while Pi’s built-in Anthropic SDK only sendsx-api-keyby default — omitting this field returns a401.apiKeyhas two forms — pick one:- Option 1 · Paste the key directly (simplest, good for local personal use): replace
"$OMNIMUX_API_KEY"in the config with your real key, e.g."apiKey": "sk-your-real-key". Done in one step, no environment variable needed; the downside is the key sits in plaintext in the config file, so don’t share this file or commit it to Git. - Option 2 · Environment variable interpolation (more secure, recommended): keep
"$OMNIMUX_API_KEY"as is and put the real key in an environment variable (see “Set the API Key Environment Variable” below). This keeps the plaintext key out of the config file. - (Advanced) Pi’s
apiKeyalso supports${OMNIMUX_API_KEY}(equivalent; use braces to disambiguate when the variable name is immediately followed by literal text) and!command(a leading!runs a command and uses its output as the key, for example reading from a password manager:"!op read 'op://vault/item/credential'"). If you need a literal$or!in the value, escape them as$$and$!.
/login in interactive mode to select this provider and store the key in ~/.pi/agent/auth.json — the effect is equivalent.
Set the API Key Environment Variable
You only need this step if you chose Option 2 (environment variable interpolation) above. If you chose Option 1 (paste the key directly), the key is already in the config file — skip this section and go straight to Step 2. Point the$OMNIMUX_API_KEY referenced in the configuration above to your real key. Below are both the temporary version (only valid in the current terminal window; gone once you close it — good for a first test run) and the persistent version (loaded automatically every time you open a terminal):
Temporary (current terminal window; lost when closed):
echo $SHELL in the terminal — if the output contains zsh, use ~/.zshrc; if it contains bash, use ~/.bashrc.
Temporary (current PowerShell window; lost when closed):
setx does not affect the current window; restart your terminal (close and reopen PowerShell) for it to take effect.
Step 2: Start Using and Verify
1. Select a Model
Run the following command in your terminal to launch Pi:/model and press Enter in the command palette to open the model selector:
The selector lists every OmniMux model configured in models.json (tagged [omnimux]). Use the arrow keys to highlight the model you want (such as claude-fable-5) and press Enter to confirm:
Once a model is selected, the status bar at the bottom shows the current model, thinking level, and context usage (for example claude-fable-5 · medium and 0.0%/1.0M), confirming the model catalog loaded successfully.
The yellow hint “Only showing models from configured providers. Use /login to add providers.” is expected — Pi only lists models from providers you have configured. Connecting through the OmniMux custom provider does not require /login.
2. Verify the Configuration
After selecting a model, first enter a simple prompt to verify the model response:- You see the AI’s normal reply (a few lines of text).
- Pi can call the
lstool in the second task and continue responding. - There are no errors such as
401,404,model_not_found, orUnexpected role "tool".
Troubleshooting
The following is organized by the actual error you see — just find the one that matches.Returns 401 (Invalid API key)
- The environment variable didn’t take effect (most common): run
test -n "$OMNIMUX_API_KEY" && echo "Key loaded" || echo "Key not loaded"in the current terminal; on Windows, you need to restart the terminal after usingsetx. - The
apiKeyfield is wrong: confirm thatmodels.jsoncontains"$OMNIMUX_API_KEY"(referencing the environment variable), rather than treating the variable name as a literal key. "authHeader": trueis missing: OmniMux’s/v1/messagesrequires a Bearer token, so confirm this field is inside the same provider configuration asapiKey.- The key itself is invalid or has been disabled: check it in the OmniMux console.
Returns 404 Invalid URL
baseUrl. Pi automatically appends /v1/messages, so change baseUrl back to the domain root: https://api.omnimux.ai.
Returns 404 model_not_found
id in models.json exactly matches the model name returned by the OmniMux console / /v1/models.
Returns 400 Unexpected role "tool"
api: "openai-completions" with a Base URL ending in /v1. Pi sends agent tool results with OpenAI’s role: "tool", which the current Claude-compatible route does not accept.
Solution: change these three provider fields:
supportsDeveloperRole or supportsReasoningEffort, because the rejected role is the tool role, not the developer role or a reasoning parameter. Start a new session after updating the configuration.
About Cost
Thecost field in the models.json above is OmniMux’s actual price (a flat 10% discount, in USD per million tokens), for Pi to use as a reference when estimating usage:
Cache Read is the price when the cache is hit (about 0.1× of Input). Actual savings depend on the cache hit rate; the larger the context, the less stable the hits, so the benefit is discounted — don’t treat it as an unconditional low price.
FAQ
How do I open a command-line terminal?
-
Option 1: Press
Command + Spaceto open Spotlight, typeTerminal, and press Enter. - Option 2: Go to Applications → Utilities → Terminal.
-
Option 1: Press
Win + R, typepowershell, and press Enter. - Option 2: Search for “PowerShell” in the Start menu.
-
Press
Ctrl + Alt + T, or search for “Terminal” in your application menu.
1. Why set baseUrl only to the domain root?
Because Pi’s anthropic-messages provider automatically appends /v1/messages after baseUrl. Adding /v1 or /v1/messages manually duplicates the path and returns 404 Invalid URL. Use only https://api.omnimux.ai.
2. Do I need to set authHeader: true?
Yes. authHeader: true makes Pi attach an additional Authorization: Bearer request header; OmniMux’s /v1/messages uses Bearer authentication, while Pi’s built-in Anthropic SDK only sends x-api-key by default, so omitting it causes a 401.
3. Why does this guide follow the terminal CLI?
Pi’s official primary form is the terminal CLI (four run modes: interactive / print / JSON / RPC, plus embedding via the Node.js SDK). Configuring and verifying the OmniMux integration is all done in the CLI, which is stable and reliable. All steps in this guide follow the CLI.4. How do I avoid writing the API Key in plaintext in the config?
Use environment variable interpolation in theapiKey field (such as "$OMNIMUX_API_KEY"), keeping the real key in an environment variable.
5. Which common models does OmniMux support?
OmniMux supports the full Claude family (it also supports GPT, Gemini, and more, which you can view in the console). For planning / complex reasoning,claude-fable-5 is recommended; for everyday execution, use claude-sonnet-5; for lightweight tasks, use claude-haiku-4-5-20251001.