API Connection & Integration Guide
SubPool fully supports the most popular communication standards available today — including OpenAI Chat Completions, Anthropic Messages, and OpenAI Responses. This allows you to easily connect and use powerful AI models directly in Cursor, Claude Code, Codex, Cline, Continue, and many other development environments.
Quickstart in 3 simple steps
2. Select Base URL
Configure official Base URL: https://subpool.net/v1 (or root URL).
3. Paste into Tool
Open the Tools & Integrations page, choose your tool and operating system, copy the configuration snippet, and you're ready to go!
1. Request Authentication Headers
SubPool accepts 2 flexible authentication header formats. Simply choose the format compatible with your tool or library:
OpenAI Standard (Authorization)
Authorization: Bearer sk-xxxxxxxxxxxxxxxx
Anthropic Standard (x-api-key)
x-api-key: sk-xxxxxxxxxxxxxxxx
2. Detailed Tool-by-Tool Integration Guides
For detailed per-tool setup instructions, configuration files, and launch commands, open the Tools & Integrations page:
Detailed setup guides for every tool:
Visit Tools & Integrations for installation steps, configuration files, and launch commands for all AI CLI and IDE tools.
Step 1: Choose Tool / IDE · Step 2: Choose Operating System
Terminal coding agent, Anthropic standard
~/.claude/settings.json
OpenAI coding agent, Responses API standard
~/.codex/auth.json
~/.codex/config.toml
VS Code extension coding agent
~/.cline/data/globalState.json
~/.cline/data/secrets.json
Continue Extension Integration
Autocomplete & chat extension for VS Code / JetBrains
~/.continue/config.json
Open-source multi-provider terminal coding agent
~/.config/opencode/opencode.json
YAML + .env configured coding agent
~/.hermes/config.yaml
~/.hermes/.env
Multi-agent framework configured via JSON
~/.openclaw/openclaw.json
Alibaba terminal coding agent, OpenAI standard
~/.qwen/settings.json
TOML configured CLI, OpenAI standard
~/.deepseek/config.toml
Claude desktop app, configured via inference gateway
~/Library/Application Support/Claude-3p/
AI-native IDE based on VS Code
- Open Cursor → select Cursor Settings (or press Cmd+, / Ctrl+,).
- Go to section Models → under OpenAI API Key, paste your key.
- Enable switch Override OpenAI Base URL and enter:
3. OpenAI Chat Completions
Fully compatible with the OpenAI v1 chat completions standard.
curl https://subpool.net/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_API_KEY" \
-d '{
"model": "switch-default",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"stream": false
}'
4. Anthropic Messages
Fully compatible with the Anthropic Messages API standard.
For Claude Code and Anthropic native tools.
curl https://subpool.net/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "switch-default",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
5. OpenAI Responses
Support for the new OpenAI Responses API standard.
For Codex CLI.
curl https://subpool.net/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_API_KEY" \
-d '{
"model": "switch-default",
"input": "Hello!"
}'
OpenAI Image Generation Protocol
OpenAI-compatible image generation API for models such as cx/gpt-5.5-image and ag/gemini-3.1-flash-image.
curl https://subpool.net/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_API_KEY" \
-d '{
"model": "cx/gpt-5.5-image",
"prompt": "A calm lake at sunrise"
}'
6. Active Models Library
All AI models ready to serve — compatible with OpenAI & Anthropic API standards.
List of all active models and their token pricing.
Error Handling & Status Codes
| Status | Description |
|---|---|
| 401 Unauthorized | Invalid, missing, or revoked API key. Check Authorization header. |
| 402 Payment Required | Insufficient balance to process this request. Please top up. |
| 404 Not Found | Requested model not found or inactive. Verify model name. |
| 429 Too Many Requests | Rate limit or concurrency limit exceeded. Reduce request frequency. |
| 500 / 502 / 503 Upstream Error | Upstream provider error. Automatic failover will be attempted. |
Pricing & AI Models
Transparent pay-as-you-go pricing — 100% compatible with the OpenAI & Anthropic API standards.
| Model ID / Display name | Provider | Price / 1M tokens | Actions |
|---|
Tool Connection Guides — Detailed Step-by-Step
Detailed guides to help you connect and use AI tools (Claude Code, Cursor, Codex CLI, OpenCode...) without requiring paid subscriptions from official providers, by directing the API endpoint directly to our platform at undefined.
Before you start — 3 things you need ready
1. API Key
Create at Manage API Keys, format sk-xxxxxxxx. Shows only once — save immediately.
2. Base URL
Use exact /v1. Use the URL shown in each tool's example. SubPool also tolerates a duplicated /v1 prefix, but omitting it is recommended when the tool appends /v1 itself.
3. Model ID
Get exact ID (e.g. claude-sonnet-4-6) at Pricing page — click copy icon next to any model.
Select a tool to view detailed guide
12 supported toolsTerminal coding agent, Anthropic standard
Claude desktop app, configured via inference gateway
OpenAI coding agent, Responses API standard
The Codex tab built into OpenAI's official ChatGPT Desktop App
Open-source multi-provider terminal coding agent
AI-native IDE based on VS Code
VS Code extension coding agent
Continue
Autocomplete & chat extension for VS Code / JetBrains
TOML configured CLI, OpenAI standard
Claude Code
Terminal coding agent, Anthropic standard
Requirement
This configuration works for both Claude Code CLI and Claude Code in Visual Studio Code. Install either the CLI (npm install -g @anthropic-ai/claude-code) or the Claude Code extension from the Visual Studio Code Marketplace. Node.js >= 18 is required either way.
npm install -g @anthropic-ai/claude-code
Choose your OS
Choose how to set up
Step 1 — Open Terminal: press Cmd + Space, type Terminal, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
curl -fsSL /setup/claude-code/claude-code.sh | bash
Step 1 — Open PowerShell: press the Windows key, type powershell, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
irm /setup/claude-code/claude-code.ps1 | iex
The script asks for your SubPool API key, then lets you pick a model for each of the 4 roles Claude Code uses — FABLE, OPUS, SONNET, HAIKU (press Enter on any of them to use Model Switch, so you can change the model later from the website without rerunning the script). If a settings.json already exists, it is renamed to settings_backup_<timestamp>.json right next to it before the new one is written — nothing is ever deleted.
Claude Code reads ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN from the settings JSON file — writing them directly to settings.json is more reliable than exporting them temporarily in a shell. Use the URL exactly as shown below, ending in /v1.
- Open Terminal, create directory if needed: mkdir -p ~/.claude
- Edit ~/.claude/settings.json and paste configuration below.
- Save file, restart terminal, run claude to start.
{
"hasCompletedOnboarding": true,
"env": {
"ANTHROPIC_BASE_URL": "/v1",
"ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "gpt-5-6-sol",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5-6-terra",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5-6-terra",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5-6-luna"
}
}
- Open PowerShell, create directory: mkdir $env:USERPROFILE\.claude
- Edit %USERPROFILE%\.claude\settings.json and paste configuration below.
- Save file, restart PowerShell/WSL, run claude.
{
"hasCompletedOnboarding": true,
"env": {
"ANTHROPIC_BASE_URL": "/v1",
"ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "gpt-5-6-sol",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5-6-terra",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5-6-terra",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5-6-luna"
}
}
Note
Claude Code only reads settings.json on startup — open a new session after editing. SubPool also tolerates a duplicated /v1 prefix if you accidentally add one, but the URL shown above (ending in /v1) is the recommended configuration.
Verify Connection
Run claude in any folder and send a prompt. Response without 401 error confirms setup.
Claude (Desktop App)
Claude desktop app, configured via inference gateway
Prerequisites
- Claude Desktop installed (macOS or Windows) — see Step 2 below to enable Developer Mode, a required step before anything else here.
- Quit the app completely before editing the file. As with Cline, edits made while the app is running get overwritten when it saves its own state.
- Only the macOS path is verified. The Windows path is inferred from where the app conventionally stores its config — if your machine has no such folder, use the lookup command in the Windows tab below.
Choose your OS
Connect the Gateway for the first time
On macOS there's nothing elaborate to do: on the app's opening screen (Get Started), just click Or sign in with Gateway.
This step is required on Windows for both paths in Step 3 below. A normal claude.ai sign-in does NOT create this config — it's a separate, hidden feature.
- Open Claude App (the sign-in / Get Started screen).
- Click the ☰ menu top-left → Help → Troubleshooting → Enable Developer Mode.
- The ☰ menu now shows a Developer item → click Developer → Configure Third-Party Inference…. On the Connect tab, set Credential kind to Static API Key.
- Enter
undefinedfor Gateway base URL, and enter any temporary value for API Key (it will be overwritten in Step 3 below), then click Apply Changes. - A restart confirmation popup appears — click Restart right away to apply it.
Choose how to set up
Paste the single line below into a command window and press Enter. The script asks for your API key and model, then writes the config for you. You never have to find a hidden folder or edit JSON, and any existing file is backed up before it is replaced.
The script lists the Claude models active on your account for you to pick from (Model Switch and other providers' models don't work here).
Step 1 — Open Terminal: press Cmd + Space, type Terminal, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
curl -fsSL /setup/claude-app/claude-app.sh | bash
Step 1 — Open PowerShell: press the Windows key, type powershell, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
irm /setup/claude-app/claude-app.ps1 | iex
Note
Three things differ from the other tools here: (1) inferenceGatewayBaseUrl must be the bare domain, with NO trailing /v1 — the app appends /v1/messages and /v1/models itself, so adding /v1 makes it call /v1/v1/... and show "organization's model list hasn't loaded". (2) Every entry in inferenceModels[] must be a real Anthropic model id (like the models in the example below) — the Model Switch alias (switch-default) doesn't work here, showing "not an Anthropic model". (3) Add inferenceGatewayAuthScheme: "bearer" and modelDiscoveryEnabled: true as shown. Get the exact id of an active model on the pricing page.
- Quit Claude entirely with Cmd + Q — closing the window is not enough.
- Open the config folder: in Finder press Cmd + Shift + G, paste
~/Library/Application Support/Claude-3p/configLibrary/and hit Enter. Find the<appliedId>.jsonfile for the profile you use — with a single profile there is exactly one.jsonin there. - Set or add the keys exactly as shown below. Replace
sk-xxx...with your real API key. - Save the file (Ctrl + S, or Cmd + S on macOS) and reopen Claude.
{
"inferenceProvider": "gateway",
"inferenceGatewayBaseUrl": "",
"inferenceGatewayApiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx",
"inferenceGatewayAuthScheme": "bearer",
"modelDiscoveryEnabled": true,
"inferenceModels": [
{ "name": "claude-fable-5" },
{ "name": "claude-opus-5" },
{ "name": "claude-sonnet-5" },
{ "name": "claude-haiku-4-5-20251001" }
]
}
- Quit Claude entirely. Clicking the X is not enough — the app keeps running in the background. Look at the system tray (bottom-right of the screen, next to the clock; you may need to click the ^ arrow to see all icons), right-click the Claude icon and choose Quit (or Exit).
- Double-check it is closed. Press Ctrl + Shift + Esc to open Task Manager. On the Processes tab, if any entry named Claude is still listed, right-click it and choose End task.
- Open the config folder. Press Windows + R, type
%APPDATA%and press Enter — Explorer opens atC:\Users\<your-name>\AppData\Roaming. Look for a folder whose name starts with "Claude" (e.g.Claude-3p), open it, then go into the configLibrary subfolder.
Can't find the folder?
If Explorer says "Location is not available", or you see no Claude folder at all, open PowerShell (press Windows, type PowerShell, Enter) and paste the command below. It prints the exact path on your machine:
Get-ChildItem "$env:APPDATA","$env:LOCALAPPDATA" -Recurse -Directory -Filter configLibrary -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
If the command prints nothing, the folder was never created — go back to Step 2 above and complete all 5 Enable Developer Mode steps, then run the command again. This is not about forgetting to sign in.
- Open the right file in the right editor. The folder holds one or more
<appliedId>.jsonfiles; if there are several, pick the one with the most recent Date modified. Right-click → Open with → Visual Studio Code (or Notepad++). Do not use Word or WordPad — they corrupt the file format. - Set or add the keys exactly as shown below. Replace
sk-xxx...with your real API key. - Save the file (Ctrl + S, or Cmd + S on macOS) and reopen Claude.
{
"inferenceProvider": "gateway",
"inferenceGatewayBaseUrl": "",
"inferenceGatewayApiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx",
"inferenceGatewayAuthScheme": "bearer",
"modelDiscoveryEnabled": true,
"inferenceModels": [
{ "name": "claude-fable-5" },
{ "name": "claude-opus-5" },
{ "name": "claude-sonnet-5" },
{ "name": "claude-haiku-4-5-20251001" }
]
}
Note
If configLibrary holds several .json files (several profiles), editing the wrong one has no effect. The reliable way: open _meta.json in the same folder — its appliedId field names the active profile's .json file. No _meta.json? Check each file's last modified time, or open the app first to see which profile is active before quitting to edit.
Verify Connection
Reopen Claude. If it shows a sign-in screen, choose Continue with Gateway (do not sign in with a claude.ai account). If that screen shows “Your provider setup needs a fix”, your inferenceModels field is still wrong — see the note above. Once past that screen, start a new session and send a short prompt to confirm the gateway points at SubPool.
Codex CLI
OpenAI coding agent, Responses API standard
Prerequisites
- Codex CLI installed via npm, or the Codex extension from the VS Code Marketplace — both share the config below.
- Configured via TOML format — [model_providers.subpool] header is case sensitive.
- If this machine has previously installed Codex and done `codex login` with a ChatGPT account, log out first: open a terminal and run codex logout.
Choose your OS
Choose how to set up
Paste the single line below into a command window and press Enter. The script asks for your API key and model, then writes the config for you. You never have to find a hidden folder or edit JSON, and any existing file is backed up before it is replaced.
Step 1 — Open Terminal: press Cmd + Space, type Terminal, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
curl -fsSL /setup/codex/codex.sh | bash
Step 1 — Open PowerShell: press the Windows key, type powershell, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
irm /setup/codex/codex.ps1 | iex
Step 1 — create/edit ~/.codex/auth.json:
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
Step 2 — create/edit ~/.codex/config.toml. The name field is required — Codex errors on startup without it. env_key and requires_openai_auth = false are also required — without them, a machine that has ever done `codex login` with a ChatGPT account gets a 401 missing API key error even with the right key:
model = "switch-default" model_provider = "subpool" [model_providers.subpool] name = "SubPool" base_url = "/v1" wire_api = "responses" env_key = "SUBPOOL_API_KEY" requires_openai_auth = false
Step 3 — set the SUBPOOL_API_KEY environment variable (Codex reads the key via env_key from step 2, not directly from auth.json, for a custom provider):
echo 'export SUBPOOL_API_KEY="sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"' >> ~/.zshrc launchctl setenv SUBPOOL_API_KEY "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
Step 4 — open a new Terminal window (to pick up the env var you just set), then restart Codex CLI completely.
Step 1 — create/edit %USERPROFILE%\.codex\auth.json:
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
Step 2 — create/edit %USERPROFILE%\.codex\config.toml. env_key and requires_openai_auth = false are required — without them, a machine that has ever done `codex login` with a ChatGPT account gets a 401 missing API key error even with the right key:
model = "switch-default" model_provider = "subpool" [model_providers.subpool] name = "SubPool" base_url = "/v1" wire_api = "responses" env_key = "SUBPOOL_API_KEY" requires_openai_auth = false
Step 3 — set the SUBPOOL_API_KEY environment variable (run in PowerShell, no admin rights needed):
[Environment]::SetEnvironmentVariable('SUBPOOL_API_KEY', 'sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx', 'User')
Step 4 — open a new PowerShell window, then restart Codex CLI completely.
401 missing API key even with the right key
If this machine has ever done `codex login` with a ChatGPT account, Codex prefers that login state and won't attach Authorization to requests for a custom provider based on auth.json alone — even with the correct key entered. The surest fix is to log out before configuring: run codex logout. The Quick install script above already prompts for this and handles the config side (sets env_key plus the environment variable); doing it manually, make sure you have both the env_key/requires_openai_auth lines in config.toml AND the environment variable step above — missing either one still causes the error.
Codex CLI Specific Error
Error 'provider name must not be empty' means name = "SubPool" is missing under [model_providers.subpool].
Check the model after opening Codex
After configuring and opening Codex, if the model shown is Custom, that's correct — use it as-is. Do NOT switch to a different model from Codex's built-in list — switching makes Codex fall back to OpenAI's default provider (no longer going through SubPool), which won't work.
Verify Connection
Open Codex, start a new chat session, and send a short message. A normal reply (no 401 or invalid api key error) confirms it's talking to SubPool.
ChatGPT (Desktop App)
The Codex tab built into OpenAI's official ChatGPT Desktop App
Prerequisites
- ChatGPT (Desktop App) installed, with the Codex tab open in the app.
- ChatGPT Desktop App reads the same ~/.codex/config.toml and auth.json as Codex CLI/the VS Code extension (confirmed in OpenAI's official docs) — there's no separate config file for it.
- If this machine has previously signed in to a ChatGPT account in Codex/ChatGPT App, sign out first: run codex logout in a terminal if Codex CLI is installed, or sign out directly in the app (account/profile menu) if you have no terminal.
Note
Quit ChatGPT (Desktop App) completely before running the script — if it's still running, it can overwrite what you just wrote when you later quit it.
Choose your OS
Choose how to set up
Paste the single line below into a command window and press Enter. The script asks for your API key and model, then writes the config for you. You never have to find a hidden folder or edit JSON, and any existing file is backed up before it is replaced.
Step 1 — Open Terminal: press Cmd + Space, type Terminal, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
curl -fsSL /setup/chatgpt-app/chatgpt-app.sh | bash
Step 1 — Open PowerShell: press the Windows key, type powershell, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
irm /setup/chatgpt-app/chatgpt-app.ps1 | iex
Step 1 — create/edit ~/.codex/auth.json:
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
Step 2 — create/edit ~/.codex/config.toml (name field is required). env_key and requires_openai_auth = false are also required — without them, a machine that has ever done `codex login` with a ChatGPT account gets a 401 missing API key error even with the right key:
model = "switch-default" model_provider = "subpool" [model_providers.subpool] name = "SubPool" base_url = "/v1" wire_api = "responses" env_key = "SUBPOOL_API_KEY" requires_openai_auth = false
Step 3 — set the SUBPOOL_API_KEY environment variable for GUI apps (the app reads the key via env_key from step 2, not directly from auth.json, for a custom provider):
launchctl setenv SUBPOOL_API_KEY "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
Step 4 — quit ChatGPT (Desktop App) completely (not just the window), reopen it, and go to the Codex tab.
Step 1 — create/edit %USERPROFILE%\.codex\auth.json:
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
Step 2 — create/edit %USERPROFILE%\.codex\config.toml. env_key and requires_openai_auth = false are required — without them, a machine that has ever done `codex login` with a ChatGPT account gets a 401 missing API key error even with the right key:
model = "switch-default" model_provider = "subpool" [model_providers.subpool] name = "SubPool" base_url = "/v1" wire_api = "responses" env_key = "SUBPOOL_API_KEY" requires_openai_auth = false
Step 3 — set the SUBPOOL_API_KEY environment variable (run in PowerShell, no admin rights needed):
[Environment]::SetEnvironmentVariable('SUBPOOL_API_KEY', 'sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx', 'User')
Step 4 — quit ChatGPT (Desktop App) completely and reopen it to apply the new config.
401 missing API key even with the right key
If this machine has ever done `codex login` with a ChatGPT account, the app prefers that login state and won't attach Authorization to requests for a custom provider based on auth.json alone — even with the correct key entered. The surest fix is to sign out before configuring: run codex logout (if Codex CLI is installed) or sign out directly in the app. The Quick install script above already prompts for this and handles the config side; doing it manually, make sure you have both the env_key/requires_openai_auth lines in config.toml AND the environment variable step above — missing either one still causes the error.
Why it shares config with Codex CLI
Per OpenAI's official docs (learn.chatgpt.com): the desktop app, CLI, and VS Code extension all use the same cached login mechanism and config file — editing it once applies to all three, no need to repeat this per tool.
Check the model after opening the Codex tab
After configuring and opening the Codex tab, if the model shown is Custom, that's correct — use it as-is. Do NOT switch to a different model from the built-in list — switching makes the app fall back to OpenAI's default provider (no longer going through SubPool), which won't work.
Verify Connection
Open the Codex tab in ChatGPT (Desktop App), start a new session, and send a short message. A normal reply (no auth error) confirms it's talking to SubPool.
OpenCode CLI
Open-source multi-provider terminal coding agent
Prerequisites
- OpenCode CLI installed.
Choose your OS
Choose how to set up
Paste the single line below into a command window and press Enter. The script asks for your API key and model, then writes the config for you. You never have to find a hidden folder or edit JSON, and any existing file is backed up before it is replaced.
Step 1 — Open Terminal: press Cmd + Space, type Terminal, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
curl -fsSL /setup/opencode/opencode.sh | bash
Step 1 — Open PowerShell: press the Windows key, type powershell, press Enter.
Step 2 — In the window that just opened, paste the command below and press Enter:
irm /setup/opencode/opencode.ps1 | iex
- Recommended: create the global configuration at ~/.config/opencode/opencode.json to use SubPool in every project. Use ./opencode.json only for project-specific configuration.
- Declare the subpool provider as shown below. Keep npm set to @ai-sdk/openai-compatible and include models because OpenCode does not automatically load them from /v1/models.
- Replace the sample API key with your SubPool key, save the file, then run opencode. The global configuration is available from every directory.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"subpool": {
"npm": "@ai-sdk/openai-compatible",
"name": "SubPool",
"options": {
"baseURL": "/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxx"
},
"models": {
"gpt-5-6-sol": {
"name": "GPT-5.6 Sol"
},
"gpt-5-6-terra": {
"name": "GPT-5.6 Terra"
},
"gpt-5-6-luna": {
"name": "GPT-5.6 Luna"
},
"claude-sonnet-5": {
"name": "Claude Sonnet 5"
},
"gemini-3-6-flash-high": {
"name": "Gemini 3.6 Flash High"
}
}
}
}
}
Verify Connection
Run opencode models subpool or use /models in the TUI. If the provider is missing, check provider.subpool and the models section in opencode.json.
Cursor IDE
AI-native IDE based on VS Code
Prerequisites
- Latest version of Cursor IDE installed.
- SubPool Key created in advance.
Configuration Steps
- Open Cursor → top right or menu Cursor → Settings → Cursor Settings (Cmd + , on macOS, Ctrl + , on Windows/Linux).
- In Settings window, select Models tab on left sidebar.
- Scroll down to API Keys, find OpenAI API Key — paste your SubPool key.
- Enable Override OpenAI Base URL switch, enter official Base URL (ending with /v1).
- Click Verify (if present) or close Settings — Cursor tests key automatically.
- Open AI chat (Cmd/Ctrl + L), select Add model if needed, type exact Model ID.
OpenAI Base URL: /v1 OpenAI API Key: sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx
Verify Connection
Open chat panel, send a test prompt. Normal response confirms active connection.
Note
Cursor caches verified models — if you change Base URL or key, delete old model entries and re-add them.
Cline
VS Code extension coding agent
Prerequisites
- VS Code and Cline extension installed.
- Cline stores settings in 2 JSON files — editing directly on disk is faster and reliable.
Configuration Steps
- Quit VS Code completely before editing files.
- Edit ~/.cline/data/globalState.json for provider and model configuration.
- Edit ~/.cline/data/secrets.json for API key declaration.
- Reopen VS Code and confirm active model in Cline panel.
{
"actModeApiProvider": "openai",
"planModeApiProvider": "openai",
"openAiBaseUrl": "",
"openAiModelId": "switch-default",
"planModeOpenAiModelId": "switch-default"
}
{
"openAiApiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
Verify Connection
Send a prompt in Cline panel. Response with tool execution indicates success.
Note
openAiBaseUrl here must NOT include /v1 suffix — Cline appends it automatically.
Continue
Autocomplete & chat extension for VS Code / JetBrains
Prerequisites
- Continue extension installed in VS Code or JetBrains.
Configuration Steps
- Open Continue settings or ~/.continue/config.json.
- Add SubPool configuration object to models array.
- Save file — Continue auto-reloads configuration.
- Select SubPool model from Continue chat dropdown.
{
"models": [
{
"title": "SubPool",
"provider": "openai",
"model": "switch-default",
"apiBase": "/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
]
}
Verify Connection
Send a chat prompt in Continue. Streaming response confirms success.
Hermes Agent
YAML + .env configured coding agent
Prerequisites
- Hermes Agent installed.
- Hermes separates config (YAML) and secrets (.env) — edit both.
Configuration Steps
- Configure ~/.hermes/config.yaml for model and custom provider.
- Configure ~/.hermes/.env with OPENAI_API_KEY.
- Restart Hermes Agent.
model: default: "switch-default" provider: "custom" base_url: "/v1"
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx
Verify Connection
Run Hermes Agent and send a prompt. No auth errors confirms connection.
OpenClaw
Multi-agent framework configured via JSON
Prerequisites
- OpenClaw framework installed.
Configuration Steps
- Open/create ~/.openclaw/openclaw.json.
- Declare subpool provider in models.providers and set primary model to subpool/custom.
- Specify exact Model ID for both id and name.
- Restart OpenClaw.
{
"agents": {
"defaults": {
"model": {
"primary": "subpool/custom"
}
}
},
"models": {
"providers": {
"subpool": {
"baseUrl": "/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx",
"apiType": "openai",
"models": [{ "id": "switch-default", "name": "switch-default" }]
}
}
}
}
Verify Connection
Run default agent and verify subpool provider log activity.
Qwen Code CLI
Alibaba terminal coding agent, OpenAI standard
Prerequisites
- Qwen Code installed via npm: npm install -g @qwen-code/qwen-code
Configuration Steps
- Open/create ~/.qwen/settings.json.
- Set security.auth.selectedType to openai and paste SubPool key into openaiApiKey.
- Set model.openaiBaseUrl and model.name.
- Run qwen in terminal.
{
"security": {
"auth": {
"selectedType": "openai",
"openaiApiKey": "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx"
}
},
"model": {
"openaiBaseUrl": "/v1",
"name": "switch-default"
}
}
Verify Connection
Run qwen and send a prompt. Normal response confirms connection.
DeepSeek CLI
TOML configured CLI, OpenAI standard
Prerequisites
- DeepSeek CLI installed.
Configuration Steps
- Open/create ~/.deepseek/config.toml.
- Declare [providers.openai] table with base_url, api_key, model.
- Save file and restart DeepSeek CLI.
[providers.openai] base_url = "/v1" api_key = "sk-xxxxxxxxxxxxxxxx-xxxxxx-xxxxxxxx" model = "switch-default"
Verify Connection
Open new CLI session after saving configuration.
Common Errors — Applies to All Tools
All tools listed above authenticate through the same SubPool gateway, so the errors below present identically whether you use Cursor, Codex, or any other tool. Read the error message to identify the root cause instantly.
| Error Message | HTTP Code | Root Cause | Fix / Solution |
|---|---|---|---|
| missing API key: provide Authorization: Bearer <key> or x-api-key: <key> | 401 | Request missing authentication header — key not configured or empty. | Check tool configuration file and paste key into correct field. |
| invalid api key | 401 | Key header present but not matching any active key — invalid or revoked key. | Create new key at Manage API Keys page and paste. |
| api key expired | 403 | Quota/prepaid key has expired. | Create new key or switch to pay-as-you-go credit key. |
| api key quota exhausted | 403 | Quota key token allowance exhausted. | Create new quota key or top up credit balance. |
| insufficient balance | 402 | Valid key but account balance insufficient for request. | Top up account balance at Topup page. |
Quick Error Isolation Tip
Before inspecting tool settings, make a direct curl call to the endpoint with your key. If curl succeeds but the tool fails, the issue is strictly inside local tool configuration, not your SubPool account.