Home
Documentation
Try Playground
Contents
OverviewAuthenticationChat CompletionsModelsStreamingRate LimitsError Codes

Overview

Aeferalow API is an OpenAI-compatible gateway that routes requests across multiple AI providers with automatic failover, rate limiting, and usage tracking.

Base URL
https://api.aeferalow.my.id/v1
Protocol
HTTPS only
Format
JSON (application/json)
Auth
Bearer token

Authentication

All requests require an API key passed in the Authorization header as a Bearer token. API keys are prefixed with afr_.

BASH
curl https://api.aeferalow.my.id/v1/chat/completions \
  -H "Authorization: Bearer afr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
JAVASCRIPT
import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: 'afr_your_api_key',
  baseURL: 'https://api.aeferalow.my.id/v1',
})

Chat Completions

POST /v1/chat/completions — OpenAI-compatible endpoint.

Request Body

FieldTypeRequiredDescription
modelstringRequiredModel ID (see Models section)
messagesarrayRequiredArray of {role, content} objects
streambooleanOptionalEnable SSE streaming (default: false)
temperaturenumberOptional0.0–2.0, controls randomness (default: 0.7)
max_tokensintegerOptionalMax tokens to generate (default: 4096)
JAVASCRIPT
const response = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What is 2+2?' },
  ],
  temperature: 0.7,
  max_tokens: 512,
})
console.log(response.choices[0].message.content)

Models

GET /v1/models — Returns available models.

gpt-5-miniFast
Fastest response, best for simple tasks
gpt-4o-miniSmart
Best balance of speed and intelligence
gpt-5-chatPro
Most capable model for complex reasoning

Streaming

Set stream: true to receive Server-Sent Events (SSE). Compatible with all OpenAI SDKs.

JAVASCRIPT
const stream = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true,
})

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

Rate Limits

Rate limits are applied per API key. Default: 60 requests/minute. Limits are configurable by administrators per key.

HeaderDescription
X-RateLimit-LimitMax requests per window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when window resets

Error Codes

CodeMeaningSolution
400Bad RequestCheck your request body format
401UnauthorizedProvide a valid API key
403ForbiddenKey disabled or expired
429Rate Limit ExceededSlow down or upgrade your key limit
500Internal ErrorAll providers failed, retry later
503Service UnavailableCircuit breakers open, retry in 30s