Skip to main content

RunLocalResult

TokenUsage

ToolCall

FinishReason

  • stop - Model finished naturally
  • max_tokens - Hit the token limit
  • tool_calls - Model wants to call a tool

Accessing Response Fields

Cost Tracking

The cost field contains the estimated cost in USD, calculated server-side when the span is processed:
The cost field in the immediate response may be null. Accurate cost calculations are available in the Tracia dashboard after span processing.

Usage Patterns

Logging Metrics

Token Budget Management

Performance Monitoring

TypeScript Types

Import the types for type safety: