

# TokenUsage
<a name="API_runtime_TokenUsage"></a>

The tokens used in a message API inference call. 

## Contents
<a name="API_runtime_TokenUsage_Contents"></a>

 ** inputTokens **   <a name="bedrock-Type-runtime_TokenUsage-inputTokens"></a>
The number of tokens sent in the request to the model.  
Type: Integer  
Valid Range: Minimum value of 0.  
Required: Yes

 ** outputTokens **   <a name="bedrock-Type-runtime_TokenUsage-outputTokens"></a>
The number of tokens that the model generated for the request.  
Type: Integer  
Valid Range: Minimum value of 0.  
Required: Yes

 ** totalTokens **   <a name="bedrock-Type-runtime_TokenUsage-totalTokens"></a>
The total of input tokens and tokens generated by the model.  
Type: Integer  
Valid Range: Minimum value of 0.  
Required: Yes

 ** cacheDetails **   <a name="bedrock-Type-runtime_TokenUsage-cacheDetails"></a>
Detailed breakdown of cache writes by TTL. Empty if no cache creation occurred. Sorted by TTL duration (1h before 5m).  
Type: Array of [CacheDetail](API_runtime_CacheDetail.md) objects  
Required: No

 ** cacheReadInputTokens **   <a name="bedrock-Type-runtime_TokenUsage-cacheReadInputTokens"></a>
The number of input tokens read from the cache for the request.  
Type: Integer  
Valid Range: Minimum value of 0.  
Required: No

 ** cacheWriteInputTokens **   <a name="bedrock-Type-runtime_TokenUsage-cacheWriteInputTokens"></a>
The number of input tokens written to the cache for the request.  
Type: Integer  
Valid Range: Minimum value of 0.  
Required: No

## See Also
<a name="API_runtime_TokenUsage_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-runtime-2023-09-30/TokenUsage) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-runtime-2023-09-30/TokenUsage) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-runtime-2023-09-30/TokenUsage) 