Skip to main content

Usage

Usage accounting

Usage profiles​

UsageFields and validation
In requestsView fields
In responsesView fields
In webhook payloadsView fields

In requests​

API JSON uses JSON field names (camelCase).

FieldTypePresenceMeaning
promptTokensinteger (int32)OptionalPrompt-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
completionTokensinteger (int32)OptionalCompletion-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
totalTokensinteger (int32)OptionalTotal token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
costEstimatenumber (float) or string (NaN, Infinity, -Infinity)OptionalEstimated cost in USD.
completionTokensDetailsCompletionTokensDetailsOptionalBreakdown of completion tokens.
promptTokensDetailsPromptTokensDetailsOptionalBreakdown of prompt tokens (cache).
costDetailsCostDetailsOptionalBreakdown of upstream provider cost (BYOK routes).
isByokbooleanOptionalWhether this generation used the customer's own model-provider key.

In responses​

API JSON uses JSON field names (camelCase).

FieldTypePresenceMeaning
promptTokensinteger (int32)OptionalPrompt-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
completionTokensinteger (int32)OptionalCompletion-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
totalTokensinteger (int32)OptionalTotal token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
costEstimatenumber (float) or string (NaN, Infinity, -Infinity)OptionalEstimated cost in USD.
completionTokensDetailsCompletionTokensDetailsOptionalBreakdown of completion tokens.
promptTokensDetailsPromptTokensDetailsOptionalBreakdown of prompt tokens (cache).
costDetailsCostDetailsOptionalBreakdown of upstream provider cost (BYOK routes).
isByokbooleanOptionalWhether this generation used the customer's own model-provider key.

In webhook payloads​

Webhook JSON uses protobuf field names (snake_case).

FieldTypePresenceMeaning
prompt_tokensinteger (int32)OptionalPrompt-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
completion_tokensinteger (int32)OptionalCompletion-token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
total_tokensinteger (int32)OptionalTotal token usage reported by the model provider. Minimum: -2147483648. Maximum: 2147483647.
cost_estimatenumber (float) or string (NaN, Infinity, -Infinity)OptionalEstimated cost in USD.
completion_tokens_detailsCompletionTokensDetailsOptionalBreakdown of completion tokens.
prompt_tokens_detailsPromptTokensDetailsOptionalBreakdown of prompt tokens (cache).
cost_detailsCostDetailsOptionalBreakdown of upstream provider cost (BYOK routes).
is_byokbooleanOptionalWhether this generation used the customer's own model-provider key.

Where used​

ReferenceRelationship
Append a message without generatingPOST /api/v1/llm/append-message
Send a message to a conversationPOST /api/v1/llm/send-message
Send a message and wait for the resultPOST /api/v1/llm/send-message-sync
Withdraw your rating on a messagePOST /api/v1/llm/delete-message-rating
Get full conversation statePOST /api/v1/llm/conversation-state
Rate an assistant messagePOST /api/v1/llm/rate-message
Submit client-side tool results and wait for the next segmentPOST /api/v1/llm/submit-client-tool-results-sync
llm.generation_completedWebhook JSON uses protobuf field names (snake_case).
llm.message_publishedWebhook JSON uses protobuf field names (snake_case).
LLMGenerationCompletedEventNested in model
MessageNested in model
MessageNested in model
MessageNested in model
UsageByModelNested in model

Download the public reference contract.

Document: DOC-API-MODEL-usage.