ngrok AI Gateway (ngrok.ai) is a single endpoint that routes your app's requests to OpenAI, Anthropic, and self-hosted models like Ollama or vLLM, with built-in failover and no separate provider signup required. You create an access key, point your existing OpenAI SDK at gateway.ngrok.ai, and swap models by changing a string instead of rewiring your app.
Short answer: ngrok AI Gateway is a unified API endpoint that routes requests to OpenAI, Anthropic, or your own self-hosted models through one access key. Sign in at app.ngrok.ai, add at least $5 in credit, create an access key, and point your SDK's base URL at
https://gateway.ngrok.ai/v1. New accounts get $1 in starter credit; ngrok charges a $0.05-per-million-token processing fee on top of provider costs when you use its built-in keys.

I set this up against a small Node script that was already calling the OpenAI SDK directly, mostly to see how much of the app I'd have to rewrite. In my testing, the answer was almost none — the whole migration was swapping the baseURL and API key, and requests started flowing through ngrok's gateway within about ten minutes, credit purchase included. Here's the real setup path, what it costs, and where I got tripped up.
What you'll need
An ngrok account is the only hard requirement, and the AI Gateway sits on top of it — you don't need a separate signup. You'll need a credit card to fund the account, since ngrok AI Gateway runs on prepaid credits rather than a monthly plan; the dashboard prompts you to top up at least $5.00 before your first real request, though new accounts start with $1 already loaded. You'll also want a project that already calls an OpenAI- or Anthropic-compatible SDK, since that's what makes the swap fast — if you're starting from zero, the official quickstart at ngrok.com/docs/ai-gateway/quickstart walks through installing the OpenAI SDK first. No API keys from OpenAI or Anthropic are required for their built-in, ngrok-billed models.
Step-by-step: ngrok AI Gateway
1. Sign in at app.ngrok.ai
Go to app.ngrok.ai and sign in with your existing ngrok credentials, or create a free ngrok account if you don't have one. This is a separate dashboard from ngrok's tunneling product, even though it shares your login.
2. Add credit to your account
Open the Credits page and top up at least $5.00. Every request against ngrok's built-in OpenAI or Anthropic access consumes credit, covering both the provider's cost and ngrok's processing fee. New accounts start with $1 in credit automatically, according to ngrok’s own blog post on the change — enough to send a handful of test requests before you need to add real money.
3. Create an access key
Go to the Keys section, click New access key, give it a name, and optionally attach a configuration if you want to restrict which providers or models it can call. Copy the token immediately — it starts with ng- and is shown exactly once. Losing it means generating a new one.
4. Point your SDK at the gateway
If your app already uses the OpenAI SDK, change only the baseURL and apiKey:
“js import OpenAI from "openai"; const openai = new OpenAI({ baseURL: "https://gateway.ngrok.ai/v1", apiKey: "ng-xxxxx-g1-xxxxx" }); const res = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: "Hello, world!" }] }); “
For Anthropic-style requests, use https://gateway.ngrok.ai as the base instead. In my testing, this was the entire migration — no new SDK, no separate provider account, and the response shape matched what the app already expected.
5. Confirm the request billed correctly
Check the Credits page after your first call and confirm the balance dropped by a small amount, not by a surprising one. This catches the two most common setup mistakes early: an access key scoped to the wrong provider, or a request accidentally routed to a more expensive model than you meant to test.
6. Add a bring-your-own-key provider (optional)
If you want to use a provider ngrok doesn't bill for directly, like Groq, the pattern is the same everywhere: sign up with that provider, generate their API key, register it in ngrok's provider key settings, then create an access key configuration with a routing rule for that provider and assign it to your key. Bring-your-own-key usage skips ngrok's processing fee entirely — you're charged only by the upstream provider.
7. Point it at a local model (optional)
For Ollama, vLLM, or LM Studio running on your own machine or network, the gateway can route to them the same way it routes to cloud providers, which is useful if you want one consistent endpoint across local and hosted models without changing application code when you switch between them.
Example prompts you can copy
These aren't chat prompts so much as request payloads — what you'd actually send once the gateway is wired up:
{"model": "gpt-4o", "messages": [{"role": "user", "content": "Summarize this error log in three bullet points."}]}{"model": "claude-opus-4-6", "messages": [{"role": "user", "content": "Review this function for edge cases I might have missed."}]}{"model": "meta-llama/llama-3.3-70b-versatile", "messages": [{"role": "user", "content": "Rewrite this changelog entry for a non-technical reader."}]}(Groq, via BYOK)
Test with a cheap or small model first — the request shape is identical across providers, so once it works on one model, switching to a bigger one for production traffic is a one-line change.
Common mistakes to avoid
The mistake I made first: assuming the AI Gateway API key (used to manage resources via api.ngrok.ai) and the access key (used to authenticate actual model requests) were the same credential — they aren't, and mixing them up gets you a 401 with no obvious explanation. Second, forgetting that credits are prepaid with no grace period; when the balance hits zero, requests fail immediately, so don't wire this into anything time-sensitive without a balance alert. Third, assuming every "built-in" provider is billed through ngrok — Groq is listed as built-in but still requires your own provider key, since ngrok doesn't run inference for it. Fourth, not scoping access key configurations, which means a leaked key can call any provider on the account instead of just the one you intended. Fifth, testing against a full-size model like GPT-4o by default instead of a cheaper one, which burns through the $1 starter credit faster than expected.
ngrok AI Gateway at a glance
| Detail | |
|---|---|
| Base URL | https://gateway.ngrok.ai/v1 (OpenAI-compatible) or https://gateway.ngrok.ai (Anthropic) |
| Pricing model | Prepaid credits, no subscription required |
| Starter credit | $1 for new accounts |
| Minimum top-up | $5.00 |
| Processing fee | $0.05 per million tokens (ngrok-managed keys only) |
| BYOK cost | Free — provider charges apply directly, no ngrok fee |
| Built-in providers | OpenAI, Anthropic |
| BYOK / local providers | Groq, Ollama, vLLM, LM Studio, and others |
I confirmed these figures directly on ngrok’s AI Gateway documentation and ngrok’s blog post on free-plan credit access on August 5, 2026. Credit pricing and supported providers in this category shift often, so check the live docs before you budget around these numbers.
Tools that make this easier
If you're new to routing AI calls through your own code rather than a chat window, my AI coding assistant guide is a good primer on the broader category before you add a gateway layer on top. For picking the editor or agent that'll actually send these requests, best AI tool for code compares the leading options on real tasks, and how to use Cursor for beginners covers one of the more agent-heavy picks. If you're working from OpenAI's or Anthropic's own tooling instead of a third-party editor, how to use ChatGPT Codex and how to use Claude AI cover those directly. And if you're deciding between an editor-native assistant and something closer to raw API access, my Cursor vs Copilot comparison is a useful reference point for how much abstraction you actually want.
My take
The real value here isn't any single feature — it's not having to hold separate OpenAI and Anthropic accounts, plus their billing and rate limits, just to try both providers in the same app. Prepaid credits with no grace period are the part I'd flag before you rely on this for anything customer-facing; a zeroed-out balance fails closed, with no retry window. For prototyping across providers and local models with one consistent endpoint, it did exactly what it claimed, and the $0.05-per-million-token fee is small enough not to think about at the volumes I tested.
Frequently Asked Questions
Is ngrok AI Gateway free to use?
Not entirely, but it's close for testing. New accounts get $1 in starter credit, and bring-your-own-key usage never carries ngrok's processing fee — you only pay the upstream provider. Using ngrok's built-in OpenAI or Anthropic access requires a minimum $5.00 credit top-up plus a $0.05-per-million-token processing fee.
How long does it take to set up ngrok AI Gateway?
About ten minutes if you already have a project calling the OpenAI SDK: sign in, add credit, generate an access key, and change your base URL. Adding a bring-your-own-key provider or a local model takes a few minutes longer since you're registering an extra key and a routing rule.
What is the easiest way to use ngrok AI Gateway?
Start with a built-in provider like OpenAI on a cheap model to confirm billing works, then move to the model or provider you actually need. Keep access keys scoped to a specific configuration rather than leaving them open to every provider on the account.
Does ngrok AI Gateway require an OpenAI or Anthropic account?
No, not for their built-in models — ngrok handles billing and authentication for OpenAI and Anthropic access directly through its own credits. You only need your own provider account for bring-your-own-key providers, like Groq, or for self-hosted models.
What happens when my ngrok AI Gateway credits run out?
Requests fail immediately once the balance hits zero, with no grace period or retroactive billing. You need to purchase more credits from the dashboard before the gateway will accept new requests again.