Drop-in compatible
Chat Completions, Responses, streaming, tools, structured outputs and image generation. Point the official SDK at https://captainrouter.net/v1 and it just works.
CaptainRouter gives you an API key that works with the OpenAI SDKs, Codex and any tool that speaks the OpenAI API. Change the base URL, keep your code.
$5 free on sign-up. No card required to start.
Chat Completions, Responses, streaming, tools, structured outputs and image generation. Point the official SDK at https://captainrouter.net/v1 and it just works.
Prepaid balance in USD, charged per token. No subscription, no minimum monthly spend. Top up by card whenever you need.
Every request in the dashboard: model, tokens, cached input, latency and exact cost. Per-key spend limits and expiry dates.
Use the OpenAI SDK you already have. Only the API key and the base URL change.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_CAPTAINROUTER_KEY",
base_url="https://captainrouter.net/v1",
)
response = client.chat.completions.create(
model="gpt-6-luna",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.CAPTAINROUTER_API_KEY,
baseURL: "https://captainrouter.net/v1",
});
const response = await client.responses.create({
model: "gpt-6-sol",
input: "Write a haiku about routers.",
});
console.log(response.output_text);
curl https://captainrouter.net/v1/chat/completions \
-H "Authorization: Bearer $CAPTAINROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-6-luna", "messages": [{"role": "user", "content": "Hello!"}]}'
All reasoning models of the GPT-6 and GPT-5.6 families plus image generation. The live list is always at GET /v1/models, prices per 1M tokens are on the pricing page in the dashboard.
Run Codex CLI or the Codex app on your CaptainRouter balance. Add a provider to ~/.codex/config.toml, restart Codex and start a new chat.
The same works for any agent or IDE plugin with an OpenAI-compatible provider setting: Cline, Continue, Aider, LangChain, LlamaIndex and others.
model_provider = "captainrouter"
[model_providers.captainrouter]
name = "CaptainRouter"
base_url = "https://captainrouter.net/v1"
env_key = "CAPTAINROUTER_API_KEY"
wire_api = "responses"
Pass a thread-id header, one unique value per conversation. It keeps parallel chats apart and makes cached input work.
Conversations are not stored. Send the full history with every request; previous_response_id is not supported.
Repeated prompt prefixes are billed at a fraction of the input price, and cache writes are free.
Create an account, confirm your email and get a key with $5 of free credit.
Open the dashboard