OpenAIConfig class

OpenAI provider configuration

This class contains all configuration options for the OpenAI providers. It's extracted from the main provider to improve modularity and reusability.

Constructors

OpenAIConfig.new({required String apiKey, String baseUrl = ProviderDefaults.openaiBaseUrl, String model = ProviderDefaults.openaiDefaultModel, int? maxTokens, double? temperature, String? systemPrompt, Duration? timeout, double? topP, int? topK, List<Tool>? tools, ToolChoice? toolChoice, ReasoningEffort? reasoningEffort, StructuredOutputFormat? jsonSchema, String? voice, String? embeddingEncodingFormat, int? embeddingDimensions, List<String>? stopSequences, String? user, ServiceTier? serviceTier, bool useResponsesAPI = false, String? previousResponseId, List<OpenAIBuiltInTool>? builtInTools, LLMConfig? originalConfig})
const

Properties

apiKey String
final
baseUrl String
final
builtInTools List<OpenAIBuiltInTool>?
Built-in tools to use with Responses API
final
embeddingDimensions int?
final
embeddingEncodingFormat String?
final
hashCode int
The hash code for this object.
no setteroverride
jsonSchema StructuredOutputFormat?
final
maxTokens int?
final
model String
final
originalConfig LLMConfig?
Get the original LLMConfig for HTTP configuration
no setter
previousResponseId String?
Previous response ID for chaining responses (Responses API only)
final
reasoningEffort ReasoningEffort?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceTier ServiceTier?
final
stopSequences List<String>?
final
systemPrompt String?
final
temperature double?
final
timeout Duration?
final
toolChoice ToolChoice?
final
tools List<Tool>?
final
topK int?
final
topP double?
final
user String?
final
useResponsesAPI bool
Whether to use the new Responses API instead of Chat Completions API
final
voice String?
final

Methods

copyWith({String? apiKey, String? baseUrl, String? model, int? maxTokens, double? temperature, String? systemPrompt, Duration? timeout, double? topP, int? topK, List<Tool>? tools, ToolChoice? toolChoice, ReasoningEffort? reasoningEffort, StructuredOutputFormat? jsonSchema, String? voice, String? embeddingEncodingFormat, int? embeddingDimensions, List<String>? stopSequences, String? user, ServiceTier? serviceTier, bool? useResponsesAPI, String? previousResponseId, List<OpenAIBuiltInTool>? builtInTools}) OpenAIConfig
getExtension<T>(String key) → T?
Get extension value from original config
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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