Skip to main content

Model

Struct Model 

Source
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 str

Human-readable model name

§family: &'static str

Model family (e.g., “sonnet”, “opus”, “haiku”)

§version: &'static str

Release date/version identifier

§anthropic_id: &'static str

Anthropic 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: u32

Maximum 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: u32

Maximum output tokens per request

§supports_vision: bool

Supports vision (image inputs)

§supports_tools: bool

Supports tool use

§supports_caching: bool

Supports prompt caching

§supports_extended_thinking: bool

Supports extended thinking

§supports_effort: bool

Supports effort parameter (beta)

Requires beta header: anthropic-beta: effort-2025-11-24 Currently only Claude Opus 4.5

§cost_per_mtok_input: f64

Cost per million input tokens (USD)

§cost_per_mtok_output: f64

Cost per million output tokens (USD)

§description: &'static str

Brief description of best use cases

Implementations§

Source§

impl Model

Source

pub fn anthropic_id(&self) -> &'static str

Get the model ID for the Anthropic API

Source

pub fn bedrock_id(&self) -> Option<&'static str>

Get the model ID for AWS Bedrock regional endpoint (if available)

Source

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")
Source

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).

Source

pub fn vertex_id(&self) -> Option<&'static str>

Get the model ID for Google Vertex AI (if available)

Source

pub fn supports_extended_context(&self) -> bool

Check if this model supports extended context (e.g., 1M tokens)

Source

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.

Source

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 tokens
  • use_extended_context: Whether extended context will be used
Source

pub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64

Estimate cost for a request

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Model

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Model

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Model

Source§

fn eq(&self, other: &Model) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more