pub struct ModelSpec {
pub provider: String,
pub model: String,
pub api_identifier: String,
pub max_output_tokens: usize,
pub input_context: usize,
pub generation: f32,
pub tier: String,
pub legacy: bool,
pub beta_headers: Vec<BetaHeader>,
pub source: ModelSource,
}Expand description
Specification for a single model: its identity, limits, tier, and any beta-header unlocks.
A ModelSpec is the central row of the registry. provider and
tier cross-reference into a ProviderConfig (via
ModelConfiguration::providers and ProviderConfig::tiers).
max_output_tokens and input_context are the base limits; entries
in beta_headers raise them when the corresponding HTTP header is sent.
source is loader-populated and records which layer contributed the
entry — never read from YAML.
§Identifier normalization
The same underlying model is addressable through several identifier formats depending on how the API is reached:
- Canonical (Anthropic direct):
claude-3-7-sonnet-20250219 - Bedrock with region prefix:
us.anthropic.claude-3-7-sonnet-20250219-v1:0 - AWS-direct without region:
anthropic.claude-3-haiku-20240307-v1:0 - Regional gateways:
eu.anthropic.claude-3-opus-20240229-v2:1
All four resolve to the same ModelSpec:
ModelRegistry::get_model_spec tries an exact match first, and on
miss strips region/provider prefixes and version suffixes before
retrying. See ADR-0011 for the design
rationale.
Fields§
§provider: StringAI provider name (e.g., “claude”).
model: StringHuman-readable model name (e.g., “Claude Opus 4”).
api_identifier: StringAPI identifier used for requests (e.g., “claude-3-opus-20240229”).
max_output_tokens: usizeMaximum number of tokens that can be generated in a single response.
input_context: usizeMaximum number of tokens that can be included in the input context.
generation: f32Model generation number (e.g., 3.0, 3.5, 4.0).
tier: StringPerformance tier (e.g., “fast”, “balanced”, “flagship”).
legacy: boolWhether this is a legacy model that may be deprecated.
beta_headers: Vec<BetaHeader>Beta headers that unlock enhanced limits for this model.
source: ModelSourceLayer that contributed this entry. Populated by the loader; never read from YAML.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelSpec
impl<'de> Deserialize<'de> for ModelSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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