Use ApexApi with Pi

Pi is a minimal terminal coding agent that works with any model behind an OpenAI compatible API. One provider block connects it to our catalog.

1. Get your API key

Create a key in your dashboard. It starts with ak-.

2. Add ApexApi to models.json

Edit ~/.pi/agent/models.json:

{
  "providers": {
    "apexapi": {
      "baseUrl": "https://api.apexapi.dev/v1",
      "api": "openai-completions",
      "apiKey": "ak-your-key-here",
      "models": [
        { "id": "anthropic/claude-sonnet-4.6", "name": "Claude Sonnet 4.6" },
        { "id": "openai/gpt-5.6-sol", "name": "GPT 5.6 Sol" },
        { "id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "reasoning": true }
      ]
    }
  }
}

Prefer not to keep the key in a file? Set "apiKey": "APEXAPI_API_KEY" and export that variable in your shell instead.

The ID must match the catalog exactly, in provider/model format. Browse all IDs on the models page.

3. Pick a model and run

Start pi and select one of the ApexApi models from its model list.

Troubleshooting

  • 401 Unauthorized: the key wasn't pasted correctly or has been revoked.
  • Model not found: the model ID doesn't match a catalog ID. Copy it verbatim from the models page.
  • Connection fails: make sure the base URL is exactly https://api.apexapi.dev/v1 (no trailing slash after v1) and your balance is positive.
  • Anything else: check the error codes reference; streaming and tool calling are fully supported on /v1/chat/completions.