Zumik
v2 · Native state

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

inputstringrequired

The 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
}
objectstring

Always token_count.

input_tokensinteger

The estimated input-token count.

Errors

StatusCodeWhen
400invalid_request_errorinput is empty.
401invalid_api_keyMissing or invalid API key.

See the full table on errors.

On this page