Setup guide

Use aipilot in your coding tools

One command sets everything up. Or follow the steps for your tool below.

aipilot works in Claude Code, Claude Desktop, OpenCode, Codex and VS Code extensions (Cline, Roo Code, Continue, Kilo Code). Use the one-command installer, or follow the manual steps below. Everything is filled in for you once you have an API key.

One license works in every tool

Your license comes with its own set of aipilot models. Whichever set you have, you can use those same models in all of the tools below. You only ever see your own license's models — switching tools doesn't change them.

Claude CodeCodexOpenCodeClaude DesktopVS Code extensions

One-command install (recommended)

Open a terminal, paste the command for your system, and enter your license key when asked. It activates this computer and configures every supported app it finds. No admin rights needed, and aipilot uninstall undoes everything.

PowerShell
irm https://aipilot-api.ouedernidev.workers.dev/install.ps1 | iex

Want to read the script first? Open install.ps1 or install.sh. After installing: aipilot status, aipilot setup (re-detect apps), aipilot logout, aipilot uninstall.

Get your API key (manual setup)

Your license key (AIP-XXXX-XXXX-XXXX-XXXX) activates a computer and gives it its own API key (ap_live_...), which the apps use. Each activation takes one seat on your license. No license yet? Request access.

Your key stays in this browser tab. Nothing on this page stores it.

Base URL
https://aipilot-api.ouedernidev.workers.dev
aipilot Max
aipilot-max
aipilot Pro
aipilot-pro
aipilot Fast
aipilot-fast
API key
not set

Claude Code

Add this to your user settings file. Create it if it doesn't exist; if it does, merge the env keys into what's there.

  • Windows: %USERPROFILE%\.claude\settings.json
  • macOS / Linux: ~/.claude/settings.json
settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aipilot-api.ouedernidev.workers.dev",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_MODEL": "aipilot-max[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "aipilot-max[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "aipilot Max",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION": "Most capable, for complex coding",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "aipilot-pro[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "aipilot Pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION": "Everyday coding",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "aipilot-fast",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "aipilot Fast",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION": "Fastest, for quick tasks",
    "CLAUDE_CODE_SUBAGENT_MODEL": "aipilot-max[1m]"
  },
  "model": "aipilot-max[1m]",
  "autoCompactWindow": 500000
}

Then start Claude Code. If you were signed in to a Claude account before, run this once inside Claude Code:

Claude Code
/logout

Run /status to check that the base URL shows https://aipilot-api.ouedernidev.workers.dev.

Or just for one terminal session

PowerShell
$env:ANTHROPIC_BASE_URL = "https://aipilot-api.ouedernidev.workers.dev"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY"
$env:ANTHROPIC_API_KEY = ""
$env:ANTHROPIC_MODEL = "aipilot-max[1m]"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "aipilot-fast"
claude

In Claude Code, /model lists aipilot Max, aipilot Pro and aipilot Fast. The [1m] suffix tells Claude Code the model has a 1M-token context window. A warning that the model "isn't recognized" is expected and harmless.

Claude Desktop

This switches Claude Desktop into third-party mode, where it uses aipilot instead of a Claude account. You can switch back at any time (see Remove).

Option A: registry file. Download it, double-click it and confirm. It only writes to your own user profile.

Set your API key above first.
Contents
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Policies\Claude]
"inferenceProvider"="gateway"
"inferenceGatewayBaseUrl"="https://aipilot-api.ouedernidev.workers.dev"
"inferenceGatewayApiKey"="YOUR_API_KEY"
"inferenceGatewayAuthScheme"="bearer"
"inferenceModels"="[{\"name\":\"aipilot-max\",\"supports1m\":true,\"prefer1m\":true},{\"name\":\"aipilot-pro\",\"supports1m\":true,\"prefer1m\":true},{\"name\":\"aipilot-fast\",\"supports1m\":true,\"prefer1m\":true}]"

Option B: in the app. Follow the steps in the next tab (they're the same on Windows).

Then fully quit Claude Desktop (right-click the tray icon, then Quit) and open it again.

OpenCode

Add the provider to your OpenCode config (~/.config/opencode/opencode.json; on Windows %USERPROFILE%\.config\opencode\opencode.json). Merge it if the file already exists.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "aipilot": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "aipilot",
      "options": {
        "baseURL": "https://aipilot-api.ouedernidev.workers.dev/v1"
      },
      "models": {
        "aipilot-max": {
          "name": "aipilot Max",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "limit": {
            "context": 500000,
            "output": 65536
          }
        },
        "aipilot-pro": {
          "name": "aipilot Pro",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "limit": {
            "context": 500000,
            "output": 65536
          }
        },
        "aipilot-fast": {
          "name": "aipilot Fast",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "limit": {
            "context": 500000,
            "output": 65536
          }
        }
      }
    }
  },
  "model": "aipilot/aipilot-max"
}

Then add your key: run opencode, type /connect, pick aipilot and paste your API key. Or put it in ~/.local/share/opencode/auth.json yourself:

auth.json
{
  "aipilot": {
    "type": "api",
    "key": "YOUR_API_KEY"
  }
}

