Documentation

AzveraRouter API - OpenAI Compatible AI Router

Powerful AI routing API with OpenAI-compatible endpoints. Integrate your applications in minutes.

Base URL http://localhost:2555
Version v1.0.0

Getting Started

Welcome to AzveraRouter API! This documentation will help you integrate our AI routing service into your application.

Quick Start

  1. 1
    Create an account

    Sign up at /auth/register to get started

  2. 2
    Generate API Key

    Go to API Keys section and create a new key

  3. 3
    Make your first request

    Use your API key to call any endpoint (see examples below)

Authentication

AzveraRouter supports two authentication methods depending on the endpoint.

API Key Authentication

Include your API key in the Authorization header for API endpoints.

Authorization: Bearer YOUR_API_KEY

Session Authentication

For web dashboard endpoints, authentication is handled via session cookies after login.

Cookie: connect.sid=xxx

Chat Completions

1 endpoints available

POST
/v1/chat/completions

Create chat completion using AI models

API Key atau Session
Headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_API_KEY"
}
Request Body
{
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1000
}
Response
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello there!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}
curl https://api.azverarouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-xxx" \
  -d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello!"}]}'
const res = await fetch('https://api.azverarouter.com/v1/chat/completions', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk-xxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({ model: 'gpt-4', messages: [{ role: 'user', content: 'Hello!' }] })
});
import openai
openai.api_key = 'sk-xxx'
response = openai.ChatCompletion.create(
    model='gpt-4',
    messages=[{'role': 'user', 'content': 'Hello!'}]
)

Text Completions

1 endpoints available

POST
/v1/completions

Create text completion using AI models

API Key atau Session
Request Body
{
  "prompt": "Once upon a time,",
  "max_tokens": 50
}
curl https://api.azverarouter.com/v1/completions \
  -H "Authorization: Bearer sk-xxx" \
  -d '{"prompt": "Once upon a time", "max_tokens": 50}'
const res = await fetch('https://api.azverarouter.com/v1/completions', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk-xxx' },
  body: JSON.stringify({ prompt: 'Once upon a time' })
});
import openai
openai.api_key = 'sk-xxx'
response = openai.Completion.create(model='text-davinci-003', prompt='Once upon a time')

Image Generation

1 endpoints available

POST
/v1/images/generations

Generate images using AI models

API Key atau Session
Request Body
{
  "prompt": "A cat on the moon",
  "n": 1,
  "size": "1024x1024"
}
curl https://api.azverarouter.com/v1/images/generations \
  -H "Authorization: Bearer sk-xxx" \
  -d '{"prompt": "A cat on the moon"}'
const res = await fetch('https://api.azverarouter.com/v1/images/generations', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk-xxx' },
  body: JSON.stringify({ prompt: 'A cat on the moon' })
});
import openai
openai.api_key = 'sk-xxx'
response = openai.Image.create(prompt='A cat on the moon')

API Keys Management

3 endpoints available

GET
/api-keys

List all your API keys

Session Cookie
POST
/api-keys

Create a new API key

Session Cookie
Request Body
{
  "name": "My New Key"
}
DELETE
/api-keys/:id

Delete an API key

Session Cookie

Authentication

3 endpoints available

POST
/login

Login and create session

Request Body
{
  "email": "user@example.com",
  "password": "password"
}
POST
/register

Register new account

Request Body
{
  "name": "John",
  "username": "john",
  "email": "john@example.com",
  "password": "password"
}
GET
/logout

Logout and destroy session