Model class final

A model the harness can call.

Ported subset of pi's Model: pricing tiers, thinking-level maps, and per-provider compat beyond OpenAICompletionsCompat are deferred to the phases that need them.

Constructors

Model({required String id, String name = '', required String api, required String provider, required String baseUrl, bool reasoning = false, List<String> input = const ['text'], String? thinkingLevel, ModelCost cost = const ModelCost(), required int contextWindow, required int maxTokens, Map<String, String>? headers, OpenAICompletionsCompat? compat})
const

Properties

api String
The API dialect used to talk to this model (e.g. openai-completions).
final
baseUrl String
Base URL of the API. Swapping this is how OpenRouter and other OpenAI-compatible endpoints are reached (e.g. https://openrouter.ai/api/v1).
final
compat OpenAICompletionsCompat?
Compatibility overrides for OpenAI-compatible APIs. When null, the adapter auto-detects from provider/baseUrl.
final
contextWindow int
Total context window in tokens.
final
cost ModelCost
Pricing used for inline cost accounting.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Default headers sent with every request to this model.
final
id String
The model id sent to the provider (e.g. gpt-4o-mini, anthropic/claude-sonnet-4 on OpenRouter).
final
input List<String>
Input modalities the model accepts: text and/or image.
final
maxTokens int
Maximum output tokens the model can produce.
final
name String
Human-readable display name.
final
provider String
The provider id (e.g. openai, openrouter).
final
reasoning bool
Whether the model produces reasoning/thinking output.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thinkingLevel String?
The config-declared thinking level (minimal…max, issue #734) riding this model from a roles chain entry or the env preconfig; null when undeclared — the adapter options' own level (e.g. AnthropicOptions.thinkingLevel) stays the explicit override.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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