- LLMFlux
- Anthropic-compatible API
Anthropic-compatible API
An Anthropic-compatible API and Claude gateway
LLMFlux accepts the Anthropic Messages format at api.llmflux.dev. Use the official Anthropic SDKs or Claude Code with one LLMFlux key, and reach Claude alongside the other models in the catalogue.
Use the Anthropic SDK
Set the SDK's base URL to https://api.llmflux.dev and use your LLMFlux key as the API key:
import anthropic
client = anthropic.Anthropic(
base_url="https://api.llmflux.dev",
api_key="YOUR_LLMFLUX_API_KEY",
)
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=512,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(message.content[0].text)curl https://api.llmflux.dev/v1/messages \
-H "x-api-key: $LLMFLUX_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 512,
"messages": [{ "role": "user", "content": "Hello, Claude" }]
}'Claude Code through LLMFlux
Claude Code reads two environment variables. Point them at LLMFlux and start it as usual:
export ANTHROPIC_BASE_URL="https://api.llmflux.dev"
export ANTHROPIC_API_KEY="YOUR_LLMFLUX_API_KEY"
claudeRequests then appear in your LLMFlux request log with their token counts and cost. The Claude Code guide covers persistent settings and Windows.
Claude models available
| Model id | Name | Input | Context window |
|---|---|---|---|
claude-fable-5 | Claude Fable 5 | text, vision | 200,000 tokens |
claude-opus-4-8 | Claude Opus 4.8 | text, vision | 200,000 tokens |
claude-opus-5 | Claude Opus 5 | text, vision | 200,000 tokens |
claude-opus-5-5 | Claude Opus 5.5 | text, vision | 200,000 tokens |
claude-sonnet-5 | Claude Sonnet 5 | text, vision | 200,000 tokens |
claude-sonnet-5-5 | Claude Sonnet 5.5 | text, vision | 200,000 tokens |
Prices per 1M tokens, including cache read and write prices, are listed in the model catalogue.
What carries over from the Messages API
Streaming
stream: true returns Anthropic-style server-sent events, passed through as they arrive.
System prompts and tools
Request fields are forwarded to the provider, so system prompts and tool definitions keep working.
Prompt caching
Cache read and write tokens are priced separately in the catalogue; see the save-tokens guide.
Same key, other formats
The same LLMFlux key also works on the OpenAI-compatible endpoints.
Using OpenAI SDKs too? See the OpenAI-compatible API.
Documentation
Frequently asked questions
- What is an Anthropic-compatible API?
- An API that accepts Anthropic's Messages request format (POST /v1/messages with model, max_tokens and messages). The Anthropic SDKs and tools built on them, such as Claude Code, can use it by changing the base URL.
- What base URL do I use with the Anthropic SDK?
- Use https://api.llmflux.dev. The SDK adds /v1/messages itself, so the base URL ends at the host.
- Can I use Claude Code with LLMFlux?
- Yes. Set ANTHROPIC_BASE_URL to https://api.llmflux.dev and ANTHROPIC_API_KEY to your LLMFlux key, then start claude. The Claude Code guide in the docs covers settings files and Windows.
- Which header carries the key?
- Either x-api-key (the Anthropic convention) or Authorization: Bearer. If both are present, Authorization is used.
- Can non-Claude models be called with the Messages format?
- Yes. Every model in the LLMFlux catalogue lists the messages endpoint, so the same Messages request works with DeepSeek, Gemini, Grok and others.
- Is LLMFlux affiliated with Anthropic?
- No. LLMFlux is an independent gateway. Claude and Anthropic are trademarks of Anthropic.
Related pages
Start with one key
Create an account, generate an API key, and send your first request in a few minutes.