4

Quick Start

Get up and running with CoffeeRouter in 5 minutes — get your API Key, make your first AI call, and connect your tools.

coffeerouter

Last Update một tháng trước

 
Copy as AI-readable textCoffeeRouter is a unified AI model gateway, fully compatible with the OpenAI API format. With a single API Key and Base URL, you can access leading AI models such as GPT, Claude, Gemini, DeepSeek, and more without managing separate accounts or credentials for each provider.
Whether you call the API directly from code or use client tools like Claude Code or OpenClaw, the setup is always the same.
Part 1 — Get Up and Running in 5 MinutesStep 1 — Get Your API Key1.1 Log In to the CoffeeRouter ConsoleOpen https://coffeerouter.ai and sign in with your Google, GitHub, or Discord account.
IMGLog in to CoffeeRouter console/placeholders/docs/guide/login-console.png
1.2 Go to API Key Manager and Create an API KeyClick API Key Manager in the left sidebar.
IMGAPI Key Manager page/placeholders/docs/guide/api-key-manager.png
Click the Create API Key button. In the dialog, configure:
  • Key Name: give this key a descriptive name, such as my-first-key
  • Group: optional, organize keys by project or purpose
  • Quantity: number of keys to create, default is 1
  • Quota Settings: choose unlimited quota or set a per-request limit
  • Other Options: configure expiry date, IP whitelist, or other restrictions as needed
IMGCreate API Key dialog/placeholders/docs/guide/create-api-key.png
Click Submit and your API Key will be generated immediately.
1.3 Copy Your API KeyOnce created, find your API Key in the list. Right-click on it to see your options:
  • Copy Key: copy the API Key, which starts with sk-
  • Copy Link Info: one-click copy of the complete configuration including Base URL and API Key
IMGAPI Key list right-click menu/placeholders/docs/guide/api-key-context-menu.png
You will now have:
Important
Your API Key is displayed in a popup right after creation. We recommend copying and saving it to a secure location immediately. You can click Show Key in the token list to view it again later.
Step 2 — Make Your First API CallCoffeeRouter is fully compatible with the OpenAI API format. By modifying the configuration, you can use the standard OpenAI SDK, or any third-party clients and tools compatible with OpenAI, to seamlessly call all leading AI models aggregated by CoffeeRouter.
2.1 Browse Available ModelsYou can browse all available models on the Model Square.
If you need to query the available models programmatically, call the models endpoint directly:
curl https://coffeerouter.ai/v1/models \ -H "Authorization: Bearer sk-YOUR_API_KEY"
The id field in each returned object is the model name to use.
2.2 Make Your First CallPick a model and fill in the model parameter to initiate a call. Here is an example using gemini-2.5-flash:
Tip
Set the model parameter to the model name you want, such as gemini-2.5-flash. Browse all models on the Model Square or query GET /v1/models.
curl https://coffeerouter.ai/v1/chat/completions \ -H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YOUR_API_KEY" \
-d '{
"model": "gemini-2.5-flash",
"messages": [
{"role": "user", "content": "Hello! Introduce yourself."}
]
}'
from openai import OpenAI

client = OpenAI(
base_url="https://coffeerouter.ai/v1", api_key="sk-YOUR_API_KEY"
)

response = client.chat.completions.create( model="gemini-2.5-flash",
messages=[
{"role": "user", "content": "Hello! Introduce yourself."}
]
)

print(response.choices[0].message.content)Step 3 — Connect Your ToolsCoffeeRouter works with any OpenAI-compatible client or tool. You need three things:
ParameterValueAPI Address (Base URL)https://coffeerouter.aiAPI KeyThe token you created in the consoleModel NameFrom /v1/models, or the console model listClaude Code / Codex CLICommand-line code assistants.
When using Claude Code or Codex CLI in your terminal, set the following environment variables:
# Claude Code
export ANTHROPIC_BASE_URL="https://coffeerouter.ai"export ANTHROPIC_API_KEY="sk-YOUR_API_KEY"

# Codex CLI
export OPENAI_BASE_URL="https://coffeerouter.ai/v1"export OPENAI_API_KEY="sk-YOUR_API_KEY"
Full guide: Claude Code · Codex CLI
OpenClawSelf-hosted AI assistant platform, recommended for advanced users.
OpenClaw is a self-hosted AI assistant platform with multi-channel support. Add CoffeeRouter as a model provider in ~/.openclaw/openclaw.json:
{
"models": {
"mode": "merge",
"providers": {
"coffeerouter": {
"baseUrl": "https://coffeerouter.ai/v1", "apiKey": "sk-YOUR_API_KEY",
"api": "openai-completions",
"models": [
{ "id": "gemini-2.5-flash", "name": "Gemini 2.5 Flash" },
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "coffeerouter/gemini-2.5-flash"
}
}
}
}
Full guide: OpenClaw
Cherry StudioDesktop AI client, recommended for beginners.
Cherry Studio is a feature-rich desktop AI chat client that supports multi-model conversations.
  1. Download and install Cherry Studio: https://cherry-ai.com/download
  2. Open Settings → Model Providers → Add Provider
  3. Set provider type to OpenAI or OpenAI-compatible
  4. API Address: https://coffeerouter.ai
  5. API Key: your CoffeeRouter token
  6. Add the model IDs you want to use, query /v1/models for the full list
One-click Auto-fill
The CoffeeRouter console Token Manager supports one-click auto-fill for Cherry Studio. Click the button on the token list page and Cherry Studio will be configured automatically.
Full guide: Cherry Studio
Any Other OpenAI-Compatible ToolFor any tool that allows a custom API endpoint, configure:
  • API Address / Base URL → https://coffeerouter.ai
  • API Key → your CoffeeRouter token
  • Model Name → from /v1/models
Browse all verified app integration guides: Connect Agent Tools
Part 2 — API Capabilities OverviewCoffeeRouter exposes the following AI model APIs, all in OpenAI-compatible format:
API EndpointDescriptionChat Completions POST /v1/chat/completionsMulti-turn conversations, streaming, Tool Calling, structured outputsText Completions POST /v1/completionsClassic single-turn text completionImage Generation POST /v1/images/generationsAI image generationVideo Generation POST /v1/videosAI video generationModel List GET /v1/modelsQuery all currently available modelsFull API reference: API Docs


Was this article helpful?

0 out of 0 liked this article