Models Hub
Agent Tools

Pi

A minimal, highly extensible terminal coding framework with support for custom skills and templates.

Edit this page

Overview

Pi (pi-mono) is a minimal, highly extensible terminal coding framework that supports TypeScript extensions, skills, prompt templates, and themes, with a tree-shaped session structure and 15+ built-in providers. You can add Models Hub as a custom OpenAI-compatible provider simply through a configuration file.

📦 Before You Start

What you need

  • Pi (pi-mono) installed
  • A working Models Hub Base URL (must end with /v1)
  • A working Models Hub API Key (generate it in the console)
  • The model name you want to use (such as claude-sonnet-4-6, gemini-2.5-flash, etc., which must match the model ID in the Models Hub console exactly)

🔑 Step 1: Set the Environment Variable

export MODELSOK_API_KEY="ms_live_your_key"

🔧 Step 2: Edit the Configuration File

Add the Models Hub provider in Pi's configuration file:

{
  "providers": {
    "modelsok": {
      "baseUrl": "https://modelsok.com/v1",
      "api": "openai-completions",
      "apiKey": "$MODELSOK_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
        }
      ]
    }
  }
}

Key fields

  • baseUrl uses the standard Models Hub Base URL https://modelsok.com/v1
  • api is fixed as openai-completions
  • apiKey uses the $MODELSOK_API_KEY variable reference
  • compat.requiresReasoningContentOnAssistantMessages: true ensures reasoning content is preserved in history messages in thinking mode
  • reasoningEffortMap maps Pi's reasoning levels to the levels supported by the target model; for non-reasoning models you can simply omit this block

✅ Step 3: Launch and Verify

Launch Pi, select modelsok in the provider selector, then choose the target model. Send a test message, and if you receive a normal response, the configuration was successful.

❓ FAQ

IssueSolution
modelsok not in the provider listCheck that the config file path and JSON format are correct
401 UnauthorizedConfirm that MODELSOK_API_KEY is exported in the current shell
Abnormal behavior with reasoning modelsCheck whether requiresReasoningContentOnAssistantMessages and thinkingFormat match the model
Model does not existCheck that models[].id matches the Models Hub console exactly

On this page