Usage and Billing

Token usage in every response, prompt caching, reasoning tokens, and how Serverless bills.

Every successful response reports token usage, including streaming responses. Use it to track spend per request. For account-level usage and credit balance, use the dashboard at www.abhigya.ai.

Chat Completions usage

curl -sS https://api.abhigya.ai/v1/chat/completions \
-H "Authorization: Bearer $ABHIGYA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen2.5-7b-instruct",
"messages": [{"role": "user", "content": "What is 17 * 3?"}],
"max_tokens": 512
}'

The response carries a usage object.

{
"usage": {
"prompt_tokens": 4508,
"completion_tokens": 20,
"total_tokens": 4528,
"prompt_tokens_details": {"cached_tokens": 4352},
"completion_tokens_details": {"reasoning_tokens": 16}
}
}
FieldMeaning
prompt_tokensAll prompt tokens, including cached tokens.
prompt_tokens_details.cached_tokensPrompt tokens served from the prompt cache. A subset of prompt_tokens.
completion_tokensAll generated tokens, including reasoning tokens.
completion_tokens_details.reasoning_tokensGenerated tokens spent on returned reasoning. A subset of completion_tokens.
total_tokensprompt_tokens + completion_tokens.

Successful streams end with a usage chunk before data: [DONE]. You do not need to set stream_options.

Prompt caching

Prompt caching is automatic. When a request starts with the same tokens as a recent request, the cached prefix is reused. You do not need to send cache_control or any other field.

Cached tokens are reported as prompt_tokens_details.cached_tokens and bill at the cache-read rate. Cache hits are not guaranteed.

To get more cache hits, keep the stable part of the prompt (system prompt, tool definitions, long documents) at the start and put changing content at the end.

How requests are billed

Serverless is prepaid. Each request is charged against your credit balance at the model's rates (see Pricing).

On some models, generated tokens can exceed max_tokens when reasoning is on. See Output length.

Requests rejected before generation starts (authentication, validation, and rate-limit errors) are not charged. A stream that fails after it starts may be charged for tokens already generated.

Before a request runs, we check that your balance covers its maximum possible cost. When it does not, the request returns 402 with code insufficient_credits. See Credits.

Dashboard

The dashboard at www.abhigya.ai shows your credit balance and usage, and is where you add credits. To track individual requests, use the usage object in each response and the x-request-id response header to correlate requests with your logs.