Documentation
Everything you need to build with the AI Gateway API. From quick starts to detailed API references.
Getting Started
Learn the basics and make your first API call.
- Introduction
- Authentication
- Your First Request
API Reference
Complete API documentation for all endpoints.
- Chat Completions
- Models List
- Streaming
- Error Handling
API Keys
Manage and secure your API keys.
- Creating Keys
- Key Permissions
- Rate Limiting
- Rotating Keys
Models
Explore available models and their capabilities.
- Text Models
- Multimodal Models
- Model Pricing
- Model Comparison
Security
Security best practices and compliance.
- Authentication
- Data Privacy
- Compliance
- Best Practices
Guides
Step-by-step tutorials and use cases.
- Building a Chatbot
- Content Generation
- Code Assistant
- Embeddings
Quick Start
quickstart.js
import OpenAI from "openai";
// Initialize the client with our API endpoint
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: "https://api.aigateway.com/v1",
});
// Make a chat completion request
async function chat() {
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello, world!" },
],
});
console.log(response.choices[0].message.content);
}
chat();