I am Zero API
Về chatBack to chat

Tài liệu APIAPI documentation

Cổng LLM tương thích OpenAI, chạy trên Cloudflare Workers ở mức hoàn toàn miễn phí. Không cần đăng ký, không cần API key — gửi request là dùng được. Trỏ SDK OpenAI sẵn có vào đây là chạy. An OpenAI-compatible LLM gateway running on Cloudflare Workers at zero cost. No signup, no API key — just send a request. Point any existing OpenAI SDK at it and it works.

Free tier & API keyFree tier & API keys

Base URL: https://api.iamzero.app/v1. Gọi mà không gửi header Authorization thì bạn đang ở free tier. Gửi key đúng thì lên tier có key với giới hạn rộng hơn. Base URL: https://api.iamzero.app/v1. Call it without an Authorization header and you are on the free tier. Send a valid key to get the wider key tier.

Free tier (không key)Free tier (no key) Có API keyWith API key
Tốc độRate 3 request/phút mỗi IPrequests/min per IP không giới hạn riêngno separate limit
Hạn mức ngàyDaily budget 200 lượt/ngày, dùng chung cho tất cả người dùng freecalls/day, shared across all free users chỉ giới hạn bởi trần từng modelbounded only by each model's ceiling
max_tokens5124096
Kích thước requestRequest size8 KB32 KB
Model auto, gemini-flash, llama-3.3-70b, llama-4-scout tất cả, kể cảall, including ling-3.0-tiny
Vì sao free tier bị giới hạn: toàn bộ dịch vụ chạy trên hạn mức miễn phí của nhà cung cấp, tổng cộng chỉ khoảng vài nghìn lượt mỗi ngày cho tất cả mọi người cộng lại. Không có hàng rào thì một vòng lặp duy nhất sẽ vét sạch trong vài phút và dịch vụ chết cả ngày. Các con số trên là để nhiều người cùng dùng được, không phải để làm khó bạn. Why the free tier is capped: the whole service runs on providers' free allowances — a few thousand calls a day for everyone combined. Without limits a single loop would drain it in minutes and the service would be dead for the rest of the day. These numbers exist so many people can share it, not to get in your way.

Gửi key sai sẽ nhận 401 chứ không tự động tụt xuống free tier — để lỗi cấu hình lộ ra thay vì bị che. Cần key riêng (giới hạn rộng hơn) thì liên hệ chủ dịch vụ; key cấp bằng wrangler secret put LLM_API_KEYS, mỗi consumer một key để thu hồi riêng được. Sending a wrong key returns 401 rather than silently dropping to the free tier — a misconfiguration should surface, not hide. For your own key with wider limits, ask the service owner; keys are issued via wrangler secret put LLM_API_KEYS, one per consumer so they can be revoked individually.

Danh sách modelList models

GET /v1/models

Trả kèm quota còn lại hôm nay — hạn mức ở đây rất nhỏ và lệch nhau giữa các model, nên hãy đọc x_remaining để lùi bước thay vì đâm vào 429. Includes remaining quota for today — the ceilings here are small and uneven, so read x_remaining and back off instead of walking into a 429.

# free tier — không cần key
curl https://api.iamzero.app/v1/models
{
  "object": "list",
  "data": [
    {
      "id": "llama-3.3-70b",
      "object": "model",
      "owned_by": "meta via groq",
      "x_provider": "groq",
      "x_upstream_model": "llama-3.3-70b-versatile",
      "x_daily_ceiling": 1000,
      "x_calls_today": 5,
      "x_remaining": 995,
      "x_note": "Nhanh nhất; trần ~1.000 req/ngày."
    }
  ]
}

Nếu D1 không đọc được, x_calls_today trả chuỗi "unmeasured" — hệ thống này không bao giờ điền một con số "hợp lý" thay cho số đo thật. If D1 is unreachable, x_calls_today is the string "unmeasured" — this system never substitutes a plausible-looking number for a measured one.

Chat completions

POST /v1/chat/completions

Tham sốParameters

