Class BetaRawMessageDeltaEvent
-
- All Implemented Interfaces:
public final class BetaRawMessageDeltaEvent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBetaRawMessageDeltaEvent.BuilderA builder for BetaRawMessageDeltaEvent.
public final classBetaRawMessageDeltaEvent.Delta
-
Method Summary
Modifier and Type Method Description final Optional<BetaContextManagementResponse>contextManagement()Information about context management strategies applied during the request final BetaRawMessageDeltaEvent.Deltadelta()final BetaMessageDeltaUsageusage()Billing and rate-limit usage. final Optional<List<BetaInputTransformation>>inputTransformations()Changes the API made to the request's input before showing it to the model, and blocks that failed a binding check but were left unchanged: one entry per block, in request order. final JsonValue_type()Expected to always return the following:
However, this method can be useful for debugging and logging (e.g.JsonValue.from("message_delta")final JsonField<BetaContextManagementResponse>_contextManagement()Returns the raw JSON value of contextManagement. final JsonField<BetaRawMessageDeltaEvent.Delta>_delta()Returns the raw JSON value of delta. final JsonField<BetaMessageDeltaUsage>_usage()Returns the raw JSON value of usage. final JsonField<List<BetaInputTransformation>>_inputTransformations()Returns the raw JSON value of inputTransformations. final Map<String, JsonValue>_additionalProperties()final BetaRawMessageDeltaEvent.BuildertoBuilder()final BetaRawMessageDeltaEventvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaRawMessageDeltaEvent.Builderbuilder()Returns a mutable builder for constructing an instance of BetaRawMessageDeltaEvent. -
-
Method Detail
-
contextManagement
final Optional<BetaContextManagementResponse> contextManagement()
Information about context management strategies applied during the request
-
delta
final BetaRawMessageDeltaEvent.Delta delta()
-
usage
final BetaMessageDeltaUsage usage()
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in
usagewill not match one-to-one with the exact visible content of an API request or response.For example,
output_tokenswill be non-zero, even for an empty string response from Claude.Total input tokens in a request is the summation of
input_tokens,cache_creation_input_tokens, andcache_read_input_tokens.
-
inputTransformations
final Optional<List<BetaInputTransformation>> inputTransformations()
Changes the API made to the request's input before showing it to the model, and blocks that failed a binding check but were left unchanged: one entry per block, in request order. Two entry types today.
thinking_dropped— athinking,redacted_thinkingorconnector_textblock from the request'smessagesthat was removed from the prompt instead of being shown to the model because it failed a binding check.thinking_mismatch_allowed— athinkingorredacted_thinkingblock that failed the conversation check (the conversation before it differs from the one it was created in, or it carries no record of one on a model that requires it) and was shown to the model all the same, because that check is not enforced for this request. More entry types may be added over time; ignore types you do not recognize.Requires
anthropic-beta: thinking-binding-controls-2026-08-01. Present on every such response from a model that supports extended thinking, as[]when there is no entry to report; without the beta, blocks are removed or left in place all the same but nothing is reported. Removed blocks contribute nothing tousage.input_tokens; blocks left in place count as sent. When streaming, the array is final inmessage_start; the finalmessage_deltaevent carries it only when a server-side model fallback happened mid-stream, in which case it holds the serving model's entries and replaces the one inmessage_start.
-
_type
final JsonValue _type()
Expected to always return the following:
JsonValue.from("message_delta")However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
_contextManagement
final JsonField<BetaContextManagementResponse> _contextManagement()
Returns the raw JSON value of contextManagement.
Unlike contextManagement, this method doesn't throw if the JSON field has an unexpected type.
-
_delta
final JsonField<BetaRawMessageDeltaEvent.Delta> _delta()
Returns the raw JSON value of delta.
Unlike delta, this method doesn't throw if the JSON field has an unexpected type.
-
_usage
final JsonField<BetaMessageDeltaUsage> _usage()
Returns the raw JSON value of usage.
Unlike usage, this method doesn't throw if the JSON field has an unexpected type.
-
_inputTransformations
final JsonField<List<BetaInputTransformation>> _inputTransformations()
Returns the raw JSON value of inputTransformations.
Unlike inputTransformations, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final BetaRawMessageDeltaEvent.Builder toBuilder()
-
validate
final BetaRawMessageDeltaEvent 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 BetaRawMessageDeltaEvent.Builder builder()
Returns a mutable builder for constructing an instance of BetaRawMessageDeltaEvent.
The following fields are required:
.contextManagement() .delta() .usage()
-
-
-
-