Free & open source · MIT licensed

One endpoint.
Eight providers.
Failover built in.

An OpenAI-compatible LLM gateway with automatic fallback routing and rate limiting. Bring your own keys. No signup, no markup, no stored prompts.

GitHub starsgw_live_…GATEWAYroute · limit · retryOpenAIAnthropicGeminiGroqMistralTogetherDeepSeekOpenRouter
live behavior

Watch a failover happen

OpenAI rate-limited this request. Nobody noticed.

features

Infrastructure your LLM calls deserve

Everything between your app and the model APIs, handled.

Automatic fallback

A provider returns 429 or 500? The gateway fails over to the next provider in your chain before a single token streams back.

Rate limiting

Per-key sliding-window limits you control. Protect your budget from runaway loops and abusive clients.

Eight providers

OpenAI, Anthropic, Gemini, Groq, Mistral, Together, DeepSeek, OpenRouter — one endpoint, one key.

Drop-in compatible

OpenAI SDK and Anthropic SDK compatible. Change the baseURL and the key. That is the whole migration.

Zero retention

Your prompts and responses pass through and are gone. We store encrypted keys and counters — never content.

No signup

No account, no email, no sales call. Paste keys, get a gateway key, ship.

providers

Route across all of them

Mix any providers you have keys for. Order them however you like.

OpenAIAnthropicGoogle GeminiGroqMistralTogetherDeepSeekOpenRouter
open source

Free forever, yours to run

The code is public, the hosted instance is free, and you can run your own. Pick whichever works for you.

MIT licensed

Use it, fork it, host it, build a business on it. No strings.

Self-host in one click

Deploy your own instance to Vercel with the button in the README. Bring your own Upstash Redis (free tier). Your keys, your infra.

Or use the free hosted instance

No signup, BYOK, nothing to pay us. The public instance is the same code you see on GitHub.

how it works

Shipping in three steps

No account. The gateway key is the account.

Paste your provider keys

Any subset of the 8 providers. Each key is validated live, encrypted with AES-256-GCM, and never shown again.

Order your fallback chain

Decide who answers first and who catches the failure. Set your rate limit. Get one gw_live_ key.

Change two lines of code

Point baseURL at gatewayforai.com/v1, use your gateway key, set model to "auto". Done.

faq

Fair questions

The things you should ask anyone proxying your API keys.

Is my OpenAI/Anthropic key safe?

Keys are encrypted with AES-256-GCM before they touch storage and are only decrypted in-memory to call the provider you chose. They are never logged, never shown again, and you can rotate or delete your config at any time.

Do you store my prompts?

No. Requests and responses stream through the gateway and are not persisted. We keep aggregate counters (request counts per day) so you can see usage — never content.

What happens when a provider goes down?

If your model is "auto", the gateway retries the next provider in your fallback chain on 429s, 5xx errors and timeouts — up to 3 hops. You get a x-gateway-fallback-count header telling you it happened.

Does streaming work?

Yes. SSE streaming passes straight through, including for Anthropic models (translated to OpenAI chunk format on the fly).

Is it free — and who pays?

The gateway is free to use. You bring your own provider API keys (BYOK) and pay your providers directly — we never touch your billing. GatewayforAI is built and operated by an independent developer; BYOK keeps operating costs near zero, so there is nothing to charge you. The entire codebase is open source (MIT) on GitHub. Self-host it and it is free in every sense: your infrastructure, your keys, your data.

I lost my gateway key.

Keys cannot be recovered (we only store a hash). Create a new config at /start — it takes 30 seconds.

What happens if someone steals my gateway key?

They can make requests through your configured providers (spending your provider credits) until you act — they can never read your raw provider keys, which are encrypted and never returned by any endpoint. Rotate or delete the config at /manage the moment you suspect a leak.

Does fallback work mid-stream?

Fallback triggers on errors and timeouts before the first token — a provider that accepts the request but never produces output (a stream that dies at birth) fails over to the next provider automatically. Once output starts, the stream is committed and passes through; a connection that dies mid-stream is not retried (yet).

Can I self-host it?

Absolutely — that's the point. One-click deploy to Vercel plus a free Upstash Redis database and you have your own private gateway. The hosted instance runs the exact same open-source code. See the README on GitHub for the deploy button and setup.