Tham sốField KiểuType Mô tảDescription
modelstring required Một trong các ID ở bảng bên dưới.One of the IDs in the table below.
messagesarray required Mỗi phần tử {role, content}, role là system | user | assistant. Phần tử cuối phải là user. Each item is {role, content} where role is system | user | assistant. The last item must be user.
max_tokensinteger 1–4096, mặc định 1024.1–4096, defaults to 1024.
streamboolean Chưa hỗ trợ. Đặt true sẽ nhận 400 chứ không bị treo. Not supported. Setting true returns a 400 rather than hanging.

Các tham số khác của OpenAI (temperature, top_p, tools…) hiện bị bỏ qua, vì tầng provider miễn phí bên dưới không nhận chúng đồng nhất. Other OpenAI parameters (temperature, top_p, tools…) are currently ignored, because the free provider layer underneath does not accept them consistently.

curl

curl -X POST https://api.iamzero.app/v1/chat/completions \
  -H "content-type: application/json" \
  -d '{
    "model": "llama-3.3-70b",
    "messages": [
      {"role": "system", "content": "Trả lời ngắn gọn."},
      {"role": "user",   "content": "Thủ đô Việt Nam?"}
    ],
    "max_tokens": 128
  }'

Python openai SDK

from openai import OpenAI

client = OpenAI(
    base_url="https://api.iamzero.app/v1",
    api_key="free",   # free tier bỏ qua giá trị này; SDK bắt buộc phải có gì đó
)
r = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Thủ đô Việt Nam?"}],
)
print(r.choices[0].message.content)

JavaScript fetch

const r = await fetch("https://api.iamzero.app/v1/chat/completions", {
  method: "POST",
  headers: { "content-type": "application/json" },   // free tier: không cần key
  body: JSON.stringify({
    model: "auto",
    messages: [{ role: "user", content: "Thủ đô Việt Nam?" }],
  }),
});
const data = await r.json();
console.log(data.choices[0].message.content);

Kết quảResponse

{
  "id": "chatcmpl-2f1c…",
  "object": "chat.completion",
  "created": 1786500000,
  "model": "llama-3.3-70b",
  "choices": [
    { "index": 0,
      "message": { "role": "assistant", "content": "Thủ đô của Việt Nam là Hà Nội." },
      "finish_reason": "stop" }
  ],
  "x_provider": "groq",
  "x_upstream_model": "llama-3.3-70b-versatile",
  "x_tier": "anon"
}
Hai chỗ khác chuẩn OpenAI, cố ý: không có field usage vì tầng dưới không trả số token — thà thiếu còn hơn trả số bịa. Và finish_reason luôn là "stop": provider miễn phí không cho biết lý do dừng, nên đây là giá trị cố định theo schema chứ không phải thứ đo được. Đừng dựa vào nó để phát hiện câu trả lời bị cắt. Two deliberate deviations from OpenAI: there is no usage field because the layer underneath reports no token counts — an absent field beats an invented number. And finish_reason is always "stop": the free providers do not report why they stopped, so it is a schema-required constant, not a measurement. Do not use it to detect truncated answers.

Model & hạn mứcModels & limits

IDChạy bằngBacked by Đo đượcMeasured Trần/ngàyDaily ceiling Free tierFree tier
auto thử lần lượt cả 4 lanetries all four lanes in order 2.28s phần còn dư của các lanewhatever the lanes have left
gemini-flashgemini-flash-latest2.74s1.500
llama-3.3-70bllama-3.3-70b-versatile (Groq)0.48s~1.000
ling-3.0-tinyinclusionai/ling-3.0-tiny:free50cần keykey only
llama-4-scout@cf/meta/llama-4-scout-17b-16e-instruct1.03s tính bằng Neurons (10K/ngày)metered in Neurons (10K/day)

Thời gian đo bằng curl từ Việt Nam ngày 2026-08-12, một lần mỗi model — là mốc tham khảo, không phải cam kết. Timings measured once per model with curl from Vietnam on 2026-08-12 — a reference point, not a guarantee.

