Skip to main content

Pi

Before you start

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.

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
  1. Type /login, choose Sign in with an API key, then Divyam, and paste your Divyam key.
divyam-as/

Model ID: divyam-as/gpt-6-sol. Model capacity: 1,050,000 tokens. Models and pricing

  1. Type /model, search for divyam, and select divyam-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.

In Pi's composer
Hello, what are your capabilities?
Paste this message, then send it.

Run /compact to condense earlier messages.

Feature limits

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.

Prompt
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:

SystemWhere the key is saved
macOSLogin Keychain
Linux with a desktop keyringThe desktop keyring
Linux without a keyringA file only your user can read
WindowsA file encrypted for your Windows user account

Setting up an application also saves the key in that application's own settings.

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:

SettingValue
Provider IDdivyam
Select API protocolOpenAI Chat Completions (openai-completions)
Base URLhttps://api.preview.divyam.ai/v1
Enter API KeyPaste your Divyam API key. It stays hidden.
Confirm model discoveryYes, once you see the destination is the Divyam API host from your base URL
Save modelsSave all
Save ProviderYes, 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​

divyam-as/

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.

In Pi's composer
Hello, what are your capabilities?
Paste this message, then send it.
note

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.

Local cost estimates

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.