Tutorials

Pi × Vivgrid

How to use Vivgrid with gemini-4-argon, gpt-6-sol and claude-opus-5-5 in Pi

Pi

Pi is a minimal terminal coding harness. It ships with read, bash, edit and write tools, then gets out of your way — you extend it with TypeScript extensions, skills, prompt templates and themes instead of forking it.

Key features include:

  • Provider-agnostic by design
    Any OpenAI-, Anthropic- or Google-compatible endpoint becomes a first-class provider through a single JSON file.
  • Four run modes
    Interactive TUI, --print for one-shot prompts, JSON/RPC for process integration, and an SDK for embedding.
  • Sessions you can branch
    Continue, resume, fork or export any session; compaction keeps long runs inside the context window.
  • Extend it yourself
    Extensions are plain TypeScript files, shareable as npm or git packages.

Install Pi

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

Or use the installer script:

curl -fsSL https://pi.dev/install.sh | sh

Configure Pi to Use Vivgrid

Grab your API key from the Vivgrid Console, then add Vivgrid as a provider in ~/.pi/agent/models.json:

{
  "providers": {
    "vivgrid": {
      "baseUrl": "https://api.vivgrid.com/v1",
      "apiKey": "viv-xxxxxxxxxxxxx",
      "api": "openai-completions",
      "compat": {
        "sendSessionAffinityHeaders": true
      },
      "models": [
        {
          "id": "gemini-4-argon",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1048576,
          "maxTokens": 1048576
        },
        {
          "id": "gpt-6-astra",
          "api": "openai-responses",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1050000,
          "maxTokens": 128000
        },
        {
          "id": "gpt-6-sol",
          "api": "openai-responses",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1050000,
          "maxTokens": 128000
        },
        {
          "id": "claude-fable-5-1",
          "reasoning": true,
          "contextWindow": 1000000,
          "maxTokens": 128000
        },
        {
          "id": "gemini-3.8-flash",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1000000,
          "maxTokens": 65536
        },
        {
          "id": "claude-opus-5-5",
          "reasoning": true,
          "contextWindow": 1000000,
          "maxTokens": 128000
        },
        {
          "id": "deepseek-v4-pro-0813",
          "reasoning": true,
          "contextWindow": 1000000,
          "maxTokens": 128000
        },
        {
          "id": "glm-5.3",
          "reasoning": true,
          "contextWindow": 1000000,
          "maxTokens": 128000
        }
      ]
    }
  }
}

Four things worth noting:

  • One key, one baseUrl — every Vivgrid model in the list is reachable through the same OpenAI-compatible endpoint.
  • Setting compat.sendSessionAffinityHeaders to true at the provider level instructs Pi to send your session_id (session_id, x-client-request-id, and x-session-affinity headers) on every request across all models, enabling session-aware routing and higher prompt cache hit rates on Vivgrid.
  • The GPT entries override api at the model level to openai-responses, because Vivgrid serves the GPT-6 and GPT-5.6 families through the Responses API. The rest stay on openai-completions.
  • glm-5.3-flash sets compat.supportsDeveloperRole to false, so Pi sends the system prompt as a system message instead of a developer one.

To also enable extended prompt caching (cacheRetention === "long") so Pi sends prompt_cache_key (session_id) and prompt_cache_retention: "24h" in the Chat Completions request body, export PI_CACHE_RETENTION=long in your shell profile (~/.zshrc or ~/.bashrc).

models.json is re-read every time you open /model. Add a model mid-session and it shows up immediately — no restart needed.

Add more models from the Vivgrid catalog by appending entries to the same list.

Make Vivgrid the Default

Set the provider, model and thinking level Pi starts with in ~/.pi/agent/settings.json:

{
  "defaultProvider": "vivgrid",
  "defaultModel": "gemini-4-argon",
  "defaultThinkingLevel": "high",
  "theme": "dark",
  "tuiMode": "regular"
}

defaultThinkingLevel accepts off, minimal, low, medium, high, xhigh and max.

Verify

List everything Pi resolved for the provider:

pi --list-models vivgrid
provider  model              context  max-out  thinking  images      
vivgrid   gemini-4-argon     1M       1M       yes       yes 
vivgrid   gpt-6-astra        1.1M     128K     yes       yes 
vivgrid   gpt-6-sol          1.1M     128K     yes       yes 
vivgrid   claude-fable-5-1      1M       128K     yes       no    
vivgrid   claude-opus-5-5    1M       128K     yes       no    
vivgrid   deepseek-v4-pro-0813    1M       128K     yes       no    
vivgrid   gemini-3.8-flash   1M       65.5K    yes       yes   
vivgrid   glm-5.3            1M       128K     yes       no    

Start Using Pi with Vivgrid

export PI_CACHE_RETENTION=long
pi

Press /model to switch models, or Ctrl+P to cycle through them. You can also pick a model per run:

pi --provider vivgrid --model gemini-4-argon --thinking high

Or run a one-shot prompt without entering the TUI:

pi -p "explain the auth flow in this repo" --model vivgrid/gemini-4-argon

Summary

Pi keeps credentials and model definitions in one small JSON file, which makes Vivgrid a drop-in backend: point baseUrl at https://api.vivgrid.com/v1, paste one key, and the whole catalog — Gemini 4, GPT-6, DeepSeek-V4, GLM-5.3 — becomes selectable from /model with geo-distributed acceleration behind it.

On this page