Skip to content

Pi coding agent one-line setup: Claude + GPT via one API (macOS, Linux, Windows) ​

TL;DR: run curl -fsSL https://sh.flashapi.top/pi.sh | bash (macOS / Linux) or irm https://sh.flashapi.top/pi.ps1 | iex (Windows PowerShell), pick 3, paste your API key. Done.

One command installs Pi and connects it to both Claude and GPT through Flash API. The default model is claude-opus-5-5, with reasoning effort set to medium.

1. Run the setup command ​

bash
curl -fsSL https://sh.flashapi.top/pi.sh | bash
powershell
irm https://sh.flashapi.top/pi.ps1 | iex

The script speaks Chinese (for now)

The script's prompts are currently in Chinese. Pick 3 for a full install, then follow the prompts.

The menu has three options:

  • 1: Install Pi only.
  • 2: Configure Flash API (Claude + GPT) only. Use this if Pi is already installed, or to swap keys later.
  • 3: Install everything. Pick this on your first run.

2. Prerequisite: Node.js 22+ ​

Pi installs via npm (@earendil-works/pi-coding-agent) and needs Node.js 22.19 or later: Install Node.js. If the default npm registry fails, the script automatically falls back to a mirror registry.

About the two keys ​

Claude and GPT live in different pricing groups in the dashboard, so they use separate API keys. The script first asks which model families to configure:

  • 1: Claude + GPT (default, just press Enter)
  • 2: Claude only
  • 3: GPT only

Then it asks for, in order:

  1. Your Claude-group API key
  2. Your GPT-group API key (press Enter to reuse the Claude key)

Each key is checked against /v1/models, and the models available in that group are pulled into the config.

Error: "Requests from the ... framework are not supported"

Your Claude key belongs to a pricing group that only accepts official Claude clients. Create a new key in a group that allows third-party tools at flashapi.top, then rerun the script and pick 2 (configure).

3. Files the script writes ​

Config directory: ~/.pi/agent/ on every OS (%USERPROFILE%\.pi\agent\ on Windows). PI_CODING_AGENT_DIR takes precedence when set.

models.json (providers and models):

json
{
  "providers": {
    "flashapi-claude": {
      "name": "闪电API Claude",
      "baseUrl": "https://ai.flashapi.top",
      "api": "anthropic-messages",
      "apiKey": "sk-YOUR_CLAUDE_KEY",
      "models": [
        { "id": "claude-opus-5-5", "name": "Claude Opus 5.5", "reasoning": true,
          "input": ["text", "image"], "contextWindow": 1000000, "maxTokens": 128000 }
      ]
    },
    "flashapi-gpt": {
      "name": "闪电API GPT",
      "baseUrl": "https://ai.flashapi.top/v1",
      "api": "openai-responses",
      "apiKey": "sk-YOUR_GPT_KEY",
      "models": [
        { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol", "reasoning": true,
          "input": ["text", "image"], "contextWindow": 1050000, "maxTokens": 128000 }
      ]
    }
  }
}

settings.json (defaults):

json
{
  "defaultProvider": "flashapi-claude",
  "defaultModel": "claude-opus-5-5",
  "defaultThinkingLevel": "medium"
}
  • The provider display names are written literally as 闪电API Claude and 闪电API GPT (Flash API Claude / Flash API GPT).
  • Your other settings in both files stay untouched, and each file is backed up as *.bak.<timestamp> first. auth.json (Pi's own login data) is never modified.

4. Verify and use ​

bash
pi -p "Reply with exactly: OK"
pi -p --provider flashapi-gpt --model gpt-6.1-sol "Reply with exactly: OK"
  • Start a session: pi
  • Switch mid-session: type /model to pick one (Ctrl+S makes it the default), /thinking to change reasoning effort

5. Roll back ​

Rename models.json.bak.<timestamp> and settings.json.bak.<timestamp> back to their original names.

One base URL for GPT, Claude and Gemini