Integration · Anthropic

Use Claude Code with free models through Ficelle

Point Claude Code at Ficelle with two environment variables: Sonnet requests route to free coding models. Setup, model mapping and limits.

Supported · tested Checked

Status

Supported and tested. Ficelle serves the Anthropic Messages API that Claude Code speaks. A Ficelle smoke test on 8 September 2026 ran Claude Code 2.1.259 against a simulated provider: a multi-turn streaming session with a real Bash tool call.

Read this first. Anthropic states in its gateway documentation that it does not support Claude Code when a gateway routes it to models that are not Claude. Ficelle routes to free models from other developers, so this setup sits outside what Anthropic supports, and some Claude Code features can behave differently than on Claude.

Set up Claude Code

  1. Set the two environment variables

    Claude Code reads its gateway from ANTHROPIC_BASE_URL. Use the root of the Ficelle listener, without /v1: Claude Code adds /v1/messages itself. Anthropic recommends ANTHROPIC_AUTH_TOKEN for the credential; on the default local listener Ficelle accepts any value.

    shell
    export ANTHROPIC_BASE_URL="http://127.0.0.1:8646"
    export ANTHROPIC_AUTH_TOKEN="ficelle-local"
    
    claude
  2. Sign out of claude.ai if you were signed in

    Anthropic's gateway guide advises running /logout in Claude Code when a claude.ai login is saved, then starting it again with the variables set.

  3. Confirm the gateway is active

    Run /status in Claude Code. It should show an "Anthropic base URL" line with the Ficelle address. If the line is missing, the variables did not reach the Claude Code process.

  4. Know which profile answers

    Ficelle maps Claude model names to its own routing profiles by default: Haiku to ficelle/auto-fast, Sonnet and Claude Code's generic route to ficelle/auto-coding, Opus and Fable to ficelle/auto-orchestrator. Change it with anthropic_model_mapping in ~/.ficelle/config.json; the engine recipe documents the format.

Check it works

This checks Ficelle's Chat Completions endpoint with ficelle/auto-fast. A successful response confirms that route works, but does not verify the profile or protocol Claude Code uses. If the client still fails, check its error and the limits below as well as its configuration.

shell
curl -s http://127.0.0.1:8646/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"ficelle/auto-fast","messages":[{"role":"user","content":"Reply exactly: ficelle-ok"}],"temperature":0}'

Limits to know

  • Responses name the Ficelle profile that answered, and the X-Ficelle-Model header names the real model. Ficelle never presents a free model as Claude.
  • cache_control and thinking blocks are accepted, ignored, and listed in the X-Ficelle-Dropped-Params response header.
  • Ficelle does not serve /v1/messages/count_tokens. Anthropic documents that Claude Code then falls back to a character-based estimate, so the figures in /context are approximate.
  • ficelle/auto-coding only routes to certified coding models and can answer 503 no_certified_coding_model when none is available on your install, while other profiles still work.
  • ANTHROPIC_API_KEY works too, but an interactive session asks you to approve it once.

Troubleshooting

  • On a listener that is not local, Ficelle requires the token from ficelle access-token api: put it in ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer).
  • A base URL that ends in /v1 produces /v1/v1/messages: remove the suffix.

Questions

Can Claude Code use free models?

Yes, through a gateway that serves the Anthropic Messages API. Ficelle is one: set ANTHROPIC_BASE_URL to the local Ficelle address and Claude Code's requests route to free models from the providers you configure. Anthropic does not support Claude Code on models that are not Claude, so expect differences.

Does Ficelle pretend free models are Claude?

No. Each response names the Ficelle profile that answered and the X-Ficelle-Model header names the real model. The Claude model name in the request only selects a routing profile.

Which free model answers a Sonnet request?

By default a Sonnet request goes to ficelle/auto-coding, which picks among certified free coding models on your install. Haiku goes to ficelle/auto-fast and Opus to ficelle/auto-orchestrator. The anthropic_model_mapping setting changes this.

Why is the context usage in Claude Code approximate?

Ficelle does not serve the token-counting endpoint, so Claude Code estimates tokens from characters, as Anthropic documents for gateways without it.

Sources

Official pages and the Ficelle recipe this guide rests on, read on 11 November 2026:

  1. Claude Code: connect to an LLM gateway
  2. Claude Code: LLM gateway protocol
  3. Claude Code: LLM gateway overview and support scope
  4. Ficelle recipe: Claude Code (v0.3.15)