Besides the OpenAI-compatible chat completions endpoint, Promptix speaks the Anthropic Messages API. Anything built for Claude works unchanged: Claude Code, the official Anthropic SDKs, Cursor, Cline, Zed, LangChain's Anthropic integration and plain HTTP clients. Only the base URL and the key change, and the bill arrives in dinars.
Claude Code
Claude Code adds /v1/messages to the base URL itself, so point it at https://promptix.tn/api and pass your Promptix key as the auth token. Set the model variables so the "sonnet", "opus" and "haiku" tiers map to models in the Promptix catalog.
# Claude Code reads these from the environment (or ~/.claude/settings.json)export ANTHROPIC_BASE_URL="https://promptix.tn/api"export ANTHROPIC_AUTH_TOKEN="sk_your_promptix_key"export ANTHROPIC_API_KEY="" # Which Promptix model each Claude Code tier usesexport ANTHROPIC_MODEL="anthropic/claude-sonnet-5.5"export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-5.5"export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-5.5"export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-4.5" claudeTo keep the setting across sessions, put the same variables in ~/.claude/settings.json (or the project's .claude/settings.json):
{ "env": { "ANTHROPIC_BASE_URL": "https://promptix.tn/api", "ANTHROPIC_AUTH_TOKEN": "sk_your_promptix_key", "ANTHROPIC_API_KEY": "", "ANTHROPIC_MODEL": "anthropic/claude-sonnet-5.5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-5.5", "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5" }}Costs
Every Claude Code turn appears in your usage log with its token counts and its price in TND. Set a monthly limit on the key you give Claude Code to cap what a long session can spend.
Anthropic SDKs
With the official anthropic packages, set base_url / baseURL and the API key. The key is accepted both as x-api-key (what the SDKs send) and as Authorization: Bearer.
curl https://promptix.tn/api/v1/messages \ -H "x-api-key: $PROMPTIX_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-5.5", "max_tokens": 1024, "messages": [{ "role": "user", "content": "Summarize the Tunisian startup act in three bullet points." }] }'Streaming
Set stream: true, or use the SDK streaming helpers. Promptix forwards Anthropic's server-sent events (message_start, content_block_delta, message_delta, message_stop) without changing them, so text_stream and the tool-use events work as documented by Anthropic.
with client.messages.stream( model="anthropic/claude-sonnet-5.5", max_tokens=1024, messages=[{"role": "user", "content": "Write a short poem about Djerba."}],) as stream: for text in stream.text_stream: print(text, end="", flush=True)Models
Use any id from the catalog, Claude or not. GPT, Gemini, Llama, Mistral and DeepSeek models accept the same request shape, which lets a Claude Code session or an Anthropic SDK app switch provider by changing one string:
{ "model": "openai/gpt-6-luna", "max_tokens": 512, "messages": [{ "role": "user", "content": "Hello from the Anthropic format!" }]}Features that exist on both sides pass through: system prompts, images, tool use, extended thinking (on models that support it) and prompt caching. The anthropic-version and anthropic-beta headers are forwarded as you send them.
Billing and errors
- Requests are billed like any other Promptix request: the provider's price converted to TND, taken from your balance, with the full detail in the dashboard. See Billing.
- Errors use Anthropic's envelope (
{ "type": "error", "error": { "type", "message" } }):authentication_errorfor a bad key,billing_error(402) for an empty balance or a key limit,not_found_errorfor an unknown model,overloaded_errorwhen the provider is saturated. - Keys, rate limits and spending limits are the same as for the OpenAI-compatible endpoint. See Authentication and Errors and limits.