pub struct ModelSpec {
pub id: String,
pub provider_id: String,
pub upstream_model: String,
pub context_window: Option<u32>,
pub max_output_tokens: Option<u32>,
pub modalities: Modalities,
pub knowledge_cutoff: Option<String>,
pub input_token_price_per_million_usd: Option<f64>,
pub output_token_price_per_million_usd: Option<f64>,
}Expand description
Serializable model offering: addressing (id, provider, upstream model), intrinsic capabilities (context window, max output tokens, modalities, knowledge cutoff), and per-million-token pricing.
Fields§
§id: StringStable id used by AgentSpec.model_id. Unique within a registry.
provider_id: StringProvider this offering routes through.
upstream_model: StringModel name sent to the upstream API.
context_window: Option<u32>Maximum context window in tokens, when published by the provider.
max_output_tokens: Option<u32>Hard ceiling on a single response’s output tokens, when published.
modalities: ModalitiesInput/output modalities supported by the model.
Semantics: an empty Modalities (or default()) means the model’s
modality set is unspecified, so runtime stays permissive. Explicit
empty arrays carry the same meaning as omission. When input is
non-empty, runtime rejects requests containing unsupported input
modalities before calling the provider. To advertise a text-only model,
set input: vec![Modality::Text] explicitly.
knowledge_cutoff: Option<String>ISO date string (e.g. “2026-01”) for the model’s training cutoff.
Deserialization rejects any value that is not a well-formed YYYY-MM or
YYYY-MM-DD date. This field is runtime-trusted — it is injected
verbatim into the agent’s system context — so an unvalidated string from
config, a tenant, or an external registry would be a prompt-injection
surface. Validating at the deserialization boundary closes it for every
source.
input_token_price_per_million_usd: Option<f64>Optional input-token price in USD per million tokens. When paired
with output_token_price_per_million_usd, eval runs populate
ReplayReport.cost_usd so cost surfaces in regression diffs.
output_token_price_per_million_usd: Option<f64>Optional output-token price in USD per million tokens.
Implementations§
Trait Implementations§
Source§impl ConfigRecordMerge for ModelSpec
impl ConfigRecordMerge for ModelSpec
type Patch = NoConfigPatch
fn merge_patch( self, _patch: NoConfigPatch, ) -> Result<ModelSpec, ConfigRecordError>
Source§impl<'de> Deserialize<'de> for ModelSpec
impl<'de> Deserialize<'de> for ModelSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ModelSpec
impl JsonSchema for ModelSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more