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 moreSource§impl Serialize for ModelSpec
impl Serialize for ModelSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ModelSpec
Auto Trait Implementations§
impl Freeze for ModelSpec
impl RefUnwindSafe for ModelSpec
impl Send for ModelSpec
impl Sync for ModelSpec
impl Unpin for ModelSpec
impl UnsafeUnpin for ModelSpec
impl UnwindSafe for ModelSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more