Skip to content

Pi

Pi (pi-mono) is a minimal, highly extensible terminal coding framework — TypeScript extensions, skills, prompt templates, themes, tree-shaped sessions, and 15+ built-in providers. Add WRouter as an OpenAI-compatible provider in the config.

Prerequisites

ItemRequirement
Pi (pi-mono)Installed
WRouterA working sk- token

Set the API key

bash
export WROUTER_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Configure

Add to Pi's config file:

json
{
  "providers": {
    "wrouter": {
      "baseUrl": "https://wrouter.ai/v1",
      "api": "openai-completions",
      "apiKey": "$WROUTER_API_KEY",
      "models": [
        {
          "id": "claude-sonnet-4-6",
          "name": "Claude Sonnet 4.6",
          "contextWindow": 200000,
          "maxTokens": 128000,
          "input": ["text"],
          "reasoning": true,
          "compat": {
            "requiresReasoningContentOnAssistantMessages": true,
            "thinkingFormat": "anthropic",
            "reasoningEffortMap": {
              "minimal": "low",
              "low": "low",
              "medium": "medium",
              "high": "high",
              "xhigh": "max"
            }
          }
        },
        {
          "id": "gemini-2.5-flash",
          "name": "Gemini 2.5 Flash",
          "contextWindow": 1000000,
          "maxTokens": 65536,
          "input": ["text"],
          "reasoning": false
        }
      ]
    }
  }
}

Field notes:

FieldNote
baseUrlhttps://wrouter.ai/v1
apiopenai-completions
apiKeyUse $WROUTER_API_KEY to read from env
compat.requiresReasoningContentOnAssistantMessagestrue for Claude thinking models — preserves reasoning trace across turns
compat.thinkingFormatanthropic for Claude models

Verify

bash
pi

Pick wrouter provider and prompt.

Known limitations

  • Pi's tree-shaped session model is a Pi feature, not a WRouter feature; conversation branching uses local state.
  • For per-model reasoning-effort customization, refer to Pi's compat documentation.