Set up Fuse in minutes.
Fuse is a drop-in endpoint, not a client library. Point your existing OpenAI or Anthropic SDK at the gateway, authenticate with a Fuse virtual key, and every guardrail — budgets, rate limits, fallback routing, loop detection, model ACLs, DLP — applies instantly.
Quickstart
- 1Sign up and open the dashboard. Email verification keeps accounts real.
- 2Add a provider key (Dashboard → Provider Keys). Your upstream credentials are encrypted at rest with AES-256-GCM and never logged in plaintext.
- 3Mint a virtual key (Dashboard → Virtual Keys). It starts with
ash_live_and carries your budgets, rate limits, and policy attachments. - 4Swap your baseURL and use the virtual key as the API key. That's the whole migration:
- const client = new OpenAI({ baseURL: "https://api.openai.com/v1", ... });
+ const client = new OpenAI({
+ baseURL: "https://gateway.usefuse.dev/v1",
+ apiKey: process.env.FUSE_VIRTUAL_KEY, // ash_live_…
+ });Endpoints
One virtual key reaches every provider. The route you call decides where the request goes; namespaced prefixes exist so an OpenAI SDK pointed at {gateway}/deepseek/v1 just works. Unknown paths return 404.
| Route | Provider | SDK compatibility |
|---|---|---|
| /v1/chat/completions | OpenAI | OpenAI SDK |
| /v1/responses | OpenAI | Codex / Responses API |
| /v1/messages | Anthropic | Anthropic SDK |
| /deepseek/v1/chat/completions | DeepSeek | OpenAI SDK |
| /xai/v1/chat/completions | xAI | OpenAI SDK |
| /gemini/v1/chat/completions | Gemini | OpenAI SDK |
| /api/v1/chat/completions | OpenRouter | OpenAI SDK |
Provider setup
Authenticate to Fuse with your virtual key in the Authorization header — never your raw provider key. Anthropic requests should carry their usual anthropic-version header; it is forwarded upstream.
OpenAI — SDK
const client = new OpenAI({
baseURL: "https://gateway.usefuse.dev/v1",
apiKey: process.env.FUSE_VIRTUAL_KEY, // ash_live_…
});
const res = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});Anthropic — SDK
const client = new Anthropic({
baseURL: "https://gateway.usefuse.dev",
apiKey: process.env.FUSE_VIRTUAL_KEY, // ash_live_…
});
const res = await client.messages.create({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});OpenAI — curl
curl https://gateway.usefuse.dev/v1/chat/completions \
-H "Authorization: Bearer $FUSE_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'
# streaming: add "stream": true — SSE is piped through untouchedAnthropic — curl
curl https://gateway.usefuse.dev/v1/messages \
-H "Authorization: Bearer $FUSE_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{"model":"claude-sonnet-4-5","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'DeepSeek / xAI / Gemini
Same OpenAI-compatible body, namespaced route. Point an OpenAI SDK at the prefixed baseURL or call the path directly:
curl https://gateway.usefuse.dev/deepseek/v1/chat/completions \
-H "Authorization: Bearer $FUSE_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-chat","messages":[{"role":"user","content":"Hello"}]}'
# also available: /xai/v1/chat/completions · /gemini/v1/chat/completions
# bare /chat/completions after the prefix works too: /deepseek/chat/completionsOpenRouter
curl https://gateway.usefuse.dev/api/v1/chat/completions \
-H "Authorization: Bearer $FUSE_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Hello"}]}'Use Fuse with AI coding agents
Coding agents speak the OpenAI or Anthropic protocols, so they work with Fuse unchanged — point them at the gateway with your virtual key and every agent session gets budgets, rate limits, fallback routing, model ACLs, and DLP. Set the key in an environment variable and never paste it into a committed config file.
Claude Code
Claude Code sends Bearer auth to ANTHROPIC_BASE_URL, which is exactly what Fuse's Anthropic route expects. Use ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY — that sends an x-api-key header). Claude Code forks work the same way.
export ANTHROPIC_BASE_URL="https://gateway.usefuse.dev"
export ANTHROPIC_AUTH_TOKEN="ash_live_…" # Fuse virtual key
claude- Persistence: To save permanently, add these environment variables to the
envblock of~/.claude/settings.json— never in a project-level settings file that gets committed. - Provider key: Ensure your virtual key has an Anthropic provider key attached in the dashboard.
OpenAI Codex CLI
Codex reads ~/.codex/config.toml. Codex speaks the OpenAI Responses API by default — Fuse proxies /v1/responses natively, so no wire_api override is needed.
model_provider = "fuse"
model = "gpt-4o"
[model_providers.fuse]
name = "Fuse"
base_url = "https://gateway.usefuse.dev/v1"
env_key = "FUSE_VIRTUAL_KEY"Export your virtual key in your terminal:
export FUSE_VIRTUAL_KEY="ash_live_…"
codex- Config placement: Place
model_providerandmodelat the top of~/.codex/config.tomlbefore any table headers ([...]); otherwise Codex ignores the provider setting. - OAuth session conflict: If Codex returns an upstream 401 error, it may still be logged into a ChatGPT account — run
codex logoutso it falls back to your configuredenv_key. - Environment scope: The environment variable must be set in the shell session that launches Codex. If a background daemon is running, terminate it and relaunch from a fresh shell to pick up new keys.
- Key validation: An error like
401 invalid_keymeans the virtual key was not found or was revoked. Confirm your key exists in Dashboard → Virtual Keys.
Antigravity CLI (agy)
Antigravity CLI speaks Google's Cloud Code protocol natively, but version 1.2.15+ supports an enterprise-gateway mode using the OpenAI Chat Completions protocol — exactly what Fuse serves on the /gemini/v1 route. Configure it via environment variables:
export AGY_LLM_GATEWAY_URL="https://gateway.usefuse.dev/gemini/v1"
export AGY_LLM_GATEWAY_API_KEY="ash_live_…" # Fuse virtual key
export AGY_LLM_GATEWAY_WIRE_PROTOCOL="openai"
export AGY_LLM_GATEWAY_MODELS="gemini-2.5-flash,gemini-1.5-pro"
agy -p "Explain binary search in Go" # runs through Fuse gateway- Provider key: The virtual key must have a Gemini provider key attached (Dashboard → Provider Keys) — Fuse routes by path, so
/gemini/v1always forwards to Google Gemini. - Path resolution: Fuse serves Gemini on both
/gemini/v1/chat/completionsand/gemini/chat/completions. If your client version appends/v1/chat/completionsautomatically, setAGY_LLM_GATEWAY_URL="$https://gateway.usefuse.dev/gemini". - Model selection:
AGY_LLM_GATEWAY_MODELSdefines the comma-separated list populated in agy's interactive model picker. - Process reload: Set variables in a fresh terminal session before invoking
agy.
OpenCode
Add Fuse as a custom OpenAI-compatible provider in opencode.json. The {env:…} syntax references your shell variable so API tokens are never saved into repository files.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"fuse": {
"npm": "@ai-sdk/openai-compatible",
"name": "Fuse",
"options": {
"baseURL": "https://gateway.usefuse.dev/api/v1",
"apiKey": "{env:FUSE_VIRTUAL_KEY}"
},
"models": {
"anthropic/claude-3.5-sonnet": { "name": "Claude 3.5 Sonnet" },
"openai/gpt-4o": { "name": "GPT-4o" }
}
}
},
"model": "fuse/anthropic/claude-3.5-sonnet"
}Export your virtual key before starting OpenCode:
export FUSE_VIRTUAL_KEY="ash_live_…"
opencode- Base URL structure:
baseURLmust end at/api/v1— OpenCode automatically appends/chat/completions. - OpenRouter upstream: When using OpenRouter routes (
/api/v1), ensure your virtual key is linked to an OpenRouter credential in Dashboard → Provider Keys. - Model IDs: Use standard model identifiers (e.g.
anthropic/claude-3.5-sonnetoropenai/gpt-4o) matching the upstream provider catalog.
Anything else (Cursor, aider, …)
Any tool with a custom OpenAI endpoint setting works the same way:
| Tool | Setting |
|---|---|
| Cursor | Models → OpenAI API Key → Override Base URL: https://gateway.usefuse.dev/v1 |
| aider | export OPENAI_API_BASE=https://gateway.usefuse.dev/v1 + OPENAI_API_KEY |
| Any OpenAI SDK | baseURL: https://gateway.usefuse.dev/v1, virtual key as the API key |
Want a specific agent routed through Anthropic models instead? Point it at the Anthropic-compatible surface ( https://gateway.usefuse.dev/v1/messages with Bearer auth) or use a namespaced prefix like https://gateway.usefuse.dev/deepseek/v1.
Guardrails & routing behavior
Technical reference for how Fuse inspects, gates, and routes traffic at the edge before sending requests upstream.
Spend is tracked atomically per virtual key in distributed Redis cache. At 80% of your budget cap, an automated alert email is triggered. At 100%, Fuse returns 429 budget_exceeded pre-flight — zero upstream spend is incurred. Sliding-window requests-per-minute (RPM) limits enforce fair usage per key.
When upstream providers return 429, 5xx, or timeout, Fuse walks your fallback chain (e.g. Claude Sonnet → GPT-4o → DeepSeek-V3). Client errors (4xx) terminate immediately without wasting retries. All fallback responses carry the x-fuse-fallback-model header so you always know which model answered.
Fuse maintains SHA-256 fingerprints of consecutive tool-call outputs across a sliding 120-second window. If an autonomous agent (like Claude Code or Codex) becomes stuck in a recursive loop firing identical calls, Fuse intercepts the stream and returns 429 loop_detected before your budget is burned.
Attach guardrail policies to restrict which models or providers a virtual key can invoke. Calling a blocked model immediately aborts with 403 model_access_denied before touching any provider API. Fallback chains automatically drop blocked models as inert targets.
Scans the newest user message at the network perimeter for system credentials (AWS keys, GitHub tokens, Slack tokens, private PEM keys, DB connection strings) and PII (credit cards with Luhn validation, SSNs, emails, IPs), plus custom user regexes. Supports Redact (default in-place substitution), Block (422 sensitive_data_blocked), or Log only. Scanners are built to fail open: scanner errors will never disrupt production traffic.
Server-Sent Events (SSE) streaming responses are piped byte-for-byte to your client without buffering delay (<15ms edge overhead). Token counting and estimated cost calculations are synced asynchronously in the background via ctx.waitUntil(), logging to your dashboard in real time.
Error reference
Fuse returns machine-readable error codes so your retry logic can react precisely instead of string-matching messages.
| Status | Error code | Meaning |
|---|---|---|
| 401 | invalid_key | Virtual key not found, revoked, or missing/invalid bearer token. |
| 403 | model_access_denied | A guardrail policy blocked this model or provider for the key. |
| 404 | not_found | Unknown route or unsupported path — check the endpoint table above. |
| 422 | sensitive_data_blocked | DLP action is set to block and the newest user message matched a rule. |
| 429 | budget_exceeded | Virtual key hit its hard spend cap; rejected before any upstream call. |
| 429 | rate_limit_exceeded | Per-key requests-per-minute limit exceeded. |
| 429 | loop_detected | Repeated identical tool-call results over a 120-second window. |
| 502 | upstream_unavailable | Every target in the fallback chain failed. Safe to retry with backoff. |
Response headers worth watching: x-fuse-fallback-model names the backup model that answered when failover or auto-downgrade occurs (omitted when the primary model serves the request), and x-fuse-quota is stamped with overage when your monthly request volume exceeds your plan allowance.