ProviderConfig class final

One provider entry the user configured: where to send requests and which model to use. The API key is not part of it; it lives in an ApiKeyStore.

Constructors

ProviderConfig({required String id, required String name, required ProviderProtocol protocol, required String baseUrl, required String model, String? presetId, StructuredOutputMode structuredOutput = StructuredOutputMode.jsonSchema, MaxTokensField maxTokensField = MaxTokensField.maxTokens})
const
ProviderConfig.fromJson(Map<String, Object?> json)
Restores a config written by toJson. Unknown enum values fall back to the defaults; a missing id or baseUrl, or a field of the wrong type, throws FormatException.
factory

Properties

baseUrl → String
API root, for example https://api.openai.com/v1.
final
hashCode → int
The hash code for this object.
no setteroverride
host → String
Host the prompts are sent to, for showing to the user.
no setter
id → String
Unique within the app; also the key of the API key in the key store.
final
maxTokensField → MaxTokensField
final
model → String
Model identifier sent to the provider, for example qwen3:8b.
final
name → String
Name shown to the user.
final
presetId → String?
The preset this entry was created from, if any.
final
protocol → ProviderProtocol
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
structuredOutput → StructuredOutputMode
final

Methods

copyWith({String? name, ProviderProtocol? protocol, String? baseUrl, String? model, StructuredOutputMode? structuredOutput, MaxTokensField? maxTokensField}) → ProviderConfig
endpoint(String path) → Uri
baseUrl joined with path (which starts with /).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
Everything except the API key, which must never be stored with it.
toString() → String
A string representation of this object.
override
validate() → List<ProviderConfigError>
Problems that stop this config from being used; empty when it is valid.

Operators

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

Static Methods

isPrivateHost(String host) → bool
Whether host is loopback, link-local, on a private network (RFC 1918, carrier-grade NAT such as Tailscale, IPv6 unique-local) or a local name, where plain HTTP is acceptable for a local model server.