# Pi × Vivgrid

> Source: https://vivgrid.com/docs/tutorials/pi

How to use Vivgrid with gpt-6-sol, claude-opus-5-5 and deepseek-v4-pro in Pi

## Pi

[Pi](https://pi.dev) 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

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

Or use the installer script:

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

## Configure Pi to Use Vivgrid

Grab your API key from the [Vivgrid Console](https://console.vivgrid.com), then add Vivgrid as a provider in `~/.pi/agent/models.json`:

```json ~/.pi/agent/models.json lines icon="json" highlight={4,5,6}
{
  "providers": {
    "vivgrid": {
      "baseUrl": "https://api.vivgrid.com/v1",
      "apiKey": "viv-xxxxxxxxxxxxx",
      "api": "openai-completions",
      "models": [
        {
          "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
        }
      ]
    }
  }
}
```

Three things worth noting:

- One key, one `baseUrl` — every Vivgrid model in the list is reachable through the same OpenAI-compatible endpoint.
- 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.

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

Add more models from the [Vivgrid catalog](/docs/models) 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`:

```json ~/.pi/agent/settings.json lines icon="json" highlight={2,3,4}
{
  "defaultProvider": "vivgrid",
  "defaultModel": "gpt-6-astra",
  "defaultThinkingLevel": "high",
  "theme": "dark",
  "tuiMode": "regular"
}
```

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

## Verify

List everything Pi resolved for the provider:

```bash
pi --list-models vivgrid
```

```
provider  model              context  max-out  thinking  images      
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

```bash
pi
```

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

```bash
pi --provider vivgrid --model gpt-6-astra --thinking high
```

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

```bash
pi -p "explain the auth flow in this repo" --model vivgrid/deepseek-v4-flash
```

## Summary

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