Skip to content
Get an API key

Usage and cost

View as Markdown

Every answer, whole or streamed, ends with a usage object:

"usage": {
"prompt_tokens": 31,
"completion_tokens": 58,
"total_tokens": 89,
"noduma_cost": 220,
"noduma_price_per_1k_tokens": 2000
}
Field Meaning
noduma_cost The credits this answer was charged. Always present; 0 for an answer of your own PCs
noduma_price_per_1k_tokens The price it was charged at, in credits per 1,000 tokens: the one in force when the request was accepted; 0 for your own PCs
prompt_tokens, completion_tokens, total_tokens The PC engine's own counts, capped by the request's size and limit, for information only

The coordinator measures the request it sent to the PC and the answer it relayed, in bytes, and never trusts the PC's token counts:

units = (request bytes + answer bytes) / 4, rounded up
cost = units × noduma_price_per_1k_tokens / 1,000, rounded up

So a token in the cost is about 4 bytes of text, which is close to, but not the same as, the engine's token count. The request bytes include the messages, the tool definitions and the parameters Noduma sends to the PC. A thinking model's reasoning is part of the answer.

Before the request goes out, the cost of the longest possible answer is reserved; afterwards only the real cost is charged. See Credits.