Complete the Quickstart to get an access key.
All requests go to
https://gateway.ngrok.ai.Installation
Basic usage
Configure LangChain to use your AI Gateway. Pass your access key (ng-xxxxx-g1-xxxxx) as the API key—the AI Gateway injects upstream provider credentials from your access key configuration.
Streaming
Stream responses for real-time output:Using different providers
Route to different providers with model prefixes:Chains
Build chains that route through the gateway:RAG applications
Build RAG applications with automatic failover. This example creates embeddings with OpenAI directly. The gateway also serves/v1/embeddings, and the model catalog lists the embedding models it supports.
Agents
Build agents that use the gateway:Next steps
- LangChain Documentation - Full LangChain reference
- Choose a model: Model IDs and provider prefixes
- Configure fallback models: Try another model when the first one fails
- Choose how to reach providers: Credits, provider keys, and self-run models