La documentation est disponible en anglais.

Documentation / Anthropic-compatible

Anthropic Messages API — Introduction

Point Claude Code or any Anthropic SDK at TokenSaver: the Messages API is exposed under a dedicated prefix on the public API host and runs the same governed pipeline. Authenticate with your TokenSaver API key (ts_…)—never the Anthropic vendor key.

Base URL

Set the client base URL to the /anthropic prefix (no trailing slash); the Anthropic SDK appends /v1/messages itself:

https://api.tokensaver.fr/anthropic

The final call is https://api.tokensaver.fr/anthropic/v1/messages. This is symmetric to the OpenAI-compatible surface where the base URL is /openai/v1. Both live on the same host, in addition to the native /api/v1.

Claude Code in one minute

Recommended: use the TokenSaver CLI (tokensaver login && tokensaver route claude --launch) — it configures settings, MCP, Agent Registry approve, and Flux IA. Manual env equivalent:

export ANTHROPIC_BASE_URL="https://api.tokensaver.fr/anthropic"
export ANTHROPIC_AUTH_TOKEN="ts_your_tokensaver_key"   # or ANTHROPIC_API_KEY
export ANTHROPIC_MODEL="anthropic/claude-sonnet-4-6"     # catalogue provider/model_id
claude

Endpoints

Each route uses the same base URL prefix (no trailing slash).

POST/anthropic/v1/messages

Messages — JSON or stream (Anthropic SSE)

POST/anthropic/v1/messages/count_tokens

Token estimate (no provider call)

GET/anthropic/v1/models

List active chat provider/model_id ids

Authentication

Send your TokenSaver key (ts_…) as x-api-key (Claude Code ANTHROPIC_API_KEY) or Authorization: Bearer (Claude Code ANTHROPIC_AUTH_TOKEN). The header anthropic-version is accepted but not required; anthropic-beta is ignored. Workspace and organisation are derived from the key server-side.

Next: Create a message, Tools & streaming, or the OpenAI-compatible surface.