Configure a model provider

Point Claude Code at HopsAPI's native Anthropic Messages endpoint. Import it into CC Switch from the console in one click, add it in CC Switch by hand, or configure it yourself.

Claude Code talks to Anthropic by default. Switching it to HopsAPI takes two values:

SettingValue
Base URLhttps://hopsapi.com — bare domain, no /v1, no trailing slash
KeyAn sk-... key from the console; see Create an API key

If you already know where those go, that's the whole story. Otherwise pick one of the three methods below — they all end in the same place:

MethodBest forCC Switch required
Method A: one-click import from the console (recommended)Almost everyone. The console fills in the URL and models; you paste the key onceYes
Method B: add it in CC Switch by handChecking every field yourself, or juggling several providersYes
Method C: manual setupNo extra software, or a headless environment like a server or CINo

Before you start

Create an API key

Open the console's API Keys page (1) and click + Create API Key at the top right (2). For the full flow, including model selection and spend limits, see Create an API key.

The API console's API Keys page, with red circle 1 on the API Keys nav item and red circle 2 on the "+ Create API Key" button at the top right; the card above also carries an "Import to CC Switch" button

The full key is shown only once, right after you create it — close the dialog and it's gone for good (the list keeps a mask like sk-b9b31…7228). Copy it there and then, and store it somewhere safe. A lost key can only be replaced, not recovered.

Install CC Switch

Methods A and B both land the configuration through CC Switch, an open-source provider manager that handles the whole setup through a UI, with no JSON or environment variable to edit by hand. Skip this step if you're going with Method C.

Requires macOS 12+, Windows 10+, Ubuntu 22.04+ / Debian 11+ / Fedora 34+.

Method A: one-click import from the console

The console builds a complete HopsAPI provider configuration and hands it to CC Switch. The request URL, configuration name, and models all arrive filled in — you only paste the key.

Step 1: Generate the import

Back on the API Keys page, click Import to CC Switch on the right of the "How do I use an API key?" card, then:

  1. Set Application to Claude.
  2. Paste the key you just copied into API Key (boxed in red). The request URL https://hopsapi.com and the configuration name HopsAPI are already filled in — leave them alone.
  3. Once the key registers, the model dropdowns below populate with the models your account can use. The defaults are fine; the primary model and the Haiku / Sonnet / Opus tiers can each be changed if you want.
  4. Leave Enable after import on so the provider becomes active as soon as it lands.
  5. Click Open CC Switch at the bottom right (circled in red).

The console's "Import to CC Switch" dialog with Claude selected, a request URL of https://api.com, a red box around the API Key field where the key is pasted, and a red circle around the "Open CC Switch" button at the bottom right

The model names in the screenshot are only an example — what the dropdowns actually list comes from your account. The full catalogue is in available models.

Step 2: Confirm the import in CC Switch

Your browser launches CC Switch, which opens a confirmation dialog. Check that the application type reads Claude, the API endpoint is https://hopsapi.com, and the masked key matches, then click Import.

CC Switch's "Confirm provider import" dialog, listing application type Claude, provider name API, API endpoint https://api.com, the masked API key, and the Sonnet, Opus, and multimodal models, with Cancel and Import at the bottom

The provider now sits in the CC Switch list, editable or removable at any time. Skip ahead to Verify.

If Open CC Switch does nothing, CC Switch is usually either missing or too old — one-click import needs a recent build. Install or upgrade it via Install CC Switch and try again. Failing that, switch to Method B; the Copy request URL button in the dialog gives you the URL to carry over.

Method B: add it in CC Switch by hand

With CC Switch installed, you can also fill in every field yourself.

Step 1: Add a provider

Open CC Switch, select Claude Code at the top (1), then click the + button at the top right (2).

The CC Switch main window, with arrow 1 pointing at the Claude Code tab and arrow 2 at the + add-provider button

Step 2: Fill in the configuration

Fill in the red-boxed fields below, leave everything else at its default, and click + Add at the bottom right.

