Unaligned API

Chat

The native endpoint. Send a prompt or a conversation, get the text back with its exact cost and your new balance.

POST /v1/chat

Base URL https://api.unaligned.pw/v1. The body is JSON; Content-Type can be omitted.

Request body

model string required
Model ID, see Models.
prompt string
A single user message. Use either prompt or messages.
messages array
A conversation: [{"role": "user" | "assistant", "content": "…"}]. A user content can also be a list of parts, {"type": "text", "text": "…"} and {"type": "image", "url": "data:image/png;base64,…"} (JPEG, PNG, GIF or WebP, up to 5 MB each, with a model whose vision is true).
system string
Instructions for the model.
max_tokens integer
Maximum tokens to generate. Defaults to what is left of the context window.
temperature number
0 to 2. Lower is more focused. Default 1.
stream boolean
Send the text as it is generated. See Streaming.

Example

curl https://api.unaligned.pw/v1/chat \
  -H "Authorization: Bearer $UNALIGNED_KEY" \
  -d '{
    "model": "gpt-6-luna",
    "system": "You are concise.",
    "messages": [
      {"role": "user", "content": "What is a token?"}
    ],
    "temperature": 0.7
  }'

Response

{
  "id": "req_7f3a…",
  "model": "gpt-6-luna",
  "text": "A token is a piece of text…",
  "finish": "stop",
  "usage": { "input_tokens": 21, "output_tokens": 48 },
  "cost": 0.0000510,
  "balance": 20.4999490
}
text string
The answer.
finish string
stop when the model ended on its own, length when it hit max_tokens.
usage object
Tokens counted for this request.
cost number
What this request cost, in USD.
balance number
Your balance after this request, in USD.