Clef · Try the live demo →

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.

macOS / Linux
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
claude
Create a Heabsy key OpenAI base URL https://api.heabsy.com/v1 · Anthropic base URL https://api.heabsy.com

Why each variable is there

  1. ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer …, which is what Heabsy expects. If ANTHROPIC_API_KEY is also set in your shell, unset it: Claude Code would send that one as x-api-key instead.
  2. Claude Code's built-in aliases opus, sonnet and haiku expand to Anthropic model IDs. Pinning ANTHROPIC_DEFAULT_OPUS_MODEL, …_SONNET_MODEL and …_HAIKU_MODEL keeps /model sonnet, Plan Mode and subagents on the model you chose instead of a 404.
  3. ANTHROPIC_DEFAULT_HAIKU_MODEL also runs background work such as titles and summaries. A cheap model there — qwen38-fable costs $0.095 per million input tokens — keeps that work from billing at the main model's price.
  4. For model IDs it does not know, Claude Code assumes a 200K window and compacts early. CLAUDE_CODE_MAX_CONTEXT_TOKENS gives it the real number: 262144 for qwen38, 1048576 for glm53.

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.

~/.claude/settings.json
{
  "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)

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"
claude

Switching 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.

ModelIDContextMax outputInput / 1MOutput / 1M
Qwen3.8 27B Fableqwen38-fable512K32K$0.095$0.58
Qwen3.8 27B Queenqwen38-queen512K32K$0.095$0.58
GLM 5.3 Flash Uncensoredglm53-flash-unc1M128K$0.1739$0.6957
MiMo V2.6 Flash Uncensoredmimo-v26-flash-unc1M64K$0.4404$1.4285
MiMo V2.6 Flashmimo-v26-flash1M64K$0.4762$1.4286
MiMo V2.6 Flash Abliteratedmimo-v26-flash-abl1M64K$0.4762$1.4286
GLM 5.3glm531M128K$0.5217$0.9565
Qwen3.8 27B Uncensored Fast by Heabsyqwen38-unc-fast512K230K$0.7904$2.4952
Qwen3.8 27B Uncensoredqwen38-unc1M230K$0.8095$2.5238
Qwen3.8 27Bqwen38256K32K$1.00$3.00
GLM 5.3 Uncensoredglm-5.3-uncensored1M128K$1.1905$2.1429
CyberHeabsycyberheabsy1M64K$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
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 seeWhat to change
404 on /v1/v1/messagesThe base URL ends in /v1. Use https://api.heabsy.com without it — Claude Code appends /v1/messages itself.
401 Incorrect API keyThe 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 earlyClaude 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_managementSet 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.

Also set up:OpenCode · Cline · Kilo Code

Claude Code and Claude are trademarks of Anthropic. Heabsy is not affiliated with or endorsed by Anthropic, and Anthropic does not support Claude Code with non-Claude models through gateways.