Quickstart Guide

Get up and running with AIRouter in 5 minutes

1

Register an Account

Create your AIRouter account using the API or dashboard:

curl -X POST http://localhost:3000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "password": "your-secure-password",
    "name": "Your Name",
    "orgName": "Your Organization"
  }'
2

Create an API Key

Go to the API Keys page in your dashboard and create a new key, or use the API:

curl -X POST http://localhost:3000/api/v1/auth/keys \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "name": "My First API Key",
    "permissions": ["read", "write"]
  }'

⚠️ Important: Save your API key - it won't be shown again!

3

Make Your First Request

Using cURL

curl -X POST http://localhost:3000/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-air-your-api-key" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ],
    "routingStrategy": "cost"
  }'

Using JavaScript/TypeScript

const response = await fetch('http://localhost:3000/api/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer sk-air-your-api-key',
  },
  body: JSON.stringify({
    model: 'gpt-3.5-turbo',
    messages: [
      { role: 'user', content: 'Hello, world!' }
    ],
    routingStrategy: 'cost',
    enableCache: true
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);

Using OpenAI SDK

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'http://localhost:3000/api/v1',
  apiKey: 'sk-air-your-api-key',
});

const completion = await openai.chat.completions.create({
  model: 'gpt-3.5-turbo',
  messages: [
    { role: 'user', content: 'Hello, world!' }
  ],
});

console.log(completion.choices[0].message.content);

Next Steps

You're All Set! 🎉

You're now ready to build amazing AI-powered applications with AIRouter. Start making requests and let us handle the complexity!