Prerequisite: Complete the Quickstart to get an access key. All requests go to
https://gateway.ngrok.ai.Requirements
For any SDK or client to work with the AI Gateway, it must:- Support the OpenAI API or Anthropic Claude API format
- Allow customizing the base URL / endpoint
- Send requests with proper authorization headers (for OpenAI API,
Authorization; for Anthropic Claude API,x-api-key)
Authentication
Pass your access key (ng-xxxxx-g1-xxxxx) as the API key. The AI Gateway injects upstream provider credentials from your access key configuration.
cURL
For testing or shell scripts:HTTP request format
Any HTTP client can call the AI Gateway:Using provider prefixes
All clients support routing to specific providers using model prefixes:Supported endpoints
The AI Gateway supports these endpoints:| Endpoint | API Format | Description |
|---|---|---|
/v1/chat/completions | OpenAI | Chat completions |
/v1/completions | OpenAI | Legacy completions |
/v1/embeddings | OpenAI | Text embeddings |
/v1/models | OpenAI | List available models |
/v1/messages | Anthropic | Messages |
Next steps
- OpenAI SDK - Official Python, TypeScript, Go, Java, and .NET guide
- Vercel AI SDK - For Next.js and React applications
- LangChain - For LangChain applications
- Choose a model
- Configure fallback models