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
modelstring required- Model ID, see Models.
promptstring- A single user message. Use either
promptormessages. messagesarray- A conversation:
[{"role": "user" | "assistant", "content": "…"}]. A usercontentcan 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 whosevisionis true). systemstring- Instructions for the model.
max_tokensinteger- Maximum tokens to generate. Defaults to what is left of the context window.
temperaturenumber- 0 to 2. Lower is more focused. Default 1.
streamboolean- 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
}textstring- The answer.
finishstringstopwhen the model ended on its own,lengthwhen it hitmax_tokens.usageobject- Tokens counted for this request.
costnumber- What this request cost, in USD.
balancenumber- Your balance after this request, in USD.