Use Claude Code with other models: Heabsy setup for Qwen, GLM and Kimi
Claude Code talks to any server that speaks the Anthropic Messages API, and Heabsy serves it at https://api.heabsy.com — no proxy, no /v1 suffix. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, pin the three model aliases to Heabsy model IDs, tell Claude Code the real context window, and run claude.
export ANTHROPIC_BASE_URL=https://api.heabsy.com # no /v1
export ANTHROPIC_AUTH_TOKEN="$HEABSY_API_KEY"
export ANTHROPIC_MODEL=qwen38
export ANTHROPIC_DEFAULT_OPUS_MODEL=qwen38
export ANTHROPIC_DEFAULT_SONNET_MODEL=qwen38
export ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen38-fable # background tasks
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144 # qwen38 window
claudehttps://api.heabsy.com/v1 · Anthropic base URL https://api.heabsy.comWhy each variable is there
ANTHROPIC_AUTH_TOKENis sent asAuthorization: Bearer …, which is what Heabsy expects. IfANTHROPIC_API_KEYis also set in your shell, unset it: Claude Code would send that one asx-api-keyinstead.- Claude Code's built-in aliases
opus,sonnetandhaikuexpand to Anthropic model IDs. PinningANTHROPIC_DEFAULT_OPUS_MODEL,…_SONNET_MODELand…_HAIKU_MODELkeeps/model sonnet, Plan Mode and subagents on the model you chose instead of a 404. ANTHROPIC_DEFAULT_HAIKU_MODELalso runs background work such as titles and summaries. A cheap model there —qwen38-fablecosts $0.095 per million input tokens — keeps that work from billing at the main model's price.- For model IDs it does not know, Claude Code assumes a 200K window and compacts early.
CLAUDE_CODE_MAX_CONTEXT_TOKENSgives it the real number: 262144 forqwen38, 1048576 forglm53.
Make it permanent
Put the same values into the env block of your user settings, ~/.claude/settings.json, not into a project's .claude/settings.json that gets committed with the key in it. The VS Code extension reads them from claudeCode.environmentVariables.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.heabsy.com",
"ANTHROPIC_AUTH_TOKEN": "<your Heabsy key>",
"ANTHROPIC_MODEL": "qwen38",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen38",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen38",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen38-fable",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144"
}
}Windows (PowerShell)
$env:ANTHROPIC_BASE_URL = "https://api.heabsy.com"
$env:ANTHROPIC_AUTH_TOKEN = $env:HEABSY_API_KEY
$env:ANTHROPIC_MODEL = "qwen38"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "qwen38"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "qwen38"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "qwen38-fable"
$env:CLAUDE_CODE_MAX_CONTEXT_TOKENS = "262144"
claudeSwitching models
The /model picker lists only IDs that contain claude or anthropic, so qwen38 or glm53 will not show up there. Start with claude --model glm53, or add one extra picker entry with ANTHROPIC_CUSTOM_MODEL_OPTION=glm53. When you switch, change CLAUDE_CODE_MAX_CONTEXT_TOKENS to the new model's window.
Which model should I pick?
Claude Code needs tool calling and benefits from a long window. Our own models in the table run in the EEA and do not store prompts; the Claude models (claude-sonnet-5.5, claude-opus-5.5) are served through a partner provider, without zero data retention and without an EEA guarantee.
| Model | ID | Context | Max output | Input / 1M | Output / 1M |
|---|---|---|---|---|---|
| Qwen3.8 27B Fable | qwen38-fable | 512K | 32K | $0.095 | $0.58 |
| Qwen3.8 27B Queen | qwen38-queen | 512K | 32K | $0.095 | $0.58 |
| GLM 5.3 Flash Uncensored | glm53-flash-unc | 1M | 128K | $0.1739 | $0.6957 |
| MiMo V2.6 Flash Uncensored | mimo-v26-flash-unc | 1M | 64K | $0.4404 | $1.4285 |
| MiMo V2.6 Flash | mimo-v26-flash | 1M | 64K | $0.4762 | $1.4286 |
| MiMo V2.6 Flash Abliterated | mimo-v26-flash-abl | 1M | 64K | $0.4762 | $1.4286 |
| GLM 5.3 | glm53 | 1M | 128K | $0.5217 | $0.9565 |
| Qwen3.8 27B Uncensored Fast by Heabsy | qwen38-unc-fast | 512K | 230K | $0.7904 | $2.4952 |
| Qwen3.8 27B Uncensored | qwen38-unc | 1M | 230K | $0.8095 | $2.5238 |
| Qwen3.8 27B | qwen38 | 256K | 32K | $1.00 | $3.00 |
| GLM 5.3 Uncensored | glm-5.3-uncensored | 1M | 128K | $1.1905 | $2.1429 |
| CyberHeabsy | cyberheabsy | 1M | 64K | $1.4286 | $4.2857 |
All models above run on Heabsy hardware in the EEA; prompts and completions are not stored. Thecatalog also lists 23 partner-hosted models — Claude, GPT-6, Kimi K3, DeepSeek V4 and others — with the same key and invoice, but without zero data retention and without an EEA guarantee.
Verify it works
Inside Claude Code run /status: the line Anthropic base URL must show https://api.heabsy.com. Then ask for something small, such as listing the files in the current folder — that one request exercises tool calling end to end.
If the tool shows an error you cannot read, test the key on its own first — one short request outside the tool:
curl https://api.heabsy.com/v1/messages \
-H "Authorization: Bearer $HEABSY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"qwen38","max_tokens":16,"messages":[{"role":"user","content":"Say hi"}]}'Troubleshooting
| What you see | What to change |
|---|---|
404 on /v1/v1/messages | The base URL ends in /v1. Use https://api.heabsy.com without it — Claude Code appends /v1/messages itself. |
| 401 Incorrect API key | The key is in ANTHROPIC_API_KEY or an old value is cached. Put it in ANTHROPIC_AUTH_TOKEN and unset ANTHROPIC_API_KEY. |
404 model not found for an ID like claude-sonnet-… | An alias was not pinned. Set all three ANTHROPIC_DEFAULT_*_MODEL variables to Heabsy IDs. |
| Conversation compacts far too early | Claude Code assumes 200K for unknown IDs. Set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the model's window from the table. |
400 mentioning Extra inputs are not permitted or context_management | Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1: it strips pre-release beta headers and the fields that come with them. |
| 403 with an HTML page ("Sorry, you have been blocked") | No key was sent at all: the key variable is empty or not set where the tool runs. Requests without a key are stopped before they reach the API; a wrong key gets a JSON 401 instead. |
Where do my prompts go?
From Claude Code straight to api.heabsy.com. On our own models the request is processed in the European Economic Area and the text is not stored — we keep what billing needs: the model, the token counts and the time. Partner-hosted models are processed by third-party inference providers; each is marked in the catalog, and none of them carries the no-retention promise. The terms are in the data processing agreement, the invoice comes from an EU company.
FAQ
Can I use Claude Code with Qwen 3.8 27B?+
Yes. Qwen3.8 27B runs on our own hardware in the EEA under the ID qwen38, with a 262,144-token window and tool calling. Set it as ANTHROPIC_MODEL and pin the three alias variables to it; the setup above is written for exactly that model.
Can I use Claude Code with GLM 5.3?+
Yes, with glm53: our own GLM 5.3, 1,048,576 tokens of context, $0.52 per million input tokens and $0.96 per million output tokens. Set CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576 so Claude Code uses the full window.
Does Anthropic support this?+
No. Anthropic states that it does not support Claude Code with non-Claude models through third-party gateways. It works because Claude Code accepts any Anthropic-compatible base URL, but Anthropic does not test it and Heabsy is not affiliated with Anthropic.
Do Remote Control and voice input work?+
No. Claude Code turns Remote Control off when ANTHROPIC_BASE_URL points elsewhere, and voice input is unavailable while a gateway token is active. Everything that runs in the terminal works.
Does my code leave the EU?+
With our own models, no: requests are processed in the EEA and prompts and completions are not stored. With partner models such as the Claude models in our catalog, processing is not guaranteed to stay in the EEA — each one is marked in the table and in the catalog.