Chat completions
POST https://app.noduma.dev/v1/chat/completions
An answer from one of Noduma's models. The coordinator chooses a PC by the request's routing mode, reserves the cost of the longest answer, sends the request to the PC and charges what it measured. Requests are at most 1 MiB.
Request
Section titled “Request”| Field | Type | Rules |
|---|---|---|
model |
string | Required, 1 to 256 bytes, a name of Noduma's list (GET /v1/models) |
messages |
array | Required, 1 to 256 messages |
max_tokens or max_completion_tokens |
integer | 1 to 8,192. Default 1,024, or 3,072 for a model that thinks first. max_completion_tokens wins when both are set |
temperature |
number | 0 to 2 |
top_p |
number | 0 to 1 |
stop |
string or array | Up to 4 strings |
stream |
boolean | true streams the answer as server-sent events; see Streaming |
tools |
array | Function tools, passed to the PC's engine; see Tools |
tool_choice |
string or object | Passed to the PC's engine with tools |
Other top-level fields are ignored.
Messages
Section titled “Messages”| Field | Rules |
|---|---|
role |
system, user, assistant or tool. developer is accepted and sent as system |
content |
A string, or an array of {"type": "text", "text": "..."} parts. Required unless an assistant message carries tool_calls |
name |
Optional |
tool_calls |
Only on assistant messages |
tool_call_id |
On tool messages, the call it answers |
A message with any other field is refused. Reasoning that an earlier answer of a thinking model held between <think> and </think> is removed from the history before it reaches a PC, so it is neither sent nor charged again.
Example
Section titled “Example”curl https://app.noduma.dev/v1/chat/completions \ -H "Authorization: Bearer $NODUMA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen2.5-14b-instruct-q4_k_m", "max_tokens": 200, "temperature": 0.3, "messages": [ {"role": "system", "content": "You answer in one short paragraph."}, {"role": "user", "content": "What is a GGUF file?"} ] }'answer = client.chat.completions.create( model="qwen2.5-14b-instruct-q4_k_m", max_tokens=200, temperature=0.3, messages=[ {"role": "system", "content": "You answer in one short paragraph."}, {"role": "user", "content": "What is a GGUF file?"}, ],)print(answer.choices[0].message.content, answer.usage.model_extra["noduma_cost"])const answer = await client.chat.completions.create({ model: 'qwen2.5-14b-instruct-q4_k_m', max_tokens: 200, temperature: 0.3, messages: [ { role: 'system', content: 'You answer in one short paragraph.' }, { role: 'user', content: 'What is a GGUF file?' }, ],});console.log(answer.choices[0].message.content, answer.usage.noduma_cost);Answer
Section titled “Answer”{ "id": "chatcmpl-...", "object": "chat.completion", "created": 1764460800, "model": "qwen2.5-14b-instruct-q4_k_m", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "A GGUF file holds a model's weights ..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 31, "completion_tokens": 58, "total_tokens": 89, "noduma_cost": 220, "noduma_price_per_1k_tokens": 2000 }}finish_reasonisstop,length(the token limit, or a balance that covered only a shorter answer) ortool_calls.contentisnullwhen the answer is only tool calls.prompt_tokensandcompletion_tokensare the PC's own counts, shown for information and capped; credits never depend on them. See Usage and cost.- The response header
Noduma-Routingnames the routing mode used.
Thinking models
Section titled “Thinking models”A model that thinks first (today Qwen3 30B-A3B, Qwen3 8B and gpt-oss 20B; each model page says so) writes its reasoning at the start of content, between <think> and </think>, then the answer. The reasoning is part of the answer and is charged like it.
When a PC fails
Section titled “When a PC fails”If the PC fails while it answers, the coordinator moves the request to another PC that serves the model and can continue an answer; a request is never run twice on two PCs that are both still working. When none can continue, the request ends with 502 node_failed. See Errors.