--- title: "ImageGenerationUsage" --- Token and cost usage for the image generation request, when available ## Fields | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `cache_creation` | [OptionalNullable[components.AnthropicCacheCreation]](../components/anthropiccachecreation.mdx) | :heavy_minus_sign: | N/A | \{
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 100
} | | `completion_tokens` | *int* | :heavy_check_mark: | The tokens generated | | | `completion_tokens_details` | [OptionalNullable[components.ImageGenerationUsageCompletionTokensDetails]](../components/imagegenerationusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | N/A | | | `cost` | *OptionalNullable[float]* | :heavy_minus_sign: | Cost of the completion | | | `cost_details` | [OptionalNullable[components.CostDetails]](../components/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} | | `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | | | `iterations` | List[[components.AnthropicUsageIteration](../components/anthropicusageiteration.mdx)] | :heavy_minus_sign: | N/A | | | `prompt_tokens` | *int* | :heavy_check_mark: | Including images, input audio, and tools if any | | | `prompt_tokens_details` | [OptionalNullable[components.ImageGenerationUsagePromptTokensDetails]](../components/imagegenerationusageprompttokensdetails.mdx) | :heavy_minus_sign: | Breakdown of tokens used in the prompt. | | | `server_tool_use` | [OptionalNullable[components.ServerToolUse]](../components/servertooluse.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | | | `service_tier` | *OptionalNullable[str]* | :heavy_minus_sign: | The service tier used by the upstream provider for this request | | | `speed` | [OptionalNullable[components.AnthropicSpeed]](../components/anthropicspeed.mdx) | :heavy_minus_sign: | N/A | standard | | `total_tokens` | *int* | :heavy_check_mark: | Sum of the above two fields | |