Claude Code with 6bee.ai
Claude Code talks to any server that speaks the Anthropic Messages format. Change three environment variables and it runs on 6bee.ai models.
Before you start
- Claude Code installed (
npm install -g @anthropic-ai/claude-code). - Create an account with a verified email address, add prepaid balance, then create a key on the console's API keys page. Keep the key secret.
- Model IDs are listed in the console and returned by
GET https://api.6bee.ai/v1/models. Replace<model id>with one of them.
Set the environment variables
Run these in the shell you start Claude Code from:
export ANTHROPIC_BASE_URL=https://api.6bee.ai
export ANTHROPIC_AUTH_TOKEN=<your key>
export ANTHROPIC_MODEL=<model id>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<model id> # background tasks
claude ANTHROPIC_BASE_URL- The 6bee.ai host, without
/v1. Claude Code adds/v1/messagesitself. ANTHROPIC_AUTH_TOKEN- Your 6bee.ai key, sent as a Bearer token.
ANTHROPIC_MODEL- The model for the main conversation.
ANTHROPIC_DEFAULT_HAIKU_MODEL- The model for background tasks such as titles and summaries. Set it, or those calls ask for a model 6bee.ai does not list.
Make it permanent
To avoid exporting the variables in every shell, put them in Claude Code’s settings file:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.6bee.ai",
"ANTHROPIC_AUTH_TOKEN": "<your key>",
"ANTHROPIC_MODEL": "<model id>",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "<model id>"
}
} This file holds your key in plain text. Do not commit it to a repository.
Check that it works
- Start
claudein a project folder. - Send a short message. The reply comes from the model you set.
- Open the console’s usage log: the request appears there with its token counts and cost.
Limits that matter for long sessions
- Context
- Input plus output up to the model’s window: 128K to 1M tokens, depending on the model.
- Output
- max_tokens up to the model’s output cap: 16,384 to 131,072, depending on the model. Larger values are lowered to the cap, not rejected. If omitted: 8,192 to 32,768.
- Input tokens
- 1,000,000 uncached tokens per rolling minute. Cache hits don’t count.
- Requests
- 60 per minute.
- Concurrency
- 2 requests at a time.
- Request body
- Up to 8 MiB. n must be 1.
Over a limit you get HTTP 429 with Retry-After, or 400 when a request can’t fit the context. A lowered output cap is reported in the X-6bee-Output-Cap response header; on /v1/messages a thinking budget is lowered with it.
Troubleshooting
- HTTP 401
- The key is missing or wrong. Copy it again from the console, without spaces or quotes.
- Model not found
- The model ID does not match. List the valid IDs with
GET /v1/modelsor check the console. - HTTP 429
- You are over a per-account limit (requests, input tokens or concurrency). The
Retry-Afterheader says how long to wait. - HTTP 400 on long sessions
- The request no longer fits the model’s context window. Compact or clear the conversation, or switch to a model with a larger window.
- Request rejected for balance
- Each request first reserves its input plus
max_tokensof output. Top up, or lowermax_tokens. - A model you did not set is requested
- Set
ANTHROPIC_DEFAULT_HAIKU_MODELas well. Claude Code uses it for background tasks.