Switch to HopBase

Move an app from OpenAI, OpenRouter, or the Anthropic API to HopBase: the three values that change, before-and-after code for each SDK, the one-key-per-group rule, and what is not supported.

Moving an existing app to HopBase means changing three values: the Base URL, the key, and sometimes the model string. Request bodies, streaming code, and error handling stay the same.

What changes

OpenAIOpenRouterAnthropicHopBase
Base URLhttps://api.openai.com/v1https://openrouter.ai/api/v1https://api.anthropic.comOpenAI protocol: https://api.hop-base.com/v1
Anthropic protocol: https://api.hop-base.com (no /v1)
KeyOpenAI keyOne OpenRouter key for every modelAnthropic keysk-… created under API Keys, bound to one plan group
Model stringgpt-5.5openai/gpt-5.5, anthropic/claude-sonnet-5claude-sonnet-5Bare 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.

One key = one group = one model family

Create one key per group. This is the opposite of OpenRouter, where one key reaches every model. A HopBase key is bound to a single plan group: GET /v1/models returns only that group's models, and any other model returns 404 model_not_found. An app that calls Claude and GPT needs two keys — one from a Claude group, one from the Codex Plus or Codex Pro group — and picks the key by model.

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 (Official, Full Quota) 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, each with a key from its own group.

What is not supported

What you may be usingOn HopBase
Claude through /v1/chat/completions or /v1/responses404. Use Anthropic Messages — Anthropic SDK
Gemini through /v1/responses or the native Gemini SDK pathChat Completions only — Gemini chat
Kimi K3 through /v1/responsesChat Completions only — Kimi K3
Embeddings, audio transcription, Files, Batch, Assistants, fine-tuning, moderationNot offered; these paths return 404
One key for every modelOne key per group (see above)
OpenRouter model fallback lists (models), provider routing, model suffixes such as :online or :freeNot 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 this key's group 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.

On this page