ModelRef class final

One entry of a role's fallback chain: a concrete model plus an optional API-key base-name override.

Constructors

ModelRef({required String provider, required String modelId, String? apiKeyName, String? baseUrl, int? contextWindow, int? maxTokens})
Creates a model reference.
const
ModelRef.fromYaml(Object? node, {String? role})
Parses one chain entry from yaml: either the string shorthand or a map with provider/model plus optional overrides.
factory
ModelRef.parse(String value, {String? role})
Parses the string shorthand provider/modelId.
factory

Properties

apiKeyName String?
Base name of the API key in the secrets store. Rotation stacks [apiKeyName] with [apiKeyName]_2, [apiKeyName]_3, ... When null, the provider's canonical env name is used.
final
baseUrl String?
Provider base-URL override; the catalog default is used when null.
final
contextWindow int?
Context-window override (tokens); the catalog default is used when null.
final
hashCode int
The hash code for this object.
no setterinherited
label String
The provider/modelId display form.
no setter
maxTokens int?
Max-output-token override; the catalog default is used when null.
final
modelId String
The model id sent to the provider (e.g. anthropic/claude-sonnet-4).
final
provider String
Catalog provider name (e.g. openrouter, openai, anthropic, google); see provider_catalog.dart.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toYaml() String
Serializes to the map form (round-trips with ModelRef.fromYaml).

Operators

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