Skip to main content
Prerequisite: Complete the Quickstart to create an access key on app.ngrok.ai.
The AI Gateway works with official and third-party SDKs. Point the base URL at https://gateway.ngrok.ai and use your access key.

Supported SDKs

OpenAI SDK

Official SDKs for Python, TypeScript, Go, Java, and .NET

Anthropic SDK

Official SDKs for Python, TypeScript, Java, Go, Ruby, C#, and PHP

Vercel AI SDK

Build AI apps with React, Next.js, and streaming

TanStack AI

Type-safe AI library for React and Solid

LangChain

Framework for chains, agents, and RAG

Other SDKs

cURL, HTTP clients

Quick start

The pattern is the same for any SDK—set the gateway URL and your access key.
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.ngrok.ai/v1",
    api_key="ng-xxxxx-g1-xxxxx"  # Your access key
)

What works through the gateway

FeatureSupported
Chat Completions API
Messages API✅ (Anthropic SDKs)
Responses API
Streaming
Function/tool calling
Async clients

Gateway benefits

Routing your SDK through the gateway gives you:
  • Automatic failover that retries with the next key or model on failure.
  • Provider switching by changing the model, with no integration code changes.
  • One access key for multiple upstream providers.

Using different providers

Use model prefixes or catalog names:
client.chat.completions.create(model="gpt-4o", ...)  # OpenAI
client.chat.completions.create(model="claude-opus-4-6", ...)  # Anthropic
client.chat.completions.create(model="openai:gpt-4o", ...)  # Explicit provider

Next steps