Skip to main content

CostDetails

Breakdown of model-provider cost. When the customer supplies the provider key, usage.cost is zero and upstream_inference_cost reports the provider spend, split into prompt and completion components.

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
upstreamInferenceCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalTotal upstream provider cost (USD) on BYOK routes.
upstreamInferencePromptCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to prompt tokens (USD).
upstreamInferenceCompletionCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to completion tokens (USD).

In responses​

API JSON uses JSON field names (camelCase).

FieldTypePresenceMeaning
upstreamInferenceCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalTotal upstream provider cost (USD) on BYOK routes.
upstreamInferencePromptCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to prompt tokens (USD).
upstreamInferenceCompletionCostnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to completion tokens (USD).

In webhook payloads​

Webhook JSON uses protobuf field names (snake_case).

FieldTypePresenceMeaning
upstream_inference_costnumber (float) or string (NaN, Infinity, -Infinity)OptionalTotal upstream provider cost (USD) on BYOK routes.
upstream_inference_prompt_costnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to prompt tokens (USD).
upstream_inference_completion_costnumber (float) or string (NaN, Infinity, -Infinity)OptionalUpstream cost attributed to completion tokens (USD).

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).
UsageNested in model
UsageNested in model
UsageNested in model

Download the public reference contract.

Document: DOC-API-MODEL-cost-details.