CustomModelDefinition class final
A named custom model definition (models.custom.<name>): a concrete
provider/endpoint/model triple with optional token-limit and modality
overrides, switchable at runtime with /model <name>.
Constructors
-
CustomModelDefinition({required String provider, required String baseUrl, required String model, int? contextWindow, int? maxTokens, List<
String> ? input, String? authHeader, Duration? connectTimeout, Duration? streamIdleTimeout}) -
Creates a custom model definition.
const
- CustomModelDefinition.fromYaml(String name, Object? node)
-
Parses one definition from yaml, strictly:
nameis the map key;providermust be a catalog provider name (see providerCatalog),baseUrl/modelnon-empty strings,contextWindow/maxTokenspositive integers,inputa non-empty list oftext/image.factory
Properties
- authHeader → String?
-
Auth header name riding the model to the wire (
authHeader:on the entry, issue #964):x-api-keysendsx-api-key: <key>instead ofAuthorization: Bearer <key>. Null keeps the Bearer default.final - baseUrl → String
-
API base URL.
final
- connectTimeout → Duration?
-
Per-provider connect/first-headers watchdog override
(
connectTimeoutMs, issue #1398). Null keeps the globalproviderTimeouts:value, then the 180 s default.final - contextWindow → int?
-
Total context window in tokens (catalog default when null).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
input
→ List<
String> ? -
Input modalities (
text/image; catalog default when null).final - maxTokens → int?
-
Maximum output tokens (catalog default when null).
final
- model → String
-
Model id sent to the provider.
final
- provider → String
-
Catalog provider name (
openrouter,openai,anthropic,google).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- streamIdleTimeout → Duration?
-
Per-provider stream-idle watchdog override (
streamIdleTimeoutMs, issue #1398). Null keeps the global value, then the 300 s default.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
writeYaml(
StringBuffer buffer, String indent) → void -
Writes the definition as yaml lines at
indent(string values are JSON-quoted — valid yaml scalars that round-trip any url/model id).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited