Switch to HopBase
Move from OpenAI, OpenRouter, or the Anthropic API to HopBase by changing three values.
Migrating changes three values: the Base URL, the key, and the model ID if needed. Request bodies, streaming code, and error handling stay the same.
What changes
| OpenAI | OpenRouter | Anthropic | HopBase | |
|---|---|---|---|---|
| Base URL | https://api.openai.com/v1 | https://openrouter.ai/api/v1 | https://api.anthropic.com | OpenAI protocol: https://api.hop-base.com/v1Anthropic protocol: https://api.hop-base.com (no /v1) |
| Key | OpenAI key | One OpenRouter key for every model | Anthropic key | sk-… created under API Keys, including 1–10 groups |
| Model ID | gpt-5.5 | openai/gpt-5.5, anthropic/claude-sonnet-5 | claude-sonnet-5 | Bare ID with no vendor prefix, exactly as GET /v1/models returns it: gpt-5.5, claude-sonnet-5 |
Which protocol each model family uses is listed in Base URLs and protocols.
Add the groups you need to the key. An OpenRouter key calls every model; a HopBase key calls the models of the groups it includes — 1 to 10, across platforms. GET /v1/models returns the union of those groups' models, and calling a model outside all of them returns 404 model_not_found. An app that calls Claude and GPT can use one key with a Claude group and the Codex Plus or Codex Pro group; each request is billed by the group that serves its model. Groups whose models overlap (such as Codex Plus and Codex Pro) cannot share a key (except GPT Official Direct (Azure) with a Codex group or GPT Image (all models); see Which group to choose), and a subscription group must be a key's only group.
OpenAI SDK
Set the Base URL and swap the key. OpenAI model IDs such as gpt-5.5 stay the same as long as your key's GET /v1/models lists them.
import os
from openai import OpenAI
client = OpenAI(
- api_key=os.environ["OPENAI_API_KEY"],
+ base_url="https://api.hop-base.com/v1",
+ api_key=os.environ["HOPBASE_OPENAI_API_KEY"],
)
resp = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello"}],
)Without touching code, both SDKs also read OPENAI_BASE_URL and OPENAI_API_KEY from the environment: set them to https://api.hop-base.com/v1 and your HopBase key. More examples are in OpenAI SDK.
Anthropic SDK
Claude keeps the Anthropic Messages API. Set the Base URL without /v1 and use a key from the Claude Max Enterprise group. Keys from Claude Max (ccmax) work only in the Claude Code client; SDK calls with them fail.
import os
from anthropic import Anthropic
client = Anthropic(
- api_key=os.environ["ANTHROPIC_API_KEY"],
+ base_url="https://api.hop-base.com",
+ api_key=os.environ["HOPBASE_CLAUDE_API_KEY"],
)
msg = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)The environment-variable route works here too: ANTHROPIC_BASE_URL=https://api.hop-base.com. See Anthropic SDK.
OpenRouter
Change the Base URL and key, drop the vendor prefix from the model string, and remove the OpenRouter attribution headers — HopBase does not need them.
import os
from openai import OpenAI
client = OpenAI(
- base_url="https://openrouter.ai/api/v1",
- api_key=os.environ["OPENROUTER_API_KEY"],
- default_headers={"HTTP-Referer": "https://your-app.example", "X-Title": "Your App"},
+ base_url="https://api.hop-base.com/v1",
+ api_key=os.environ["HOPBASE_OPENAI_API_KEY"],
)
resp = client.chat.completions.create(
- model="openai/gpt-5.5",
+ model="gpt-5.5",
messages=[{"role": "user", "content": "Hello"}],
)If you reached Claude through OpenRouter's OpenAI-compatible endpoint, that path does not exist for Claude on HopBase: move those calls to the Anthropic SDK with a Claude-group key, as in the section above. Other families (Gemini, GLM, Qwen, DeepSeek, Kimi, Grok) stay on the OpenAI SDK, with a key that includes each family's group.
What is not supported
| What you may be using | On HopBase |
|---|---|
Claude through /v1/chat/completions or /v1/responses | 404. Use Anthropic Messages — Anthropic SDK |
Gemini through the native Gemini SDK path (:generateContent) | Supported on Gemini Official Direct (Enterprise): point the SDK's Base URL at https://api.hop-base.com. Gemini Value (AI Studio / Vertex) does not support it — Gemini chat |
Kimi K3 through /v1/responses or /v1/messages | Chat Completions only — Kimi K3 |
| Embeddings, audio transcription, Files, Batch, Assistants, fine-tuning, moderation | Not offered; these paths return 404 |
| One key for every model | One key can include up to 10 groups across platforms, as long as their models do not overlap, except GPT Official Direct (Azure) with a Codex group or GPT Image (all models) (see above) |
OpenRouter model fallback lists (models), provider routing, model suffixes such as :online or :free | Not supported; remove them and send a single model ID |
The full list of endpoints is in Base URLs and protocols.
Check the switch
List the key's models
GET https://api.hop-base.com/v1/models with the new key. Use only IDs that appear in the response.
Send one small request
Ask for "Reply only with ok." and confirm a 200. A 404 usually means the model is not in any of this key's groups or the Base URL points at the wrong protocol — see Error codes and retries.
Check what the key can spend
GET https://api.hop-base.com/v1/usage returns the key's spendable balance. Fields are explained in Account and catalog API.
Next steps
- Quickstart: create a key and send the first request
- Available models: find the model IDs available to a key
- Account and catalog API: check the balance, usage, and model catalog over the API
- Error codes and retries: what each error code means and whether to retry