Choose the model with /models if it isn't selected already.

Codex

Add this to the top of ~/.codex/config.toml (on Windows %USERPROFILE%\.codex\config.toml). If the file already has model or model_provider lines, replace them.

config.toml
model = "aipilot-max"
model_provider = "aipilot"
model_context_window = 400000
model_auto_compact_token_limit = 300000

[model_providers.aipilot]
name = "aipilot"
base_url = "https://aipilot-api.ouedernidev.workers.dev/v1"
wire_api = "responses"
env_key = "AIPILOT_API_KEY"

Then save your key where Codex can read it, and open a new terminal:

PowerShell
[Environment]::SetEnvironmentVariable("AIPILOT_API_KEY", "YOUR_API_KEY", "User")

Start codex. It uses aipilot Max; for the others run codex -m aipilot-pro or codex -m aipilot-fast. A note that model metadata wasn't found is expected.

Codex not working? Let an AI agent fix it. This works the same for the codex CLI, the Codex VS Code / Cursor extension, and the Codex in the ChatGPT desktop app — they all share ~/.codex/config.toml. Copy the prompt below and paste it into any AI coding agent (Claude Code, Cursor, or Codex on a machine that still works). It diagnoses the config, your key and your environment, and fixes them step by step.

Give this to your AI agent
You are helping me get aipilot working in Codex. Something is wrong — it may show "Missing environment variable", a 401, empty replies, or it ignores my model. Diagnose and fix EVERYTHING below. Never print my API key in your replies.

MY DETAILS
- API base URL: https://aipilot-api.ouedernidev.workers.dev/v1
- Provider id: aipilot
- Default model: aipilot-max
- My API key: YOUR_API_KEY

STEP 1 — Find the config file. The Codex CLI, the Codex VS Code / Cursor extension, and the ChatGPT desktop app's Codex ALL read the same file:
- Windows: %USERPROFILE%\.codex\config.toml
- macOS / Linux: ~/.codex/config.toml
If it does not exist, create it. Show me its current contents first.

STEP 2 — At the very TOP of the file, make sure these two lines exist (add or correct them):
model = "aipilot-max"
model_provider = "aipilot"
There must be only one of each. If another model_provider line points somewhere else, remove it.

STEP 3 — There must be EXACTLY ONE [model_providers.aipilot] section. Delete every duplicate, then make it read exactly:
[model_providers.aipilot]
name = "aipilot"
base_url = "https://aipilot-api.ouedernidev.workers.dev/v1"
wire_api = "responses"
env_key = "AIPILOT_API_KEY"
Fix these common mistakes while you are here:
- base_url MUST end in /v1 (not just the domain).
- wire_api MUST be "responses" (not "chat").
- env_key MUST be the literal text AIPILOT_API_KEY. It is the NAME of an environment variable, NOT my key. If my key (it starts with ap_) was pasted into env_key, that is the bug — put the literal AIPILOT_API_KEY here and move the key to STEP 4.

STEP 4 — Save my key into that environment variable, permanently:
- Windows (PowerShell): [Environment]::SetEnvironmentVariable("AIPILOT_API_KEY", "YOUR_API_KEY", "User")
- macOS / Linux: append this line to ~/.zshrc (or ~/.bashrc):  export AIPILOT_API_KEY="YOUR_API_KEY"
Then confirm the variable is set in a NEW shell (echo $env:AIPILOT_API_KEY on Windows, echo $AIPILOT_API_KEY on mac/Linux) — but do not show me the value.

STEP 5 — If Codex still calls OpenAI instead of aipilot, it is reading a different provider. Check for OPENAI_BASE_URL / OPENAI_API_KEY environment variables or another [model_providers.*] set as model_provider, and make sure model_provider = "aipilot" wins.

STEP 6 — Verify. Tell me to fully QUIT every terminal and the Codex / ChatGPT app, open a brand-new terminal, run  codex  and send "hi".
- A note that "model metadata wasn't found" is normal — ignore it.
- Still 401 → my key is wrong or expired; tell me to get a fresh one from my aipilot setup page.
- Empty reply or a different error → tell me the exact message so I can report it.

It covers the usual culprits: the key pasted into env_key instead of a variable name, base_url missing /v1, wire_api not set to responses, duplicate provider blocks, a stale terminal that hasn't picked up the key, or another provider winning.

VS Code extensions

aipilot works in VS Code AI coding extensions — any that let you set a custom base URL and API key. Point one at your aipilot address and you get your aipilot models right in the editor.

Claude Code extension

The extension shares its config with the Claude Code CLI, so if you set up Claude Code above it already works. Otherwise put this in ~/.claude/settings.json and reload VS Code:

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aipilot-api.ouedernidev.workers.dev",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_MODEL": "aipilot-max[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "aipilot-max[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "aipilot Max",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION": "Most capable, for complex coding",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "aipilot-pro[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "aipilot Pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION": "Everyday coding",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "aipilot-fast",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "aipilot Fast",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION": "Fastest, for quick tasks",
    "CLAUDE_CODE_SUBAGENT_MODEL": "aipilot-max[1m]"
  },
  "model": "aipilot-max[1m]",
  "autoCompactWindow": 500000
}
Signing in with a Claude account instead of your key? Run /logout in the Claude Code panel, or turn on Disable Login Prompt in the extension settings, and make sure ANTHROPIC_API_KEY isn't set anywhere else in your environment.

