Skip to main content
Use RunInfra models in Pi through the OpenAI-compatible Chat Completions API.

Connect Pi

Use Node 20 or newer, an installed Pi with first-time setup complete, a workspace API key, and available RunInfra credits.
In an interactive terminal, Connect starts login if needed. Review and approve the proposed changes. Connect saves a snapshot, writes the provider settings and model selection, and makes a real Chat Completions request that uses credits. Follow the printed restart hint before using Pi. To choose a model during setup:
See Connect for key placement, status, diagnostics, and restore behavior. Run on again to refresh the saved model list.

Configure manually

Load your workspace API key into RUNINFRA_API_KEY through your secret-management workflow. Keep it in the environment that launches Pi.

Add the provider

Back up ~/.pi/agent/models.json, then merge this providers.runinfra entry into it. Custom provider definitions belong in this user-level file, not a project-level models.json.
openai-completions is Pi’s name for the Chat Completions API, not the legacy /v1/completions endpoint. apiKey uses Pi’s $VARIABLE interpolation, so the key itself stays out of this file.
Keep compat.supportsDeveloperRole set to false. This prevents Pi from sending its default developer role with this configuration.
Use the selected model’s context window and an output budget that fits it. If you add thinking-level controls, configure a per-model thinkingLevelMap matching the model’s supported effort values; effort names are not interchangeable across models.

Select the default model

Back up ~/.pi/agent/settings.json, then merge these settings:
Project settings in .pi/settings.json can override these defaults after you trust the project. If you use an enabledModels filter, include runinfra/* without removing other providers you still use. Start Pi with an explicit selection:
Pi also reloads models.json when you open /model. A credential saved in Pi’s auth.json takes precedence over apiKey in models.json, so check it if Pi uses a different key than you expect.

Verify

Load the same workspace key into RUNINFRA_API_KEY in your terminal. This request uses credits and reads usage.prompt_tokens_details.cached_tokens. The macOS and Linux example uses jq.
A count of 0 is valid; a successful request does not guarantee a cache hit. This tests the API, not whether Pi inherited the key environment. Restart Pi from that environment and select the model with /model.

Revert

If you used Connect:
This restores the snapshot from immediately before the most recent on, which may already contain RunInfra settings. If a managed file changed afterward, Connect refuses to overwrite it. Back up and review those edits before proceeding. For manual setup, restore the previous providers.runinfra entry in models.json, or remove it if you added it for this setup. Restore defaultProvider, defaultModel, and any enabledModels filter you changed in user or project settings. If you saved a RunInfra credential in Pi, use /logout runinfra. Open /model to reload the provider list and select your previous model. Connect’s logout removes only its saved credentials. It does not restore agent settings or revoke the workspace key. Revoke an unwanted key in the dashboard.

Connect

Set up, inspect, and restore your coding agent.

Chat completions

Read the request contract and cache usage fields.

Models

Find model ids and context windows.