pub struct AnthropicCreateMessageRequest {Show 18 fields
pub model: String,
pub max_tokens: u32,
pub messages: Vec<AnthropicMessage>,
pub nvext: Option<Value>,
pub system: Option<SystemContent>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub stop_sequences: Option<Vec<String>>,
pub stream: bool,
pub metadata: Option<Value>,
pub tools: Option<Vec<AnthropicTool>>,
pub tool_choice: Option<AnthropicToolChoice>,
pub cache_control: Option<CacheControl>,
pub thinking: Option<ThinkingConfig>,
pub service_tier: Option<String>,
pub container: Option<String>,
pub output_config: Option<Value>,
}Expand description
Top-level request body for POST /v1/messages.
Fields§
§model: StringThe model to use (e.g. “claude-sonnet-4-20250514”).
max_tokens: u32The maximum number of tokens to generate.
messages: Vec<AnthropicMessage>The conversation messages.
nvext: Option<Value>Dynamo protocol extension envelope. Protocol parsing keeps this opaque; LLM request handling owns extension validation and normalization.
system: Option<SystemContent>Optional system prompt (string or array of {"type":"text","text":"..."} blocks).
temperature: Option<f32>Sampling temperature (0.0 - 1.0).
top_p: Option<f32>Nucleus sampling parameter.
top_k: Option<u32>Top-K sampling parameter.
stop_sequences: Option<Vec<String>>Custom stop sequences.
stream: boolWhether to stream the response.
metadata: Option<Value>Optional metadata (e.g. user_id).
tools: Option<Vec<AnthropicTool>>Tools the model may call.
tool_choice: Option<AnthropicToolChoice>How the model should choose which tool to call.
cache_control: Option<CacheControl>Top-level cache control for automatic prompt prefix caching. When present, the system caches all content up to the last cacheable block. Matches the Anthropic Messages API automatic caching mode. See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#automatic-caching
thinking: Option<ThinkingConfig>Extended thinking configuration. When enabled, the model produces
thinking content blocks containing its internal reasoning before
the final response. The budget_tokens field controls how many tokens
the model may use for thinking (must be >= 1024 and < max_tokens).
service_tier: Option<String>Service tier selection: "auto" or "standard_only".
container: Option<String>Container identifier for stateful sandbox sessions.
output_config: Option<Value>Output configuration: effort level and optional JSON schema format.
effort can be "low", "medium", "high", or "max".
format specifies structured JSON output constraints.
Implementations§
Source§impl AnthropicCreateMessageRequest
impl AnthropicCreateMessageRequest
Sourcepub fn estimate_tokens(&self) -> u32
pub fn estimate_tokens(&self) -> u32
Estimate input token count using the same len/3 heuristic as /count_tokens.