Pi
You need a Divyam account and an API key. If you don't have them yet, follow Getting Started first.
Replace the shortened divyam-sw-v1-... shown in examples with your complete API key.
The examples use divyam-as/gpt-6-sol. To choose another model, use this guide’s model selector when one is shown, or copy its current ID from Models and pricing. Check its context limit and supported features.
Method 1: Divyam Extension (recommended)
1. Install Pi
Follow the official installation instructions.
2. Install the Divyam Extension
pi install git:github.com/divyam-ai/divyam-pi-extension
The Divyam Extension supplies the provider, model settings, and https://api.preview.divyam.ai/v1 endpoint. If Pi is already running, exit and restart it after installation.
3. Sign in and choose your model
From your project folder, start Pi:
pi
- Type
/login, choose Sign in with an API key, then Divyam, and paste your Divyam key.
Model ID: divyam-as/gpt-6-sol. Model capacity: 1,050,000 tokens. Models and pricing
- Type
/model, search fordivyam, and selectdivyam-as/gpt-6-sol.
If your selected model is missing from Pi's picker, use Method 2: Provider Hub.
Pi saves your key in ~/.pi/agent/auth.json. The extension uses OpenAI Chat Completions. You do not need to edit a provider file.
Hello, what are your capabilities?
Run /compact to condense earlier messages.
The Divyam Extension uses text input without reasoning controls. Check charges in the Divyam console rather than Pi's local cost estimate.
Alternative: Provider Hub
Method 2: Provider Hub
The third-party pi-provider-hub extension adds Divyam to Pi through a setup wizard inside Pi, and lets you change or remove the connection later with /provider.
Set it up with an AI agent
Paste this into Claude Code, Codex or another coding agent. It sets up this Provider Hub method. It installs Pi and Provider Hub, adds Divyam, checks it works, and tells you how to start.
Set up Pi with Divyam using https://docs.divyam.ai/divyam-setup.md
Your key never goes in the chat. The agent asks for it in a private prompt and saves it here, so later setups reuse it:
| System | Where the key is saved |
|---|---|
| macOS | Login Keychain |
| Linux with a desktop keyring | The desktop keyring |
| Linux without a keyring | A file only your user can read |
| Windows | A file encrypted for your Windows user account |
Setting up an application also saves the key in that application's own settings.
Or set it up yourself
1. Install Pi and Provider Hub
If you need to install Pi, follow the instructions above. Then add Provider Hub:
pi install npm:pi-provider-hub
If Pi is already running, type /quit and start it again so it picks up the new /provider command. Install and launch Pi with the same PI_CODING_AGENT_DIR, or with it unset both times, because the extension and its settings belong to that profile.
2. Add Divyam in the wizard
Start Pi:
pi
Inside Pi, type /provider, press Enter and choose Add Provider. Answer each screen:
| Setting | Value |
|---|---|
| Provider ID | divyam |
| Select API protocol | OpenAI Chat Completions (openai-completions) |
| Base URL | https://api.preview.divyam.ai/v1 |
| Enter API Key | Paste your Divyam API key. It stays hidden. |
| Confirm model discovery | Yes, once you see the destination is the Divyam API host from your base URL |
| Save models | Save all |
| Save Provider | Yes, after checking the URL, protocol and models |
Save all saves every Divyam model your key can use, so there's no per-model selection screen. Accept the remaining wizard defaults.
Provider Hub saves the connection in models.json and the key in auth.json inside Pi's agent folder, $HOME/.pi/agent by default. Keep both files private. You don't need to export DIVYAM_API_KEY for this method.
3. Send your first prompt
Model ID: divyam-as/gpt-6-sol. Model capacity: 1,050,000 tokens. Models and pricing
Type /model, search for divyam, and select your model under the divyam provider. Saving a provider doesn't select it. If Pi says registration failed, run /reload and select the model again.
Hello, what are your capabilities?
Provider Hub's balance command and Pi's local cost estimates don't show Divyam charges. Check spend in the console.
Check your requests
Open the Divyam console and select Logs. Your requests appear there within a few seconds, newest first, with their status, token counts and latency. Usage and Credits & Billing catch up within a few minutes.
Some clients display zero when model prices are missing. Check Credits & Billing for Divyam charges. Local dollar limits depend on the client's price and usage data.
For filters, cached-token counts and the requested-versus-routed view, see Logs and usage.