DivyamSetup guides Open console

Set up Pi with Divyam using Provider Hub

Use Pi for coding while sending model requests through the hosted Divyam demo. The third-party pi-provider-hub extension adds the connection through menus inside Pi.

Choose this method if you prefer a setup wizard. The manual Pi setup guide configures the same API without an extension. You only need one method.

1 Sign up or sign in and create a Divyam key

  1. Open the Divyam demo console.
  2. Choose Sign up for a new account, or Sign in for an existing account.
  3. Enter your email and complete verification using the code sent to your inbox.
  4. Open Credits & Billing and check your available credit.
  5. Open API Keys, create a key such as pi-hub-demo, and copy the complete key.
  6. Store it privately. It is shown once.
  7. Copy the API base URL from Getting Started and an available model ID from Models & Pricing.
Setting Value used in this guide
API base URL https://api.demo.divyam.ai/v1
Example model ID divyam-as/gpt-5.6-sol
API key Your complete Divyam key, beginning with divyam-sw-v1-

Use your console’s values if they differ. Keep the full /v1 path and model prefix. If account access is restricted, contact the demo administrator with your email address.

2 Install Pi and Provider Hub

Pi and Provider Hub require Node.js 22.19 or newer and npm. Check Node.js before installation:

node --version

Install the latest stable Pi, then the extension:

npm install --global --ignore-scripts @earendil-works/pi-coding-agent
pi --version
pi install npm:pi-provider-hub

Pi normally downloads missing fd and ripgrep search utilities automatically. They help Pi find files and search their contents.

If Pi is already running, type /quit and press Enter, then start it again after installation. The extension adds /provider. Install and launch Pi with the same configuration directory. An exported PI_CODING_AGENT_DIR changes which profile receives the extension and its provider settings.

3 Add Divyam through the wizard

Start in a disposable workspace for the first check:

mkdir -p "$HOME/w/divyam-switch-pi-hub-demo"
cd "$HOME/w/divyam-switch-pi-hub-demo"
printf '%s\n' 'switch-pi-hub-check-4827' > acceptance.txt
pi

Inside Pi, type /provider and press Enter. Choose Add Provider.

Screen Answer
Provider ID divyam
Select API protocol OpenAI Chat Completions (openai-completions)
Base URL https://api.demo.divyam.ai/v1
Enter API Key Paste your Divyam key; input is hidden
Confirm model discovery Yes, after checking the destination is https://api.demo.divyam.ai
Save models Select models
Select models to save Mark your chosen available Divyam models as Save
Confirm model selection Yes, after checking the selected model count
Configure reasoning support, if shown No selected models support reasoning
Save Provider Yes, after checking the URL, protocol, and selected models

For example, select divyam-as/gpt-5.6-sol and divyam-as/gpt-6-sol if both appear in your catalog. Use the arrow keys and Enter or Space to change a model between Skip and Save. Press Esc when finished. In this selection screen, Esc opens the confirmation instead of cancelling your selections.

The reasoning choice prevents Pi from requesting reasoning controls through this unverified route. It does not establish whether the backing model performs internal reasoning. The wizard can skip this screen when it inherits capabilities from matching models already known to Pi. Check inherited settings before enabling reasoning or image input.

Discovery lists models and probes the protocol endpoint. It does not establish that a real inference request will succeed. Model access and credit are checked when you send a task.

Provider Hub stores configuration in models.json and the key in auth.json inside Pi’s active agent directory. The default directory is $HOME/.pi/agent. Keep these files private. This method uses the saved key; it does not require exporting DIVYAM_API_KEY.

4 Select the model and verify a tool exchange

Type /model, search for divyam, and select your exact Divyam model under provider divyam. Saving a provider does not change the current model automatically. If Pi reports that registration failed after saving, run /reload, then select the model again.

Send this prompt:

Read acceptance.txt using the read tool. Return only its exact content. Do not modify files.

The answer should be switch-pi-hub-check-4827, matching the file created above. Check Pi’s tool activity as well as the answer. Record the test time and selected model.

Then verify the exchange in Divyam:

  1. Return to the Divyam demo console. Sign in again if needed.
  2. Open Logs in the left navigation.
  3. Set Model to the ID selected in Pi.
  4. Set Period to include your test time. Leave Status at All statuses.
  5. Find requests near that time. Timestamps are UTC, and the newest requests appear first.
  6. Check status 200, token counts, and latency.
  7. Open View request on a later continuation request.
  8. Find the assistant’s tool_calls entry for reading acceptance.txt.
  9. Find its matching role: tool message. Its tool_call_id must match the assistant tool call.
  10. Confirm that the result contains your marker. Compare it with Pi’s terminal answer.

Pi streams responses. The console may show Streamed; not stored instead of View response. Use the continuation request to inspect both the tool call and its submitted result. Match the tool-call ID because Pi can make additional requests.

If content is unavailable, metadata alone cannot verify tool execution. Check Pi’s tool events or ask the demo administrator to inspect the exchange. If logs are missing, check the account and filters, then refresh after ingestion.

5 Test a coding workflow

Stay in the disposable workspace for the first editing test. Ask Pi to create a small file, edit one line, then read the file back. Inspect the actual file after each task and check the corresponding requests in Divyam Logs.

Use /quit to exit. From the same workspace, resume with:

pi --continue --provider divyam --model divyam-as/gpt-5.6-sol --thinking off

Substitute the model you configured if it differs. Keep using the same Pi profile. Local sessions and credentials belong to that profile.

Open Usage and Credits & Billing in Divyam to review request totals, settled charges, and remaining credit. Provider Hub’s balance command is not verified for Divyam; use the console for billing. Pi’s local cost estimates do not establish Divyam charges.

Troubleshooting and cleanup

Symptom Action
/provider is missing Restart Pi. Check installation succeeded in the profile you are using.
Provider ID already exists Use /provider edit divyam for an existing managed connection, or choose another unused ID.
Discovery fails Check the complete /v1 URL, key, and Chat Completions protocol.
Model is missing from /model Confirm it was saved. Run /reload if registration failed.
HTTP 401 Check the full key and whether it is still active.
HTTP 402 Resolve credit or billing restrictions in Divyam Credits & Billing before retrying.
HTTP 403 Check account access and whether its plan permits the model.
HTTP 429 Reduce request volume and retry after the reported delay.
HTTP 502 or 503 Retry later. Report the time, Pi version, model ID, and redacted error.
No matching log entry Check the signed-in Divyam account, model filter, period, and selected Pi provider.

To rotate the key, use /provider edit divyam, choose API Key, and enter the replacement. Verify a request before revoking the old key in Divyam.

To remove the provider, first select a model from another provider using /model. Then run /provider remove divyam and confirm removal. The extension refuses to remove the currently selected provider. If no other provider is configured, revoke the dedicated key in Divyam and remove the configuration later. Removing local configuration does not revoke a Divyam key.

Further reading