CLI & scripting

Claude Code

Anthropic's terminal coding agent via Messages route.

Claude Code talks to FreeTheAi through the Anthropic Messages format. Set the gateway env vars, run `claude`, and pick a Claude alias.

Base URL https://api.freetheai.xyz
API path /v1/messages
Recommended models rev/claude-sonnet-4.5
Messages Streaming Tool calling
Step by step

Connect Claude Code to FreeTheAi.

  1. 1

    Export the gateway env vars

    Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Point them at FreeTheAi.

    bash
    export ANTHROPIC_BASE_URL=https://api.freetheai.xyz
    export ANTHROPIC_AUTH_TOKEN=fta_PASTE_YOUR_FREETHEAI_KEY
  2. 2

    Optional: enable model discovery

    Claude Code can list models from the gateway when you flip on discovery.

    bash
    export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
  3. 3

    Run claude and pick a model

    Start Claude Code, then use `/model` or `--model` to choose a FreeTheAi Claude alias.

    bash
    claude --model rev/claude-sonnet-4.5
Recommended aliases

Models that pair well with Claude Code.

  • rev/claude-sonnet-4.5
  • rev/claude-haiku-4.5
  • rev/claude-opus-4.5

See the full live catalog at /models. Aliases are stable; pricing on the free tier stays $0.

Heads up

Common gotchas.

  • Claude Code's discovery only surfaces models whose ID starts with `claude` or `anthropic`. Use the `rev/claude-*` aliases on FreeTheAi.
  • Setting `ANTHROPIC_AUTH_TOKEN` disables Remote Control, MCP connectors, and `/schedule` tied to a claude.ai login. That is expected.
  • FreeTheAi's `/v1/messages` already supports `anthropic-beta` and `count_tokens`, so no extra config is needed on the gateway side.
Where to next

Keep building.