Models Hub
Agent Tools

Use Oh My Pi with Models Hub: models.yml Custom Provider

Edit Oh My Pi's ~/.omp/agent/models.yml to add Models Hub as a custom provider over the OpenAI-compatible protocol, with verification and error troubleshooting.

Edit this page

Oh My Pi (the omp command) is a terminal AI coding agent with built-in LSP, subagents, and browser tools, configured through ~/.omp/agent/models.yml for custom model providers. Add Models Hub there, and every chat and code edit inside omp uses your Models Hub balance for the model you choose. This page covers the connection only, not how to use Oh My Pi itself.

Three things you need

A Models Hub API key, the base URL https://modelsok.com/v1, and a model name. There's no one-click setup — Oh My Pi isn't one of the targets the Models Hub CLI supports.

Prerequisites

  • Oh My Pi installed (the omp command available). Use bun install -g @oh-my-pi/pi-coding-agent, or curl, Homebrew, Nix, or PowerShell — see omp.sh for options.
  • A Models Hub API key, created on the Tokens page. The token's group must have access to the models you plan to use.
Use caseModelPricingLive status
Everyday codingclaude-sonnet-4-6PriceAvailability and latency
Harder reasoning and long tasksgpt-5.6-lunaPriceAvailability and latency
Cheap and fast for small editsgpt-5.4-miniPriceAvailability and latency

Model names are authoritative on the pricing page.

Setup

Step 1 — Set the environment variable

export MODELSOK_API_KEY="your-models-hub-api-key"

Step 2 — Edit models.yml

Create or edit ~/.omp/agent/models.yml:

providers:
  modelsok:
    baseUrl: https://modelsok.com/v1
    api: openai-completions
    apiKey: MODELSOK_API_KEY
    authHeader: true
    models:
      - id: claude-sonnet-4-6
        name: Claude Sonnet 4.6
        contextWindow: 200000
        maxTokens: 128000
      - id: gpt-5.4-mini
        name: GPT-5.4 Mini
        contextWindow: 128000
        maxTokens: 16384

Key fields

FieldDescription
baseUrlThe base URL, ending in /v1
apiProtocol type; openai-completions for the OpenAI-compatible protocol — Oh My Pi also supports anthropic-messages and others
apiKeyThe name of an environment variable (no $ prefix); Oh My Pi looks for that env var first, and only falls back to treating the value as a literal key
authHeader: trueSends the resolved key as Authorization: Bearer <key>
models[].idMust exactly match the model name in the Models Hub console

Reasoning models may need a compat override

If a reasoning model returns field names (like the reasoning-content field or the max_tokens parameter name) that differ from the standard OpenAI shape, add a compat block under that model entry to override them — see the official docs/models.md. Everyday usage usually doesn't need this; get the minimal config above working first, then adjust as needed.

Verify

Go to your project directory and launch with the model flag:

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

Or start omp normally, then press Ctrl+P or type /model to switch to a model under modelsok. Send a test message; a normal reply means you're connected. Then open Usage logs in the Models Hub console; a request under your configured model name appears within seconds.

Common errors

SymptomCauseFix
Provider not found on startupThe path or YAML indentation in ~/.omp/agent/models.yml is wrongCheck the file path, and confirm indentation uses spaces, not tabs
401 UnauthorizedMODELSOK_API_KEY isn't exported in the current shell, or apiKey has a typoCheck the environment variable, reopen the terminal, and retry
Model not foundmodels[].id doesn't match the Models Hub consoleCheck the name on the pricing page
Tool-call errors with a reasoning modelThe reasoning-content field name doesn't match upstreamOverride the relevant field in a compat block per the official docs
omp models modelsok shows nothingThe config wasn't saved, or has a formatting errorRecheck the YAML syntax, then restart omp

More in Troubleshooting.

FAQ

How is it billed? Per input and output token actually consumed, at the price on each model's pricing page; every request is itemized in usage logs.

How is this different from using the official APIs directly? Oh My Pi sends requests to the Models Hub gateway over the openai-completions protocol — you don't need a separate account with each vendor, and one key covers every model.

How do I switch models? Pass --model modelsok/<model-id> at launch, or press Ctrl+P to cycle, or type /model inside a session to open the picker.

On this page