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:Token usage statistics for the API call
Number of input tokens processed
Number of output tokens generated
Total tokens used (input + output)
Tokens used for reasoning (if applicable)
Cached input tokens (cost savings)
Reason for response completion. Possible values:
"stop": Normal completion"length": Response truncated due to length limits"tool_calls": Response ended due to tool usage
Array of warning messages (usually empty)
Provider-specific metadata (OpenAI, etc.)
Unique request trace identifier for debugging
Generate Endpoint Response
Complete Response Structure
Step Object Structure
Type of processing step (
"initial", "tool_execution", etc.)Tool calls made during this step
Results from tool executions
Content generated during this step
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.
