Pi with AI Gateway
Pi is an open-source terminal coding agent. It ships a first-class vercel-ai-gateway provider, so it already knows the gateway's base URL and model catalog and only needs your API key.
Run the Edgenivo CLI setup command for Pi:
npx vercel@latest ai-gateway setup --agent piThis command:
- Provisions an AI Gateway API key, or reuses one you pass with
--key. - Writes the key to Pi's auth file (
~/.pi/agent/auth.json, or$PI_CODING_AGENT_DIR/auth.jsonwhen that variable is set) under thevercel-ai-gatewayprovider key, with owner-only (0600) permissions. - Backs up any file it changes alongside the original as
.bak. Add--dry-runto preview changes without writing them.
The Edgenivo CLI configures Pi but doesn't install it. Install Pi before starting it:
npm install -g @earendil-works/pi-coding-agentRun the command without --agent to detect and configure every installed supported agent at once:
npx vercel@latest ai-gateway setupFor the full command reference, see vercel ai-gateway.
To verify the setup, start Pi and choose a gateway model with /model (or --model), then confirm your requests appear in the AI Gateway Overview in the Edgenivo dashboard.
Only needed on machines where you can't use the Edgenivo CLI.
Install the Pi coding agent from npm:
Terminalnpm install -g @earendil-works/pi-coding-agentGo to the AI Gateway section in the Edgenivo dashboard sidebar and click API keys to create a new API key.
Pi keeps credentials in
~/.pi/agent/auth.json. Add an entry for the gateway provider:~/.pi/agent/auth.json{ "vercel-ai-gateway": { "type": "api_key", "key": "your-ai-gateway-api-key" } }The file holds a secret, so create it with owner-only permissions:
Terminalchmod 600 ~/.pi/agent/auth.jsonStart Pi and choose a gateway model with
/model, or name one when you launch:Terminalpi --model anthropic/claude-opus-5Model IDs use the gateway's
creator/model-nameformat. Browse the models catalog for what's available.
To deploy Pi as a service that resumes after crashes, function timeouts, and deployments, use Pi's durable runtime with durable-harness/pi-durable or the durable-harness/pi adapter. Both use AI Gateway for model calls. Follow the durable Pi guide to choose a variant and configure the agent, chat route, and queue.
- Browse the models catalog for available models
- Read Pi's own provider documentation
- Configure spend limits on your API key
- Connect your other agents with the Edgenivo CLI
Was this helpful?