Aeferalow API is an OpenAI-compatible gateway that routes requests across multiple AI providers with automatic failover, rate limiting, and usage tracking.
https://api.aeferalow.my.id/v1HTTPS onlyJSON (application/json)Bearer tokenAll requests require an API key passed in the Authorization header as a Bearer token. API keys are prefixed with afr_.
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"}]}'import OpenAI from 'openai'
const client = new OpenAI({
apiKey: 'afr_your_api_key',
baseURL: 'https://api.aeferalow.my.id/v1',
})
POST /v1/chat/completions — OpenAI-compatible endpoint.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID (see Models section) |
messages | array | Required | Array of {role, content} objects |
stream | boolean | Optional | Enable SSE streaming (default: false) |
temperature | number | Optional | 0.0–2.0, controls randomness (default: 0.7) |
max_tokens | integer | Optional | Max tokens to generate (default: 4096) |
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)GET /v1/models — Returns available models.
gpt-5-miniFastgpt-4o-miniSmartgpt-5-chatProSet stream: true to receive Server-Sent Events (SSE). Compatible with all OpenAI SDKs.
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 are applied per API key. Default: 60 requests/minute. Limits are configurable by administrators per key.
| Header | Description |
|---|---|
X-RateLimit-Limit | Max requests per window |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when window resets |
| Code | Meaning | Solution |
|---|---|---|
| 400 | Bad Request | Check your request body format |
| 401 | Unauthorized | Provide a valid API key |
| 403 | Forbidden | Key disabled or expired |
| 429 | Rate Limit Exceeded | Slow down or upgrade your key limit |
| 500 | Internal Error | All providers failed, retry later |
| 503 | Service Unavailable | Circuit breakers open, retry in 30s |