Class: Anthropic::Models::Beta::BetaUsage

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/beta/beta_usage.rb

Defined Under Namespace

Modules: ServiceTier, Speed

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(cache_creation:, cache_creation_input_tokens:, cache_read_input_tokens:, inference_geo:, input_tokens:, iterations:, output_tokens:, server_tool_use:, service_tier:, speed:) ⇒ void

Some parameter documentations has been truncated, see Anthropic::Models::Beta::BetaUsage for more details.

Parameters:



# File 'lib/anthropic/models/beta/beta_usage.rb', line 76


Instance Attribute Details

#cache_creationAnthropic::Models::Beta::BetaCacheCreation?

Breakdown of cached tokens by TTL



11
# File 'lib/anthropic/models/beta/beta_usage.rb', line 11

required :cache_creation, -> { Anthropic::Beta::BetaCacheCreation }, nil?: true

#cache_creation_input_tokensInteger?

The number of input tokens used to create the cache entry.

Returns:

  • (Integer, nil)


17
# File 'lib/anthropic/models/beta/beta_usage.rb', line 17

required :cache_creation_input_tokens, Integer, nil?: true

#cache_read_input_tokensInteger?

The number of input tokens read from the cache.

Returns:

  • (Integer, nil)


23
# File 'lib/anthropic/models/beta/beta_usage.rb', line 23

required :cache_read_input_tokens, Integer, nil?: true

#inference_geoString?

The geographic region where inference was performed for this request.

Returns:

  • (String, nil)


29
# File 'lib/anthropic/models/beta/beta_usage.rb', line 29

required :inference_geo, String, nil?: true

#input_tokensInteger

The number of input tokens which were used.

Returns:

  • (Integer)


35
# File 'lib/anthropic/models/beta/beta_usage.rb', line 35

required :input_tokens, Integer

#iterationsArray<Anthropic::Models::Beta::BetaMessageIterationUsage, Anthropic::Models::Beta::BetaCompactionIterationUsage>?

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


48
49
50
# File 'lib/anthropic/models/beta/beta_usage.rb', line 48

required :iterations,
-> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaIterationsUsageItem] },
nil?: true

#output_tokensInteger

The number of output tokens which were used.

Returns:

  • (Integer)


56
# File 'lib/anthropic/models/beta/beta_usage.rb', line 56

required :output_tokens, Integer

#server_tool_useAnthropic::Models::Beta::BetaServerToolUsage?

The number of server tool requests.



62
# File 'lib/anthropic/models/beta/beta_usage.rb', line 62

required :server_tool_use, -> { Anthropic::Beta::BetaServerToolUsage }, nil?: true

#service_tierSymbol, ...

If the request used the priority, standard, or batch tier.



68
# File 'lib/anthropic/models/beta/beta_usage.rb', line 68

required :service_tier, enum: -> { Anthropic::Beta::BetaUsage::ServiceTier }, nil?: true

#speedSymbol, ...

The inference speed mode used for this request.



74
# File 'lib/anthropic/models/beta/beta_usage.rb', line 74

required :speed, enum: -> { Anthropic::Beta::BetaUsage::Speed }, nil?: true

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/beta_usage.rb', line 110