Skip to content
allitBeta
  • Models
  • UBIA
  • Chat
  • Hub
  • Studio
  • Pricing
  • API
  • Privacy
    • $ALL
    • WIT
    • Auction
    • Staking
Connect walletTry free
allitBeta
  • Models
  • UBIA
  • Chat
  • Hub
  • Studio
  • Pricing
  • API
  • Privacy

Token

  • $ALL
  • WIT
  • Auction
  • Staking
Try freeConnect wallet
Docs / Chat completions
  • Getting started

    • Allwit docs
    • Wallet sign-in
  • $ALL token

    • $ALL token
    • Launch auction
    • Staking
    • Buyback and burn
  • WIT credits

    • WIT credits
    • The daily allowance
    • Buy WIT credits
    • Pricing and spending
  • Platform

    • Privacy and labels
    • Models
    • Hub
    • Agent Studio
  • API

    • Developer API
    • Authentication
    • Models and pricing
    • Chat completions
    • Images
    • Transcriptions
    • Speech
    • Videos
    • Errors
    • Rate limits
  • Reference

    • Parameters
    • Risks and disclaimer
  • Community

    • X
Docs
  • Getting started

    • Allwit docs
    • Wallet sign-in
  • $ALL token

    • $ALL token
    • Launch auction
    • Staking
    • Buyback and burn
  • WIT credits

    • WIT credits
    • The daily allowance
    • Buy WIT credits
    • Pricing and spending
  • Platform

    • Privacy and labels
    • Models
    • Hub
    • Agent Studio
  • API

    • Developer API
    • Authentication
    • Models and pricing
    • Chat completions
    • Images
    • Transcriptions
    • Speech
    • Videos
    • Errors
    • Rate limits
  • Reference

    • Parameters
    • Risks and disclaimer
  • Community

    • X

API

Chat completions

POST /chat/completions, OpenAI-compatible, with server-sent event streaming.

Request

`POST /chat/completions` takes the OpenAI request body. Allwit uses `model`, `messages` (string content, or text parts), `temperature`, `max_tokens` (or `max_completion_tokens`) and `stream`; other fields are accepted and ignored. Only `n: 1` is supported. Messages with the `developer` role are treated as `system`.

The whole conversation travels in `messages` every time: Allwit keeps no thread between requests. Send a `max_tokens` that fits your use; it is what gets reserved. Without it the model's default budget applies.

Responsejson
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "created": 1794300000,
  "model": "qwen/qwen3.8-27b",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "…" }, "finish_reason": "stop" }],
  "usage": { "prompt_tokens": 21, "completion_tokens": 48, "total_tokens": 69 },
  "allwit": { "wit_charged": 1, "privacy_tier": "blind", "source": "provider_api" }
}

Streaming

With `stream: true` the response is `text/event-stream`: `data:` lines carrying `chat.completion.chunk` objects, then `data: [DONE]`. The chunk before `[DONE]` has an empty `choices` array and carries `usage` and `allwit.wit_charged`, whether or not you ask for `stream_options.include_usage`. Moderation and the WIT reservation happen before the first byte, so 400, 402 and 429 arrive as plain JSON; a failure after streaming has started is a final `{"error": …}` event before `[DONE]`.

Pythonpython
from openai import OpenAI

client = OpenAI(
    base_url="https://www.allwit.ai/api/v1",
    api_key="aw_live_…",  # from /app/account/api-keys
)

stream = client.chat.completions.create(
    model="qwen/qwen3.8-27b",
    messages=[{"role": "user", "content": "Write a haiku about keys."}],
    max_tokens=120,
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
JavaScriptjavascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://www.allwit.ai/api/v1",
  apiKey: process.env.ALLWIT_API_KEY, // aw_live_…
});

const stream = await client.chat.completions.create({
  model: "qwen/qwen3.8-27b",
  messages: [{ role: "user", content: "Write a haiku about keys." }],
  max_tokens: 120,
  stream: true,
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
curlbash
curl -N https://www.allwit.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $ALLWIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen/qwen3.8-27b", "messages": [{"role": "user", "content": "Hello"}], "stream": true}'
PreviousModels and pricingNext Images

On this page

  1. Request
  2. Streaming
allit

Intelligence, open to everyone. One gateway to every AI model.

  • Allwit on X

© 2026 Allwit

Product

  • Models
  • Chat
  • Hub
  • Agent Studio
  • Pricing
  • UBIA

Developers

  • API
  • Docs
  • Whitepaper

Token

  • $ALL
  • WIT
  • Auction
  • Staking

Legal

  • Privacy
  • Terms
  • Cookies
  • Cookie settings

    Allwit uses no advertising or analytics cookies. Here is what it keeps in this browser.

    Strictly necessary

    The sign-in cookie and your chat history. Needed for Allwit to work.

    Always on

    Remember your light or dark theme on this device.

    Analytics and advertising cookies

    None. Page views are counted without cookies by analytics Allwit hosts itself, which stores nothing in your browser and never sees your wallet address. No advertising.

    No cookies

    Chat history

    Conversations saved in this browser. Deleting them here does not touch any encrypted copies you chose to sync. Manage encrypted history sync

    Read the cookie policy