ResponsesClient class

Inheritance

Constructors

ResponsesClient({required String apiKey, String baseUrl = 'https://api.openai.com', Duration timeout = const Duration(seconds: 300), Duration connectTimeout = const Duration(seconds: 60), String? proxyUrl, int maxRetries = 3, int initialRetryDelayMs = 1000, int maxRetryDelayMs = 10000, bool autoPreviousResponseId = true, Set<String>? extraAllowedKeys, Dio? client})

Properties

autoPreviousResponseId → bool
When true (default), the client derives previous_response_id from the last ModelMessage.responseId in messages and only sends messages after that response. When false, no automatic derivation is done; you can still pass 'previous_response_id' explicitly. Disable this if you prefer to always send full history or manage previous_response_id yourself.
final
baseUrl → String
final
connectTimeout → Duration
final
extraAllowedKeys → Set<String>?
Keys from ModelConfig.extra allowed to be forwarded to the API request body. When null (default), uses: { 'reasoning', 'caching', 'expire_at', 'thinking', 'store' }. Pass a custom set at construction to allow additional or different keys.
final
hashCode → int
The hash code for this object.
no setterinherited
initialRetryDelayMs → int
final
maxRetries → int
final
maxRetryDelayMs → int
final
proxyUrl → String?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration
final

Methods

checkResponseId(String responseId) → Future<bool>
Check if a responseId is valid by making a GET request
generate(List<LLMMessage> messages, {List<Tool>? tools, ToolChoice? toolChoice, required ModelConfig modelConfig, bool? jsonOutput, CancelToken? cancelToken}) → Future<ModelMessage>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stream(List<LLMMessage> messages, {List<Tool>? tools, ToolChoice? toolChoice, required ModelConfig modelConfig, bool? jsonOutput, CancelToken? cancelToken}) → Future<Stream<StreamingMessage>>
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited