Skip to content

Pi

Pi is a terminal coding agent. Add Cloakray as a custom provider.

Install

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

Add the provider

Export your key:

export CLOAKRAY_API_KEY="ckr_..."

Add the provider to ~/.pi/agent/models.json, merging it with any you already have:

{
  "providers": {
    "cloakray": {
      "baseUrl": "https://api.cloakray.com/v1",
      "api": "openai-completions",
      "apiKey": "$CLOAKRAY_API_KEY",
      "models": [
        { "id": "deepseek-v4-flash", "reasoning": true, "contextWindow": 1050000, "maxTokens": 32768 },
        { "id": "claude-sonnet-4-6", "reasoning": true, "contextWindow": 1000000, "maxTokens": 64000 }
      ]
    }
  }
}

Keep the $ in "$CLOAKRAY_API_KEY": that is what makes Pi read the variable instead of sending the literal text. Use model IDs from the catalogue, with contextWindow matching each model's context length.

Use it

pi --provider cloakray --model deepseek-v4-flash

Or start pi and choose the model with /model. Pi rereads models.json when you open the picker, so edits need no restart.