ai-gateway
Browse all articles, tutorials, and guides about ai-gateway
Posts
Swapping Across 25 Models With One Line
Choosing a model is usually a commitment: an SDK, a key, an integration. Through the gateway it is a string, so you can shop the whole catalog per task. And the catalog spans a 100x price range, which turns model choice into your biggest cost lever. Here is the swap, the price spread, and a real multi-model run.
Per-Branch AI Endpoints: Isolating Model Spend Across Prod, Preview, and CI
When previews, CI, and production all call models with the same key, you cannot tell what a preview cost or notice a runaway test until the invoice. Because a Neon branch is its own deployment with a usage ledger that lives in the branch's Postgres, model spend is attributed and isolated per environment. I proved it: a CI branch spent tokens while production stayed flat.
Model Fallback and Routing Without a Provider SDK Each
Models have outages, rate limits, and bad minutes. A resilient app falls back to another one, but building that across providers normally means a different SDK and error shape for each. Through one OpenAI-compatible gateway, fallback is a loop over model names. Here it is, tested against a real failure.
One Key for Claude, GPT, and Gemini: the Gateway Pattern
Using three model providers usually means three API keys, three SDKs, and three billing relationships sprayed across your code. An AI gateway collapses that to one credential and one OpenAI-compatible endpoint. I proved it on a Neon Function: the same call answered by GPT, Claude, and Gemini.