API Get a key
Developers

Use Fugal from your own tools

One key, two wire formats. Every request is routed: a 0.6B model predicts which of 17 models is most likely to answer your question correctly, weighs that against price, and calls the winner. You never pick a model.

1. Get a key

Create one on the settings page. It's shown once — we store only a hash, so if you lose it you'll need to revoke and make another. Treat it like a password: anyone holding it can spend your balance.

2. Point your tool at us

Base URL: https://fugalai.com

OpenAI-compatible

Works with the OpenAI SDKs, Codex, Cursor, Aider, LiteLLM, and anything else that accepts a custom base URL.

export OPENAI_BASE_URL=https://fugalai.com/v1
export OPENAI_API_KEY=sk-fugal-...
curl https://fugalai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"fugal/auto","messages":[{"role":"user","content":"What is 15% of 240?"}]}'

Anthropic Messages

Works with the Anthropic SDKs and Claude Code.

export ANTHROPIC_BASE_URL=https://fugalai.com
export ANTHROPIC_AUTH_TOKEN=sk-fugal-...
curl https://fugalai.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"fugal/auto","max_tokens":1024,"messages":[{"role":"user","content":"What is 15% of 240?"}]}'

The key works in either Authorization: Bearer or x-api-key, so you don't have to care which header your client prefers.

Tool calling works. Your tools are forwarded to the routed model and tool calls come back in whichever format you asked in — tool_calls on the OpenAI endpoint, tool_use blocks on the Anthropic one — streaming included. Coding agents can read files, run commands and edit code.

One caveat we'd rather state than hide: the router was trained to predict which model answers a question correctly. Routing quality on tool-heavy agentic turns is not yet measured. Tools work; whether we route them well is a claim we haven't earned yet, so we're not making it.

3. What the model field does

Nothing — and that's the product. Send fugal/auto, or send whatever model name your client hardcodes; either way the router chooses. The response reports the model that actually answered, not the one you asked for, so your logs stay truthful.

List what's advertised at GET /v1/models.

4. Free tier and credit

TierLimitNotes
RouteFree, no accountPOST /v1/route — the routing decision only, no model is called. Genuinely $0.
Free answers10/day, $0.02/dayWhichever binds first. Resets at 00:00 UTC.
PaidYour credit balanceUsed only after the free allotment is spent — you're never charged while free requests remain.

Check where you stand at any time:

curl https://fugalai.com/v1/me -H "x-api-key: $ANTHROPIC_AUTH_TOKEN"

Returns your balance, today's usage, and free requests remaining.

5. Errors

CodeMeans
401Missing, unknown, or revoked key. Revocation takes effect within a minute.
402Free allotment used up and no credit — or billing is temporarily unavailable. Routing stays free either way.
429Rate limited. Wait a minute.
502 / 503Upstream model or billing unreachable. Retry.

Not supported yet

Stated plainly so you can decide before you integrate:

  • Images and other non-text content — non-text blocks are dropped from the prompt.
  • System prompts are an approximation — on the Anthropic endpoint your system field is folded into the conversation as a leading turn rather than passed as a true system role.
  • Model pinning — you can't request a specific model. Routing is the product.
  • Batch, embeddings, files, MCP — none of these exist here.

One request, one call. The router predicts each model's odds of getting your question right, picks the best odds-vs-price trade, and calls it once. There's no verifier and no retry loop — the estimate is the claim, and the numbers are public.