Oh My Pi

Connect Oh My Pi to CoffeeRouter with an OpenAI-compatible provider in models.yml.

Before you begin

  • Create an active CoffeeRouter token and note the exact model IDs available to it.
  • Use https://www.coffeerouter.ai/v1 as the CoffeeRouter OpenAI-compatible base URL.
  • If you install with Bun, use Bun 1.3.14 or later.

Configuration steps

1. Install Oh My Pi

On macOS or Linux, run the official installer:

curl -fsSL https://omp.sh/install | sh

On Windows PowerShell, run:

irm https://omp.sh/install.ps1 | iex

You can also install OMP with Bun:

bun install -g @oh-my-pi/pi-coding-agent

Verify the installation:

omp --version

2. Set the CoffeeRouter token

On macOS, Linux, or WSL:

export COFFEEROUTER_API_KEY="sk-your-api-key"

On Windows PowerShell:

$env:COFFEEROUTER_API_KEY = "sk-your-api-key"

OMP first interprets an apiKey value in models.yml as an environment variable name, so the configuration can safely reference COFFEEROUTER_API_KEY.

3. Add the CoffeeRouter provider

Open ~/.omp/agent/models.yml, creating it if necessary. Add the following configuration, or merge the coffeerouter entry into an existing providers object:

providers:
    coffeerouter:
        baseUrl: https://www.coffeerouter.ai/v1
        apiKey: COFFEEROUTER_API_KEY
        api: openai-completions
        authHeader: true
        models:
            - id: your-model-id
              name: Your Model

Replace your-model-id with the complete model ID shown in CoffeeRouter. openai-completions calls /v1/chat/completions, so keep the trailing /v1 in baseUrl and do not create /v1/v1.

4. Select the CoffeeRouter model

Start OMP with an explicit model:

omp --model coffeerouter/your-model-id

Alternatively, start omp and use /model in the session to choose coffeerouter/your-model-id. The current preferred option is --model; --provider is legacy.

Verify the connection

Send a simple test request, such as asking the model to describe the current project directory. A streamed response with coffeerouter/your-model-id shown as the active model confirms the connection.

You can also list loaded models:

omp models

Troubleshooting

Why must the base URL include /v1?

OMP's openai-completions transport calls /chat/completions relative to the base URL. The CoffeeRouter OpenAI-compatible base URL is https://www.coffeerouter.ai/v1.

Why does the model not appear under /model?

Check the YAML indentation, the model id, and the COFFEEROUTER_API_KEY environment variable. If configuration validation fails, OMP continues with built-in models but the custom provider will not load correctly.

Why do requests return 401?

Confirm that the process starting OMP can read COFFEEROUTER_API_KEY, and that the token is unexpired and has available quota. authHeader: true sends it as a Bearer token.

Should I copy another provider's compat configuration?

Usually not. compat handles endpoint-specific request differences and should only be added after confirming that a particular CoffeeRouter model needs it. Do not copy provider-specific values blindly.

Security

Do not commit the token directly to models.yml or a source repository. Use an environment variable, and do not share configuration screenshots or logs containing request headers. Create a dedicated OMP token with model, quota, and IP restrictions.

Official resources