FieldValueNotes
Provider nameHopsAPI-ClaudeAnything you like, just make it recognizable
Websitehttps://hopsapi.comThe provider's website
API KeyYour HopsAPI key (sk-YOUR_KEY)From the console's API Keys page
Request URLhttps://hopsapi.comBare domain, no /v1, no trailing slash
API formatAnthropic Messages (native)Under Advanced, leave as is
Auth fieldANTHROPIC_AUTH_TOKEN (default)Leave as is

The CC Switch add-provider form, with red boxes on the provider name, website, API key and request URL fields, plus the "Fetch model list" button and the actual-model dropdown in the model mapping section

Leave model mapping empty — HopsAPI serves claude-opus-5, claude-sonnet-5, and claude-fable-5 under the names Claude Code already expects, so there's nothing to remap. If you do want a different model, click Fetch model list and pick one from the dropdown next to the tier you want to override.

CC Switch writes ~/.claude/settings.json for you; there's nothing to edit by hand.

Step 3: Enable the provider

Back in the list, hover the HopsAPI-Claude row and click the Enable button that appears. The row stays highlighted while it's the active provider.

The CC Switch provider list, with a row's action buttons revealed on hover and a red circle around Enable; another row sits highlighted as the active provider

In the screenshot, the red circle marks the same button set revealed by hovering a different row, and HopsAPI-Claude is the one already highlighted as active.

Method C: manual setup

Without CC Switch, two environment variables are all it takes:

# macOS / Linux — add to ~/.zshrc or ~/.bashrc to persist
export ANTHROPIC_BASE_URL="https://hopsapi.com"
export ANTHROPIC_API_KEY="sk-YOUR_KEY"
# Windows (PowerShell) — reopen the terminal afterwards
setx ANTHROPIC_BASE_URL "https://hopsapi.com"
setx ANTHROPIC_API_KEY "sk-YOUR_KEY"

ANTHROPIC_BASE_URL takes the bare domain https://hopsapi.com — Claude Code appends /v1/messages itself. No /v1, no trailing slash.

For a project-scoped setup, put the same two values under env in .claude/settings.json (or ~/.claude/settings.json for a user-wide default):

.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://hopsapi.com",
    "ANTHROPIC_API_KEY": "sk-YOUR_KEY"
  }
}

The key sits in this file in plain text. Add a project-level .claude/settings.json to .gitignore so it never reaches your repository.

Verify

In a project directory, start Claude Code:

cd your-project
claude

Press Esc to skip the sign-in prompt on first launch. Check the header: API Usage Billing means it's billing through the API, and the item before it is the active model.

The Claude Code startup screen, showing the Claude Code version and, on the next line, "Opus 5 · API Usage Billing"

If both look right, you're set. Send any message to start using it.

To inspect the resolved configuration, run /status in the session:

/status

Check the two lines boxed in red below:

  • Anthropic base URL should read https://hopsapi.com
  • Model is the model actually in use

The output of /status in Claude Code, with red boxes on the Anthropic base URL and Model lines

Pick a model

Use /model to switch models mid-session. To pin a default instead, set:

export ANTHROPIC_MODEL="claude-sonnet-5"

The available Claude model ids are in available models, and the underlying request/response shape is in Anthropic format. Claude Code sends max_tokens and system in Anthropic's native format automatically — nothing extra to configure.

Only Claude models work here. Claude Code calls /v1/messages, and HopsAPI serves only the Claude family on that endpoint — a GPT or Gemini id will fail. To reach those, use their own protocol; see Protocols & endpoints.

Troubleshooting

SymptomFix
"Authentication error"Confirm the Anthropic base URL is right and that the API key is valid.
Connection timeoutsConfirm the request URL is exactly https://hopsapi.com, with no /v1 suffix and no trailing slash.
Requests still hit AnthropicCompare the base URL with /status. A stale terminal keeps the old environment variables until you restart it.
Model-not-found errorCheck ANTHROPIC_MODEL for typos and confirm the id appears in available models.
"Open CC Switch" does nothingCC Switch is missing or too old. Install or upgrade it, then retry.
The model dropdowns are empty in the import dialogThe key is incomplete or invalid — the model list is fetched with it. Copy the key again, or create a new one.
CC Switch changes have no effectClaude Code reads its configuration at launch — restart the session after changing anything.
On this page

On this page