Developer Quickstart

Blazo exposes an OpenAI-compatible endpoint at https://blazo.io/api/v1. Create an API key in Dashboard → API Keys and pass it as your Bearer token. Use an ID from https://blazo.io/api/v1/models for a currently available model.

Node.js / TypeScript (OpenAI SDK)

import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.BLAZO_API_KEY, // blz_live_...
  baseURL: "https://blazo.io/api/v1",
});

const stream = await openai.chat.completions.create({
  model: "deepseek/deepseek-v4.1-flash-fast",
  stream: true,
  messages: [{ role: "user", content: "Write a SQLite UPSERT example." }],
});

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

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="blz_live_your_key_here",
    base_url="https://blazo.io/api/v1",
)

completion = client.chat.completions.create(
    model="glm/glm-5.3",
    messages=[{"role": "user", "content": "Hello from Python!"}],
)
print(completion.choices[0].message.content)

cURL

curl https://blazo.io/api/v1/chat/completions \
  -H "Authorization: Bearer blz_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax/minimax-m3.1-flash",
    "messages": [{"role": "user", "content": "Explain idempotency keys briefly."}]
  }'

Credit Metering & Pricing Formula

Credits are stored as integers (`150 credits = $1.00 USD`). With prepaid metering enabled, Blazo reserves enough credits for the request before inference. Once usage arrives, Blazo charges for the reported tokens and releases the unused reservation. Metered requests accept text messages up to 32 KiB and a maximum of 2,048 completion tokens.

credits_charged = Math.max(1, Math.ceil(wholesale_usd * markup_multiplier * 150))

HTTP Error Codes

StatusMeaningResolution
401Invalid or revoked API keyCheck your blz_live_... token in Dashboard → API Keys.
402Insufficient credit balanceTop up prepaid credits in Dashboard → Billing.
429Upstream rate limit exceededRetry with exponential backoff or route to another model.
503Upstream inference gateway unavailableVerify `UPSTREAM_API_KEY` environment configuration.

Connected Apps / Blazo Partner API (OAuth2)

Authorized external applications can connect a user's Blazo account once via /oauth/authorize and exchange the single-use code at /api/partner/oauth/token to read balances, issue idempotent debits/refunds, and receive signed HMAC-SHA256 webhooks. See PARTNER_CONTRACT.md in the repository for the complete TypeScript SDK helper.