Prerequisite: You need an AI Gateway endpoint before continuing. Create one using the dashboard quickstart or follow the manual setup guide.
Installation
Basic usage
Configure LangChain to use your AI Gateway. Which API key do I use?- Passthrough mode (default): Use your provider API key (for example,
sk-...from OpenAI) - Server-side keys configured: Use your gateway auth token, or omit if no auth is configured
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:Embeddings
Generate embeddings through the gateway:RAG applications
Build RAG applications with automatic failover:Agents
Build agents that use the gateway:Next steps
- LangChain Documentation - Full LangChain reference
- Model Selection Strategies - Configure routing
- Configuring Providers - Set up providers