Token counts
Count the input tokens for a piece of text before you send it. A native /v2 helper for budgeting requests.
A small helper that returns the input-token count for a piece of text, so you can size a request before running it. See billing and budgets for how tokens map to charges.
All requests require a bearer API key. See authentication.
Count tokens
POST /v2/token-counts
inputstringrequiredThe text to count. Must not be empty.
curl https://api.zumik.ai/v2/token-counts \
-H "Authorization: Bearer $ZUMIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": "Summarize the diff in three bullets." }'from zumik import Zumik
zk = Zumik()
count = zk.token_counts.create(input="Summarize the diff in three bullets."){
"object": "token_count",
"input_tokens": 10
}objectstringAlways token_count.
input_tokensintegerThe estimated input-token count.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request_error | input is empty. |
| 401 | invalid_api_key | Missing or invalid API key. |
See the full table on errors.
Responses
Create, retrieve, and cancel native responses. The /v2 surface pins session state and an explicit QoS request in the body, and reports the formal QoS outcome.
Diagnostics
Run the Agent Workload Efficiency Diagnostic over metadata traces, retrieve a stored run, and render a signed report with an evidence digest.