Mixtape Anthropic SDK
A minimal Anthropic API client. Supports messages, streaming, tools, batching, and token counting.
Most mixtape users should use the main mixtape-core crate with the anthropic feature instead. This crate is the low-level client that powers it.
Quick Start
use ;
async
Streaming
For long responses, streaming provides better feedback:
let stream = client.messages.stream.await?;
let text = stream.collect_text.await?;
// Or get the full message with stop reason and usage
let stream = client.messages.stream.await?;
let message = stream.collect_message.await?;
Tools
use ;
let tool = Tool ;
let params = builder
.user
.tools
.tool_choice
.build;
let response = client.messages.create.await?;
for block in &response.content
Extended Thinking
For complex reasoning:
let params = builder
.user
.thinking // Budget for thinking
.build;
Rate Limits
Access rate limit headers for debugging:
let response = client.messages.create_with_metadata.await?;
if let Some = response.rate_limit
if let Some = response.request_id
Retry Configuration
use RetryConfig;
use Duration;
let client = builder
.api_key
.max_retries
.build?;
// Full control
let client = builder
.api_key
.retry_config
.build?;
Batching
For high-volume workloads:
use ;
let requests = vec!;
let batch = client.batches.create.await?;
println!;
Features
| Feature | Description |
|---|---|
schemars |
Enable JsonSchema derives for tool inputs |