Example Usage
import { BatchObjectUsage } from "@openrouter/sdk/models";
let value: BatchObjectUsage = {
completionTokens: 833670,
promptTokens: 277233,
totalTokens: 624977,
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
cacheCreation | models.AnthropicCacheCreation | :heavy_minus_sign: | N/A | { “ephemeral_1h_input_tokens”: 0, “ephemeral_5m_input_tokens”: 100 } |
completionTokens | number | :heavy_check_mark: | The tokens generated | |
completionTokensDetails | models.BatchObjectCompletionTokensDetails | :heavy_minus_sign: | N/A | |
cost | number | :heavy_minus_sign: | Cost of the completion | |
costDetails | models.CostDetails | :heavy_minus_sign: | Breakdown of upstream inference costs | { “upstream_inference_completions_cost”: 0.0004, “upstream_inference_cost”: null, “upstream_inference_prompt_cost”: 0.0008 } |
isByok | boolean | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
iterations | models.AnthropicUsageIteration[] | :heavy_minus_sign: | N/A | |
promptTokens | number | :heavy_check_mark: | Including images, input audio, and tools if any | |
promptTokensDetails | models.BatchObjectPromptTokensDetails | :heavy_minus_sign: | Breakdown of tokens used in the prompt. | |
serverToolUse | models.BatchObjectServerToolUse | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | |
serviceTier | string | :heavy_minus_sign: | The service tier used by the upstream provider for this request | |
speed | models.AnthropicSpeed | :heavy_minus_sign: | N/A | standard |
totalTokens | number | :heavy_check_mark: | Sum of the above two fields |