Skip to main content

Response Formats

This reference provides detailed information about the structure and content of API responses across all endpoints.

Common Response Fields

All successful responses include these standard fields:
usage
object
required
Token usage statistics for the API call
usage.inputTokens
number
required
Number of input tokens processed
usage.outputTokens
number
required
Number of output tokens generated
usage.totalTokens
number
required
Total tokens used (input + output)
usage.reasoningTokens
number
Tokens used for reasoning (if applicable)
usage.cachedInputTokens
number
Cached input tokens (cost savings)
finishReason
string
required
Reason for response completion. Possible values:
  • "stop": Normal completion
  • "length": Response truncated due to length limits
  • "tool_calls": Response ended due to tool usage
warnings
Array
Array of warning messages (usually empty)
providerMetadata
object
Provider-specific metadata (OpenAI, etc.)
traceId
string
required
Unique request trace identifier for debugging

Generate Endpoint Response

Complete Response Structure

Step Object Structure

steps[].stepType
string
Type of processing step ("initial", "tool_execution", etc.)
steps[].toolCalls
Array
Tool calls made during this step
steps[].toolResults
Array
Results from tool executions
steps[].content
Array
Content generated during this step
steps[].text
string
Text content for this step

Streaming Response Events

Event Types

Tool Call Event Format

Tool Result Event Format

Speech-to-Text Response

Memory Management Response

Thread Creation Response

Error Response Format

Common Error Codes

Data Types Reference

Message Format

Tool Call Format

Tool Result Format

Response Size Considerations

Response Size Limits: Large responses may be truncated. Use streaming for long conversations.
Tool Results: Complex tool results are included in full, monitor response sizes.
Token Usage: Track usage statistics to manage costs and rate limits.