AzveraRouter API - OpenAI Compatible AI Router
Powerful AI routing API with OpenAI-compatible endpoints. Integrate your applications in minutes.
Getting Started
Welcome to AzveraRouter API! This documentation will help you integrate our AI routing service into your application.
Quick Start
-
1
Create an account
Sign up at /auth/register to get started
-
2
Generate API Key
Go to API Keys section and create a new key
-
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
Create chat completion using AI models
{
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"temperature": 0.7,
"max_tokens": 1000
}
{
"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
Create text completion using AI models
{
"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
Generate images using AI models
{
"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
List all your API keys
Create a new API key
{
"name": "My New Key"
}
Delete an API key
Authentication
3 endpoints available
Login and create session
{
"email": "user@example.com",
"password": "password"
}
Register new account
{
"name": "John",
"username": "john",
"email": "john@example.com",
"password": "password"
}
Logout and destroy session