OpenBridgerGuides
中文 Open console

Use OpenBridger in Claude Code

Claude Code speaks the Anthropic Messages protocol. The gateway path is POST /v1/messages. The key may be sent as x-api-key, which is what Claude Code does, and the gateway accepts that header on this path.

The model name must be a full ID from Model Square, and the current group needs a route that can serve Messages. A name on the square is not enough. Send one short request and confirm it in Usage Logs.

Before you start

  • The claude command is installed.
  • An API key named claude-code.
  • The model ID you intend to use.

This terminal only

export ANTHROPIC_BASE_URL="https://openbridger.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"

cd /path/to/your/project
claude

ANTHROPIC_BASE_URL is the site origin. Do not set it to https://openbridger.com/v1. Claude Code requests {BASE}/v1/messages. A base that already contains /v1 becomes /v1/v1/messages.

Closing the terminal drops the variables. To use the official service again:

unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN

Open a new terminal before you run claude.

Persist it in Claude Code settings

~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openbridger.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key"
  }
}

That file contains the key. Do not commit it or screenshot it. Do not put a real key in a project .claude/settings.json either.

If the client lets you set the model, use the full ID from Model Square. If Claude Code sends a default name that is not on the square, you get 503 (no channel) or an upstream model-not-found error. The model ID in the log is the one that was sent.

Check the variables in this terminal:

env | grep ANTHROPIC_

Confirm only that they exist. Do not paste the output into chat or a ticket.

Common problems

What you see What to do
It still asks you to sign in to the official account Open a new terminal, confirm both ANTHROPIC_ variables, then start claude
401 Copy the key again. Do not put Bearer in front of the token
503 no channel The model ID Claude Code sends is not the square's ID, or this group has no Messages route
The request never reaches Usage Logs Base URL still points at the official host. Check ANTHROPIC_BASE_URL
The protocol has to match

A model that works on Chat Completions does not automatically work in Claude Code. The model, the group, and /v1/messages all have to line up.

Related

Type to search