Response class

A response from the Responses API.

Contains the model's output along with metadata about the response.

Annotations
  • @immutable

Constructors

Response({required String id, required String object, required int createdAt, required ResponseStatus status, required List<OutputItem> output, ResponseUsage? usage, ResponseError? error, IncompleteDetails? incompleteDetails, String? model, String? instructions, String? previousResponseId, ServiceTier? serviceTier, Map<String, String>? metadata, int? maxOutputTokens, double? temperature, double? topP, bool? background, bool? parallelToolCalls, String? promptCacheKey, PromptCacheRetention? promptCacheRetention, PromptCacheOptions? promptCacheOptions, Moderation? moderation, ReasoningConfig? reasoning, Truncation? truncation})
Creates a Response.
const
Response.fromJson(Map<String, dynamic> json)
Creates a Response from JSON.
factory

Properties

background bool?
Whether the response is a background task.
final
codeInterpreterCalls List<CodeInterpreterCallOutputItem>
Returns all code interpreter call items from the output.
no setter
compactionItems List<CompactionOutputItem>
Returns all compaction items from the output.
no setter
computerCalls List<ComputerCallOutputItem>
Returns all computer call items from the output.
no setter
createdAt int
Unix timestamp of when the response was created.
final
error ResponseError?
Error details if the response failed.
final
fileSearchCalls List<FileSearchCallOutputItem>
Returns all file search call items from the output.
no setter
functionCalls List<FunctionCallOutputItemResponse>
Returns all function call output items.
no setter
hashCode int
The hash code for this object.
no setteroverride
hasToolCalls bool
Whether the response contains any function calls.
no setter
id String
Unique identifier for the response.
final
imageGenerationCalls List<ImageGenerationCallOutputItem>
Returns all image generation call items from the output.
no setter
incompleteDetails IncompleteDetails?
Details about why the response is incomplete.
final
instructions String?
The instructions provided to the model.
final
isComplete bool
Whether the response is complete.
no setter
isFailed bool
Whether the response failed.
no setter
isInProgress bool
Whether the response is still in progress.
no setter
localShellCallOutputs List<LocalShellCallOutputResultItem>
Returns all local shell call output items from the output.
no setter
localShellCalls List<LocalShellCallOutputItem>
Returns all local shell call items from the output.
no setter
maxOutputTokens int?
The maximum number of output tokens requested.
final
mcpCalls List<McpCallOutputItem>
Returns all MCP call items from the output.
no setter
metadata Map<String, String>?
Custom metadata from the request.
final
model String?
The model used to generate the response.
final
moderation Moderation?
Moderation results for the response input and output.
final
object String
Object type, always 'response'.
final
output List<OutputItem>
The output items generated by the model.
final
outputText String
Returns all text content from message output items.
no setter
parallelToolCalls bool?
Whether parallel tool calls were allowed.
final
previousResponseId String?
The ID of the previous response this continues from.
final
promptCacheKey String?
The prompt cache key for this response.
final
promptCacheOptions PromptCacheOptions?
The prompt-caching options that were applied to the response.
final
promptCacheRetention PromptCacheRetention?
The prompt cache retention policy.
final
reasoning ReasoningConfig?
The reasoning configuration used for the response.
final
reasoningItems List<ReasoningItem>
Returns all reasoning items from the output.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceTier ServiceTier?
The service tier used for the request.
final
shellCallOutputs List<ShellCallOutputResultItem>
Returns all shell call output items from the output.
no setter
shellCalls List<ShellCallOutputItem>
Returns all shell call items from the output.
no setter
status ResponseStatus
The status of the response.
final
temperature double?
The temperature used for sampling.
final
toolSearchCalls List<ToolSearchCallOutputItem>
Returns all tool search call items from the output.
no setter
toolSearchOutputs List<ToolSearchOutputItem>
Returns all tool search output items from the output.
no setter
topP double?
The top_p value used for nucleus sampling.
final
truncation Truncation?
The truncation strategy applied to the response.
final
usage ResponseUsage?
Token usage statistics.
final
webSearchCalls List<WebSearchCallOutputItem>
Returns all web search call items from the output.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts to JSON.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override