Class BetaMessageDeltaUsage
-
- All Implemented Interfaces:
public final class BetaMessageDeltaUsage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBetaMessageDeltaUsage.BuilderA builder for BetaMessageDeltaUsage.
public final classBetaMessageDeltaUsage.BetaIterationsUsageItemsToken usage for a sampling iteration.
-
Method Summary
Modifier and Type Method Description final Optional<Long>cacheCreationInputTokens()The cumulative number of input tokens used to create the cache entry. final Optional<Long>cacheReadInputTokens()The cumulative number of input tokens read from the cache. final Optional<Long>inputTokens()The cumulative number of input tokens which were used. final Optional<List<BetaMessageDeltaUsage.BetaIterationsUsageItems>>iterations()Per-iteration token usage breakdown. final LongoutputTokens()The cumulative number of output tokens which were used. final Optional<BetaOutputTokensDetails>outputTokensDetails()Breakdown of output tokens by category. final Optional<BetaServerToolUsage>serverToolUse()The number of server tool requests. final JsonField<Long>_cacheCreationInputTokens()Returns the raw JSON value of cacheCreationInputTokens. final JsonField<Long>_cacheReadInputTokens()Returns the raw JSON value of cacheReadInputTokens. final JsonField<Long>_inputTokens()Returns the raw JSON value of inputTokens. final JsonField<List<BetaMessageDeltaUsage.BetaIterationsUsageItems>>_iterations()Returns the raw JSON value of iterations. final JsonField<Long>_outputTokens()Returns the raw JSON value of outputTokens. final JsonField<BetaOutputTokensDetails>_outputTokensDetails()Returns the raw JSON value of outputTokensDetails. final JsonField<BetaServerToolUsage>_serverToolUse()Returns the raw JSON value of serverToolUse. final Map<String, JsonValue>_additionalProperties()final BetaMessageDeltaUsage.BuildertoBuilder()final BetaMessageDeltaUsagevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaMessageDeltaUsage.Builderbuilder()Returns a mutable builder for constructing an instance of BetaMessageDeltaUsage. -
-
Method Detail
-
cacheCreationInputTokens
final Optional<Long> cacheCreationInputTokens()
The cumulative number of input tokens used to create the cache entry.
-
cacheReadInputTokens
final Optional<Long> cacheReadInputTokens()
The cumulative number of input tokens read from the cache.
-
inputTokens
final Optional<Long> inputTokens()
The cumulative number of input tokens which were used.
-
iterations
final Optional<List<BetaMessageDeltaUsage.BetaIterationsUsageItems>> iterations()
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
Determine which iterations exceeded long context thresholds (>=200k tokens)
Calculate the true context window size from the last iteration
Understand token accumulation across server-side tool use loops
-
outputTokens
final Long outputTokens()
The cumulative number of output tokens which were used.
-
outputTokensDetails
final Optional<BetaOutputTokensDetails> outputTokensDetails()
Breakdown of output tokens by category.
output_tokensremains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you.
-
serverToolUse
final Optional<BetaServerToolUsage> serverToolUse()
The number of server tool requests.
-
_cacheCreationInputTokens
final JsonField<Long> _cacheCreationInputTokens()
Returns the raw JSON value of cacheCreationInputTokens.
Unlike cacheCreationInputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_cacheReadInputTokens
final JsonField<Long> _cacheReadInputTokens()
Returns the raw JSON value of cacheReadInputTokens.
Unlike cacheReadInputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_inputTokens
final JsonField<Long> _inputTokens()
Returns the raw JSON value of inputTokens.
Unlike inputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_iterations
final JsonField<List<BetaMessageDeltaUsage.BetaIterationsUsageItems>> _iterations()
Returns the raw JSON value of iterations.
Unlike iterations, this method doesn't throw if the JSON field has an unexpected type.
-
_outputTokens
final JsonField<Long> _outputTokens()
Returns the raw JSON value of outputTokens.
Unlike outputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_outputTokensDetails
final JsonField<BetaOutputTokensDetails> _outputTokensDetails()
Returns the raw JSON value of outputTokensDetails.
Unlike outputTokensDetails, this method doesn't throw if the JSON field has an unexpected type.
-
_serverToolUse
final JsonField<BetaServerToolUsage> _serverToolUse()
Returns the raw JSON value of serverToolUse.
Unlike serverToolUse, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final BetaMessageDeltaUsage.Builder toBuilder()
-
validate
final BetaMessageDeltaUsage validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static BetaMessageDeltaUsage.Builder builder()
Returns a mutable builder for constructing an instance of BetaMessageDeltaUsage.
The following fields are required:
.cacheCreationInputTokens() .cacheReadInputTokens() .inputTokens() .iterations() .outputTokens() .outputTokensDetails() .serverToolUse()
-
-
-
-