Get to your first token.
Ahrigate is a Claude API gateway, built for Claude Code. Get a key, point your tool at api.ahrigate.com, send a request.
Quickstart
Claude Code first: set three environment variables and launch (base URL, auth token, model). Swap in your key from the console.
unset ANTHROPIC_API_KEY # Use only one credential source for this connection export ANTHROPIC_BASE_URL="https://api.ahrigate.com" export ANTHROPIC_AUTH_TOKEN="sk-YOUR-AHRIGATE-KEY" export ANTHROPIC_MODEL="claude-opus-5-5" # key from Console -> API Keys claude # Claude Code now runs through Ahrigate
Or send a first request straight to the Anthropic-native endpoint:
curl https://api.ahrigate.com/v1/messages \
-H "Authorization: Bearer sk-YOUR-AHRIGATE-KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Ahrigate"}]
}'Authentication
All requests need a Bearer token. Keys look like sk-.... Create one in the console and pick its supply group.
export AHRIGATE_API_KEY="sk-YOUR-AHRIGATE-KEY"
Store the key in an environment variable — never commit it to source control. Pass it as Authorization: Bearer $AHRIGATE_API_KEY on every request. Anthropic-style clients may send the same key as x-api-key.
First request
Ahrigate exposes both the OpenAI-compatible path (/v1/chat/completions) and the native Anthropic path (/v1/messages). Use whichever your SDK or tool speaks — the gateway handles both.
curl https://api.ahrigate.com/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR-AHRIGATE-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "Hello, Ahrigate"}]
}'Endpoint summary
| Endpoint | Method | Notes |
|---|---|---|
/v1/chat/completions | POST | OpenAI-compatible — chat, tool use, vision |
/v1/messages | POST | Anthropic format — Claude Code & Anthropic SDK |
/v1/models | GET | List models enabled on your key |
How to pay
Prepaid balance in USD, pay-as-you-go. Top up from the console: $10 minimum, $2000 maximum per top-up (presets $10, $25, $50, $100, $250). No monthly minimum. Checkout is hosted by Stripe; it offers the methods available for your region, for example card, Link, Alipay and WeChat Pay where eligible. Single-use redeem codes can also be applied to a balance in the console.
14-day refund: if you buy API credit as a consumer, you may cancel a top-up within 14 days of paying, without giving a reason, and we refund the unused part. Credit already used is not refunded. Refund policy
OpenAI-compatible
Drop-in replacement — change the base URL, keep your code. Any tool or SDK that speaks the OpenAI Chat Completions API works with Ahrigate without modification.
# Before: api.openai.com/v1
# After: change the host only — everything else stays
curl https://api.ahrigate.com/v1/chat/completions \
-H "Authorization: Bearer $AHRIGATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","messages":[{"role":"user","content":"Hello"}]}'Models
Pass the model id in the model field. Browse the full model catalog for capabilities and pricing.
Streaming
Set "stream": true for server-sent events. Tokens arrive as they are generated instead of after the full response.
curl https://api.ahrigate.com/v1/chat/completions \
-H "Authorization: Bearer $AHRIGATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "Write a haiku"}],
"stream": true
}'1M context (Claude)
Ahrigate passes through the 1 million token context of Claude models that have it (not Haiku 4.5, which is 200K). Use a bare model id (no [1m] suffix). No beta header is needed — 1M is the default window on current models.
Claude Code — env vars
# Claude Code — 1M context via Ahrigate (bare model id required; no [1m] suffix) unset ANTHROPIC_API_KEY # Use only one credential source for this connection export ANTHROPIC_BASE_URL="https://api.ahrigate.com" export ANTHROPIC_AUTH_TOKEN="sk-YOUR-AHRIGATE-KEY" export ANTHROPIC_MODEL="claude-opus-5-5" claude # launch Claude Code — now routed through Ahrigate
Alternative: ~/.claude/settings.json
// ~/.claude/settings.json (alternative to env vars)
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.ahrigate.com",
"ANTHROPIC_AUTH_TOKEN": "sk-YOUR-AHRIGATE-KEY",
"ANTHROPIC_MODEL": "claude-opus-5-5",
"ANTHROPIC_API_KEY": ""
}
}Rate limits & output
Limits apply per API key and depend on its supply group. These are defaults, not guarantees; need more? Email support@ahrigate.com.
| Group | Requests/min | Tokens/min | Concurrent |
|---|---|---|---|
official | 60 | 400K | 8 |
bedrock | 60 | 400K | 8 |
subscription (best effort) | 20 | 150K | 3 |
- Tokens per minute count uncached input (new input plus cache writes) and output. Cache reads do not count.
- When a limit is hit you get HTTP 429. Honor the retry-after header if present, otherwise back off exponentially with jitter (for example 1s, 2s, 4s, up to about 30s). Official SDKs do this automatically.
- Context window is 1M tokens on current Claude models and 200K on Claude Haiku 4.5. Max output is 128K tokens per request (64K on Haiku 4.5). See the model catalog for each model; OpenAI figures are shown only where OpenAI states them.
Supply groups
Each API key is bound to one supply group, which decides where requests are served and what they cost.
- Official: First-party vendor APIs (Anthropic, OpenAI). Most stable. 60 req/min · 400K tok/min · 8 concurrent; defaults, more on request.
- Bedrock: Routed through AWS Bedrock. 60 req/min · 400K tok/min · 8 concurrent; defaults, more on request.
- Subscription: Claude Code clients only. Lowest price. 20 req/min · 150K tok/min · 3 concurrent (best effort, shared pool); defaults, more on request.
Errors
Error responses follow OpenAI shape: { error: { message, type, code } }
| Status | Cause | Fix |
|---|---|---|
401 | Missing or invalid API key | Check your Authorization header — must be Bearer sk-... |
402 | Out of credit | Top up at /console/billing |
403 | Model not available on this key's supply group | Pick a model listed for the key's group, or create a key on another group |
429 | Rate limited | Honor retry-after if present, else back off exponentially. See Rate limits & output |
400 | Bad request — malformed JSON or missing field | Check the error.message field for specifics |
5xx | Upstream issue | Retry with backoff — check ahrigate.com/status |
Ready to start?
Create an API key in the console, pick a supply group, and make your first request.