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.
- GitHub: https://github.com/can1357/oh-my-pi
- Install guide: https://github.com/can1357/oh-my-pi#installation
๐ฆ Prerequisites
What you'll need
- Oh My Pi installed (the
ompcommand is on your PATH) - An EasyRouter endpoint (use
https://easyrouter.io/v1as 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_tokensKey configuration fields
| Field | Purpose |
|---|---|
baseUrl | EasyRouter endpoint (keep the /v1 suffix โ Oh My Pi handles path joining) |
authHeader: true | Send Authorization: Bearer $EASYROUTER_API_KEY |
supportsDeveloperRole: false | Send system prompts with the system role |
maxTokensField: max_tokens | Use max_tokens as the output limit field |
supportsToolChoice: false | tool_choice param not accepted in thinking mode |
requiresReasoningContentForToolCalls: true | History messages in tool-call chats must preserve reasoning_content |
requiresAssistantContentForToolCalls: true | Ensure 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-6For faster, non-reasoning responses:
omp --model easyrouter/gemini-2.5-flashPress Ctrl+L or type /model inside Oh My Pi to switch models at any time.
โ Troubleshooting
| Issue | Fix |
|---|---|
| "Provider not found" on launch | Confirm ~/.omp/agent/models.yml exists and the YAML is valid |
| 401 Unauthorized | Make sure EASYROUTER_API_KEY is exported in the current shell |
| Reasoning-model tool calls failing | Ensure requiresReasoningContentForToolCalls: true is set |
| Weird behaviour after switching models | Non-reasoning models: drop reasoning: true and the extraBody.thinking block |