OffRail
Guides

Pi Integration

Use any model with Pi coding agent through OffRail — GPT-5.5, Gemini, Claude, DeepSeek, and 200+ others in your terminal.

Pi is a minimal terminal-based coding agent that gives an AI full access to read, write, edit, and run shell commands in your project. By pointing Pi at OffRail, you can use any of our 200+ models — GPT-5.5, Gemini 3.1 Pro, Claude Opus 4.7, DeepSeek V4, and more — with full cost tracking and caching.

Prerequisites

  • An OffRail account with an API key
  • Pi installed (curl -fsSL https://pi.dev/install.sh | bash)
  • Basic terminal familiarity

Setup

Pi uses a models.json configuration file to define providers and models. We'll add OffRail as a custom provider.

Get Your API Key

  1. Log in to your OffRail dashboard
  2. Navigate to API Keys section
  3. Create a new API key and copy the key

Configure Pi

Open (or create) the Pi models configuration file at ~/.pi/agent/models.json and add OffRail as a provider:

{
	"providers": {
		"offrail": {
			"baseUrl": "https://api.offrail.ai/v1",
			"api": "openai-completions",
			"apiKey": "orl_your_api_key_here",
			"models": [
				{ "id": "gpt-5.5", "name": "GPT-5.5" },
				{ "id": "claude-opus-4-7", "name": "Claude Opus 4.7" },
				{ "id": "gemini-3.1-pro", "name": "Gemini 3.1 Pro" },
				{ "id": "deepseek-v4", "name": "DeepSeek V4", "reasoning": true }
			]
		}
	}
}

Replace orl_your_api_key_here with your actual API key from Step 1.

Pi models.json Configuration

Pi reloads models.json when you open the /model menu — no restart needed after editing.

Select Your Model

  1. Run pi in any project directory
  2. Type /model to open the model selector
  3. Select your OffRail model from the list

All requests now route through OffRail with full cost tracking.

Test the Integration

Ask Pi to do something in your project to verify everything works:

> hello

Pi Test with OffRail

You should see the response streaming from your chosen model. Check your OffRail dashboard to confirm the request appears in your usage logs.

Adding More Models

You can add any model from the OffRail models page to your models.json. Just add entries to the models array:

{
	"providers": {
		"offrail": {
			"baseUrl": "https://api.offrail.ai/v1",
			"api": "openai-completions",
			"apiKey": "orl_your_api_key_here",
			"models": [
				{ "id": "gpt-5.5", "name": "GPT-5.5" },
				{ "id": "gpt-5.5-mini", "name": "GPT-5.5 Mini" },
				{ "id": "claude-opus-4-7", "name": "Claude Opus 4.7" },
				{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" },
				{ "id": "gemini-3.1-pro", "name": "Gemini 3.1 Pro" },
				{ "id": "gemini-3.1-flash", "name": "Gemini 3.1 Flash" },
				{ "id": "deepseek-v4", "name": "DeepSeek V4", "reasoning": true },
				{
					"id": "deepseek-v4-mini",
					"name": "DeepSeek V4 Mini",
					"reasoning": true
				}
			]
		}
	}
}

Using Environment Variables for the API Key

Instead of hardcoding your key, you can reference an environment variable:

{
	"providers": {
		"offrail": {
			"baseUrl": "https://api.offrail.ai/v1",
			"api": "openai-completions",
			"apiKey": "OFFRAIL_API_KEY",
			"models": [{ "id": "gpt-5.5", "name": "GPT-5.5" }]
		}
	}
}

Then set the variable in your shell profile:

export OFFRAIL_API_KEY=orl_your_api_key_here

Troubleshooting

Authentication Errors

  • Verify your API key is correct in ~/.pi/agent/models.json
  • Check that the base URL is set to https://api.offrail.ai/v1
  • Ensure your OffRail account has sufficient credits

Model Not Found

  • Verify the model ID exists on the models page
  • Model IDs are case-sensitive — copy them exactly as shown

Connection Issues

  • Check your internet connection
  • Ensure api is set to "openai-completions" (not "openai-responses")
  • Monitor your usage in the OffRail dashboard

Need help? Join our Discord community for support and troubleshooting assistance.

Benefits of Using OffRail with Pi

  • Any Model: Use GPT-5.5, Claude Opus 4.7, Gemini 3.1 Pro, DeepSeek V4, or 200+ others
  • Cost Tracking: Every Pi request appears in your dashboard with token counts and costs
  • Caching: Repeated requests hit cache automatically, saving money
  • One Key: Manage all providers through a single API key
  • No Vendor Lock-in: Switch models by changing one line in your config

How is this guide?

On this page

Ready for production?

Ship to production with SSO, audit logs, spend controls, and guardrails your security team will approve.

Explore Enterprise