Codex extension

The Codex VS Code / Cursor extension reads the same ~/.codex/config.toml as the CLI — follow the Codex steps above. One catch: set your key as a system environment variable (a VS Code opened from the dock/Start menu doesn't inherit your shell's exports), then fully restart VS Code.

Cline, Roo Code, Kilo Code

In the extension's provider settings, add a provider with:

API Provider
OpenAI Compatible
Base URL
https://aipilot-api.ouedernidev.workers.dev/v1
API Key
YOUR_API_KEY
Model
aipilot-max, aipilot-pro, aipilot-fast

Set the model's Context Window to 1,000,000 and turn on image support for aipilot-max. Kilo Code can also pick Anthropic Messages or OpenAI Responses as the provider API if you prefer.

Continue

Add your models to ~/.continue/config.yaml (merge it in if the file already exists):

~/.continue/config.yaml
models:
  - name: aipilot Max
    provider: openai
    model: aipilot-max
    apiBase: https://aipilot-api.ouedernidev.workers.dev/v1
    apiKey: YOUR_API_KEY
    roles: [chat, edit, apply]
  - name: aipilot Pro
    provider: openai
    model: aipilot-pro
    apiBase: https://aipilot-api.ouedernidev.workers.dev/v1
    apiKey: YOUR_API_KEY
    roles: [chat, edit, apply]
  - name: aipilot Fast
    provider: openai
    model: aipilot-fast
    apiBase: https://aipilot-api.ouedernidev.workers.dev/v1
    apiKey: YOUR_API_KEY
    roles: [chat, edit, apply]

GitHub Copilot uses GitHub's own models and generally can't be pointed at a custom address, so it won't work with aipilot. Any extension with a custom base URL option will — base URL https://aipilot-api.ouedernidev.workers.dev/v1 (or https://aipilot-api.ouedernidev.workers.dev if the app adds /v1 itself), and your API key.

Troubleshooting

401 Invalid API key
The key was mistyped, revoked, or replaced by a newer activation of the same computer. Get a new one above, or run aipilot activate.
Codex: "Missing environment variable"
env_key is the name of an environment variable, not the key itself. Keep env_key = "AIPILOT_API_KEY" exactly as written, put your key in that variable (the command above), and make sure base_url ends in /v1. Or just re-run the installer, which configures Codex for you.
402 Your free trial has ended / token allowance is used up
The trial lasts a fixed time from your first request and includes a token allowance. Upgrade your plan to continue.
409 All seats are in use
Each computer takes one seat. Run aipilot logout on a computer you no longer use, or ask us to free a seat.
413 Payload Too Large (FUNCTION_PAYLOAD_TOO_LARGE) / keeps reconnecting
The conversation grew too big to send in one request (4.5 MB). Start a new conversation (/new in Codex, /clear in Claude Code) — retrying or compacting the old one sends the same oversized request. Then run aipilot update once so your apps compact long conversations earlier and it doesn't come back.
Claude Code still uses my Claude account
Run /logout once in Claude Code, and make sure ANTHROPIC_API_KEY isn't set in your shell or system environment.
Claude Desktop doesn't change
Quit it completely (tray icon, then Quit) and reopen it. If your company manages Claude Desktop, its policy takes precedence and can't be changed per user.
"Model isn't recognized" warning in Claude Code
Expected with custom model names, and harmless. Keep the [1m] suffix so Claude Code uses the full context window.
VS Code extension can't connect (404 / wrong URL)
Check the base URL: the Claude Code extension uses the host with NO /v1; Cline, Roo Code, Continue and Kilo Code use the host WITH /v1 on the end. Pick the matching provider type and the key goes in as a Bearer token or x-api-key automatically.
Codex VS Code extension ignores the config
It reads ~/.codex/config.toml, but it needs the API key in a SYSTEM environment variable — a VS Code launched from the dock/Start menu doesn't inherit your shell's exports. Set it system-wide (or open VS Code from a terminal) and fully restart VS Code.
Cline / Roo Code shows a tiny context or hides image upload
They default to generic limits. In the provider's advanced settings set Context Window to 500,000 (higher risks 413 errors on long tasks) and turn on Image Support.

Remove

If you used the installer, aipilot uninstall frees your seat and undoes every change. For a manual setup:

  • Claude Code: remove the ANTHROPIC_* entries and model from ~/.claude/settings.json.
  • Claude Desktop (Windows): , run it, and restart Claude Desktop. On macOS, switch the provider back in Developer → Configure Third-Party Inference.
  • OpenCode: remove provider.aipilot from opencode.json and the aipilot entry from auth.json.
  • Codex: remove the model, model_provider and [model_providers.aipilot] lines from config.toml, and the AIPILOT_API_KEY variable.