pub struct Model {Show 18 fields
pub name: &'static str,
pub family: &'static str,
pub version: &'static str,
pub anthropic_id: &'static str,
pub bedrock_id: Option<&'static str>,
pub bedrock_global_id: Option<&'static str>,
pub vertex_id: Option<&'static str>,
pub max_context_tokens: u32,
pub max_context_tokens_extended: Option<u32>,
pub max_output_tokens: u32,
pub supports_vision: bool,
pub supports_tools: bool,
pub supports_caching: bool,
pub supports_extended_thinking: bool,
pub supports_effort: bool,
pub cost_per_mtok_input: f64,
pub cost_per_mtok_output: f64,
pub description: &'static str,
}Expand description
Model capabilities and constraints
Fields§
§name: &'static strHuman-readable model name
family: &'static strModel family (e.g., “sonnet”, “opus”, “haiku”)
version: &'static strRelease date/version identifier
anthropic_id: &'static strAnthropic API model identifier
bedrock_id: Option<&'static str>AWS Bedrock regional endpoint model identifier (if available)
bedrock_global_id: Option<&'static str>AWS Bedrock global endpoint model identifier (if available)
Claude 4.5+ models support global endpoints for dynamic routing. Use this for maximum availability across regions.
vertex_id: Option<&'static str>Google Vertex AI model identifier (if available)
max_context_tokens: u32Maximum context window in tokens (standard)
max_context_tokens_extended: Option<u32>Extended context window in tokens (if available)
Some models support extended context with beta headers.
For example, Claude Sonnet 4.5 and Sonnet 4 support 1M tokens
with the context-1m-2025-08-07 beta header.
max_output_tokens: u32Maximum output tokens per request
supports_vision: boolSupports vision (image inputs)
supports_tools: boolSupports tool use
supports_caching: boolSupports prompt caching
supports_extended_thinking: boolSupports extended thinking
supports_effort: boolSupports effort parameter (beta)
Requires beta header: anthropic-beta: effort-2025-11-24
Currently only Claude Opus 4.5
cost_per_mtok_input: f64Cost per million input tokens (USD)
cost_per_mtok_output: f64Cost per million output tokens (USD)
description: &'static strBrief description of best use cases
Implementations§
Source§impl Model
impl Model
Sourcepub fn anthropic_id(&self) -> &'static str
pub fn anthropic_id(&self) -> &'static str
Get the model ID for the Anthropic API
Sourcepub fn bedrock_id(&self) -> Option<&'static str>
pub fn bedrock_id(&self) -> Option<&'static str>
Get the model ID for AWS Bedrock regional endpoint (if available)
Sourcepub fn bedrock_id_for_region(&self, region: BedrockRegion) -> Option<String>
pub fn bedrock_id_for_region(&self, region: BedrockRegion) -> Option<String>
Get the model ID for AWS Bedrock with a specific region prefix
§Example
use claude_sdk::models::{CLAUDE_SONNET_4_5, BedrockRegion};
// Standard regional endpoint
let regional = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Standard);
// → Some("anthropic.claude-sonnet-4-5-20250929-v1:0")
// Global endpoint
let global = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Global);
// → Some("global.anthropic.claude-sonnet-4-5-20250929-v1:0")
// US regional endpoint
let us = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::US);
// → Some("us.anthropic.claude-sonnet-4-5-20250929-v1:0")Sourcepub fn bedrock_global_id(&self) -> Option<&'static str>
pub fn bedrock_global_id(&self) -> Option<&'static str>
Get the model ID for AWS Bedrock global endpoint (if available)
Global endpoints provide dynamic routing for maximum availability. Available for Claude 4.5+ models.
This is a convenience method equivalent to bedrock_id_for_region(BedrockRegion::Global).
Sourcepub fn vertex_id(&self) -> Option<&'static str>
pub fn vertex_id(&self) -> Option<&'static str>
Get the model ID for Google Vertex AI (if available)
Sourcepub fn supports_extended_context(&self) -> bool
pub fn supports_extended_context(&self) -> bool
Check if this model supports extended context (e.g., 1M tokens)
Sourcepub fn max_extended_context(&self) -> Option<u32>
pub fn max_extended_context(&self) -> Option<u32>
Get the extended context window size (if supported)
Returns Some(tokens) if the model supports extended context with beta headers.
For example, Claude Sonnet 4.5 returns Some(1_000_000).
§Beta Header Required
To use extended context, include the beta header in your API request:
- Header:
anthropic-beta: context-1m-2025-08-07
Note: Extended context may incur additional costs beyond 200K tokens.
Sourcepub fn validate_request(
&self,
max_tokens: u32,
use_extended_context: bool,
) -> Result<(), String>
pub fn validate_request( &self, max_tokens: u32, use_extended_context: bool, ) -> Result<(), String>
Validate that a request is compatible with this model’s constraints
§Parameters
max_tokens: The requested maximum output tokensuse_extended_context: Whether extended context will be used
Sourcepub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
pub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
Estimate cost for a request
Trait Implementations§
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
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> 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