Quickstart

If your code already talks to OpenAI, you are one line away.

1. Get a key

Sign in and create a key in the console. The full key is shown once — store it then.

2. Point your SDK here

Set the base URL. Everything else in your code stays as it is.

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.AISELECTOR_API_KEY,
  baseURL: 'https://aiselector.net/api/v1',
});

// Streaming works the same way — the gateway speaks OpenAI SSE.
const stream = await client.chat.completions.create({
  model: 'quality',
  messages: [{ role: 'user', content: 'Explain vector databases.' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}

3. Choose a model

Pass a model id, an alias, or auto. The response reports which model and provider actually answered.

curl https://aiselector.net/api/v1/chat/completions \
  -H "Authorization: Bearer $AISELECTOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{ "role": "user", "content": "Hello" }]
  }'

Endpoints

POST/api/v1/chat/completionsChat completions, streaming supported via stream: true
GET/api/v1/modelsModel catalog with public pricing
GET/api/v1/usageYour own usage and billed amount

Errors

Errors follow the OpenAI error shape. 401 invalid key, 429 daily quota exceeded, 502 upstream provider failure.