Chọn model đích danh thì không có dự phòng. Nếu model đó lỗi, bạn nhận 502 chứ không bị âm thầm trả lời bởi model khác — bạn cần biết chính xác ai đã trả lời. Muốn có dự phòng thì dùng auto: nó đi hết chuỗi cho tới lane đầu tiên thành công. Naming a model means no fallback. If it fails you get a 502 rather than a silent answer from a different model — you need to know exactly who answered. For fallback use auto, which walks the chain until a lane succeeds.
Hạn mức là dùng chung. Trần ở trên chia cho tất cả: API này, khung chat công khai, và các dịch vụ khác của cùng Worker. Thêm người dùng là chia nhỏ phần của nhau, không phải ai cũng được trọn suất. Quota is shared. Those ceilings are split across everything: this API, the public chat, and the other services on the same Worker. More consumers means smaller slices, not a full allowance each.

Mã lỗiError codes

Lỗi trả theo shape OpenAI để SDK đọc được:Errors use the OpenAI shape so SDKs can read them: {"error":{"message","type","code"}}

HTTPcodeNghĩaMeaning
400bad_jsonBody không phải JSON hợp lệ.Body is not valid JSON.
400model_not_foundID model không có; thông báo kèm danh sách hợp lệ.Unknown model ID; the message lists the valid ones.
400invalid_messagesMảng rỗng, content rỗng, hoặc phần tử cuối không phải user.Empty array, empty content, or the last item is not user.
400invalid_roleRole ngoài system/user/assistant.Role outside system/user/assistant.
400invalid_max_tokensKhông phải số nguyên 1–4096.Not an integer in 1–4096.
400stream_unsupportedĐã gửi stream: true.You sent stream: true.
400model_not_available_anonymouslyModel có thật nhưng chỉ mở cho tier có key (trần quá nhỏ để chia cho free tier).The model exists but is key-only (its ceiling is too small to share with the free tier).
429anon_rate_limitedFree tier: quá 3 request/phút từ IP của bạn. Chờ một phút.Free tier: more than 3 requests/min from your IP. Wait a minute.
429anon_budget_reachedFree tier đã dùng hết 200 lượt chung của ngày hôm nay.The free tier's shared 200 calls for today are used up.
503anon_disabledChủ dịch vụ đã tạm tắt free tier; cần key.The owner has temporarily turned the free tier off; a key is required.
405method_not_allowedSai phương thức — /v1/models chỉ nhận GET, /v1/chat/completions chỉ nhận POST.Wrong method — /v1/models is GET-only, /v1/chat/completions is POST-only.
401invalid_api_keyThiếu hoặc sai key.Missing or wrong key.
413context_too_largeTổng nội dung vượt 32.768 bytes.Total content exceeds 32,768 bytes.
429daily_ceiling_reachedModel đã hết suất hôm nay. Đổi model hoặc chờ sang ngày (theo giờ UTC).That model is out of quota today. Switch models or wait for the UTC day to roll over.
502http_5xx, timeout, bad_responseNhà cung cấp phía sau lỗi. timeout = quá 8 giây.The upstream provider failed. timeout means it took over 8 seconds.
503d1_unreachableKhông ghi được sổ đếm hạn mức nên request bị từ chối — không bao giờ gọi LLM mà không đếm.The quota ledger is unwritable, so the request is refused — an LLM call is never made without metering it.

Giới hạn cần biết trướcConstraints worth knowing up front

Endpoint khácOther endpoints

Đường dẫnPathAuthCông dụngPurpose
GET /health Còn sống hay không.Liveness.
GET /ready Sẵn sàng chưa (có ping cơ sở dữ liệu).Readiness, including a database ping.
POST /chatTurnstile hoặcor Bearer Khung chat công khai ở /ai. Khác API này: có chống lạm dụng, giới hạn chặt hơn. Backs the public chat at /ai. Unlike this API it carries abuse protection and tighter limits.
POST /summarizeBearer Tóm tắt văn bản ≤3 câu, tự động chuyển lane khi lỗi. Summarise text into ≤3 sentences, with automatic lane fallback.
GET /metricsBearer (chủ dịch vụ)(owner) Mức tiêu thụ hôm nay so với trần.Today's usage against the ceilings.