EasyRouterEasyRouter
Quick StartAPI DocsConnect Agent Tools

Oh My Pi

Oh My Pi tutorial โ€” Terminal AI coding agent. Add EasyRouter as a custom provider via models.yml, with support for reasoning effort levels and thinking mode.

Project Introduction

Oh My Pi is a terminal AI coding agent. Custom model providers are added through a models.yml config file, with full support for reasoning effort, tool calling, and context management.

๐Ÿ“ฆ Prerequisites

What you'll need

  • Oh My Pi installed (the omp command is on your PATH)
  • An EasyRouter endpoint (use https://easyrouter.io/v1 as usual)
  • An EasyRouter API key (generated in the console)
  • A model ID exactly matching one exposed by your EasyRouter console (e.g. claude-sonnet-4-6, gemini-2.5-flash)

๐Ÿ”‘ Step 1: Set the API key environment variable

export EASYROUTER_API_KEY=your-easyrouter-api-key

๐Ÿ”ง Step 2: Create the config file

Create ~/.omp/agent/models.yml and add EasyRouter as a provider:

providers:
  easyrouter:
    baseUrl: https://easyrouter.io/v1
    api: openai-completions
    apiKey: EASYROUTER_API_KEY
    authHeader: true
    models:
      - id: claude-sonnet-4-6
        name: Claude Sonnet 4.6
        reasoning: true
        thinking:
          minLevel: high
          maxLevel: xhigh
          mode: effort
        input: [text]
        contextWindow: 200000
        maxTokens: 128000
        compat:
          supportsDeveloperRole: false
          supportsReasoningEffort: true
          maxTokensField: max_tokens
          reasoningEffortMap:
            high: high
            xhigh: max
          supportsToolChoice: false
          requiresReasoningContentForToolCalls: true
          requiresAssistantContentForToolCalls: true
        extraBody:
          thinking:
            type: enabled
      - id: gemini-2.5-flash
        name: Gemini 2.5 Flash
        reasoning: false
        input: [text]
        contextWindow: 1000000
        maxTokens: 65536
        compat:
          supportsDeveloperRole: false
          maxTokensField: max_tokens

Key configuration fields

FieldPurpose
baseUrlEasyRouter endpoint (keep the /v1 suffix โ€” Oh My Pi handles path joining)
authHeader: trueSend Authorization: Bearer $EASYROUTER_API_KEY
supportsDeveloperRole: falseSend system prompts with the system role
maxTokensField: max_tokensUse max_tokens as the output limit field
supportsToolChoice: falsetool_choice param not accepted in thinking mode
requiresReasoningContentForToolCalls: trueHistory messages in tool-call chats must preserve reasoning_content
requiresAssistantContentForToolCalls: trueEnsure the content field of tool-call messages is not empty

Important

The compat field in models.yml is a full replacement, not a merge with built-in defaults. You must set every field you care about โ€” anything omitted falls back to implicit defaults.

โœ… Step 3: Launch & verify

From your project directory:

cd /path/to/your-project
omp --model easyrouter/claude-sonnet-4-6

For faster, non-reasoning responses:

omp --model easyrouter/gemini-2.5-flash

Press Ctrl+L or type /model inside Oh My Pi to switch models at any time.

โ“ Troubleshooting

IssueFix
"Provider not found" on launchConfirm ~/.omp/agent/models.yml exists and the YAML is valid
401 UnauthorizedMake sure EASYROUTER_API_KEY is exported in the current shell
Reasoning-model tool calls failingEnsure requiresReasoningContentForToolCalls: true is set
Weird behaviour after switching modelsNon-reasoning models: drop reasoning: true and the extraBody.thinking block