Class: ClaudeAgentSDK::ResultMessage
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Result message with cost and usage information
Instance Attribute Summary collapse
-
#api_error_status ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#deferred_tool_use ⇒ Object
DeferredToolUse, populated when a PreToolUse hook deferred.
-
#duration_api_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#duration_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#errors ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#fast_mode_state ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#is_error ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#model_usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#num_turns ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#permission_denials ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#result ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#session_id ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#stop_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#structured_output ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#subtype ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#terminal_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#total_cost_usd ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#uuid ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
Method Summary
Methods inherited from Type
#[], #[]=, from_hash, #initialize, #to_h, wrap
Constructor Details
This class inherits a constructor from ClaudeAgentSDK::Type
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type
Instance Attribute Details
#api_error_status ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def api_error_status @api_error_status end |
#deferred_tool_use ⇒ Object
DeferredToolUse, populated when a PreToolUse hook deferred
438 439 440 |
# File 'lib/claude_agent_sdk/types.rb', line 438 def deferred_tool_use @deferred_tool_use end |
#duration_api_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def duration_api_ms @duration_api_ms end |
#duration_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def duration_ms @duration_ms end |
#errors ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def errors @errors end |
#fast_mode_state ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def fast_mode_state @fast_mode_state end |
#is_error ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def is_error @is_error end |
#model_usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def model_usage @model_usage end |
#num_turns ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def num_turns @num_turns end |
#permission_denials ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def @permission_denials end |
#result ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def result @result end |
#session_id ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def session_id @session_id end |
#stop_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def stop_reason @stop_reason end |
#structured_output ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def structured_output @structured_output end |
#subtype ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def subtype @subtype end |
#terminal_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def terminal_reason @terminal_reason end |
#total_cost_usd ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def total_cost_usd @total_cost_usd end |
#usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def usage @usage end |
#uuid ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
427 428 429 |
# File 'lib/claude_agent_sdk/types.rb', line 427 def uuid @uuid end |