Developer API docs

1,000+ AI models. Top up with bKash, Nagad or card. Prepaid, no surprises.

Quick start

  1. Sign in at allaizone.com/developers with your email (we send a 6-digit code).
  2. Top up your balance with bKash, Nagad, Rocket, Upay, a card or internet banking (taka), or a card in US dollars.
  3. Create an API key and keep it secret. Use it like an OpenAI key with the base URL below.

Base URL: https://allaizone.com/v1

curl

curl https://allaizone.com/v1/chat/completions \
  -H "Authorization: Bearer $ALLAIZONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [{"role": "user", "content": "Write a haiku about the Padma river."}],
    "max_tokens": 300
  }'

Node.js

// npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://allaizone.com/v1",
  apiKey: process.env.ALLAIZONE_API_KEY,
});

const r = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-4",
  messages: [{ role: "user", content: "Explain bKash in one sentence." }],
  max_tokens: 300,
});
console.log(r.choices[0].message.content);

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(base_url="https://allaizone.com/v1", api_key=os.environ["ALLAIZONE_API_KEY"])

r = client.chat.completions.create(
    model="google/gemini-2.5-flash",
    messages=[{"role": "user", "content": "Translate 'good morning' into Bangla."}],
    max_tokens=200,
)
print(r.choices[0].message.content)

Authentication

Send your key in the Authorization header: Bearer az-... Keys are shown once when you create them; we store only a hash. Revoke a key at any time from the dashboard. Each key can have its own spending limit.

Models

GET /v1/models returns the live list of models with our prices (USD per token, plus per-million prices in USD and BDT). Use the model id exactly as listed, for example openai/gpt-4o-mini or anthropic/claude-sonnet-4.

curl https://allaizone.com/v1/models

Chat completions

POST /v1/chat/completions accepts the OpenAI request body (model, messages, max_tokens, temperature, tools, response_format and so on). The response is in the OpenAI format. Every response carries these headers:

HeaderMeaning
x-az-chargedAmount charged for this request, in your account currency.
x-az-balanceYour balance after this request.
x-az-currencyBDT or USD.
x-az-modelThe model that answered (useful with fallback).

Streaming

Set "stream": true to receive server-sent events exactly like OpenAI. The final event includes token usage. If you stop reading early, you pay only for what was generated.

const stream = await client.chat.completions.create({
  model: "openai/gpt-4o-mini",
  messages: [{ role: "user", content: "Tell me a short story." }],
  stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content || "");

Fallback models

Add a "models" array (or the header x-fallback-models: a,b) with up to 3 backup models. If the first model fails with a server error, a rate limit or a timeout, we try the next one automatically. You are charged only for the model that answered.

{
  "model": "anthropic/claude-sonnet-4",
  "models": ["openai/gpt-4o-mini", "google/gemini-2.5-flash"],
  "messages": [{"role": "user", "content": "Hello"}]
}

Pricing

You pay the provider's price per token plus a {margin}% platform margin. Taka accounts are charged in BDT at 1 USD = {rate} BDT. Exact prices for every model are in GET /v1/models.

Top-ups are credited 1:1 in the currency you pay (minimum Tk 500 or $5). Your first top-up fixes your account currency.

Prepaid rules

  • Before each request we reserve its maximum cost: (estimated prompt tokens + max_tokens, or 4096 if not set) x price x (1 + margin).
  • If your balance cannot cover the reservation, the request is refused with HTTP 402 and nothing is charged. Set a lower max_tokens to need a smaller reservation.
  • After the answer we charge the real cost from the token usage and return the rest immediately.
  • Your balance never goes below zero and you are never billed later. Balances do not expire. Refunds are only for payment errors (see the refund policy).

Errors

Errors use the OpenAI format: {"error": {"message", "type", "code"}}.

StatusTypeMeaning
401invalid_api_keyThe key is missing, wrong or revoked.
402insufficient_balanceYour balance is too low for this request. Top up at allaizone.com/developers.
402spending_limit_reachedThis key reached the spending limit you set.
404model_not_foundThe model id is not in GET /v1/models.
429rate_limit_exceededMore than {rpm} requests per minute on one key. Wait for the Retry-After seconds.
502upstream_errorThe model provider failed (after trying your fallback models). You are not charged.

Bring your own key

Save your own OpenAI, Anthropic, Google or OpenRouter key in the dashboard. Requests for that provider then go out with your key, and we charge only a small platform fee per request. Keys are encrypted with AES-GCM and never shown again.