Crate turboclaude

Crate turboclaude 

Source
Expand description

§TurboClaude SDK

Rust SDK for Anthropic’s Claude API supporting:

  • Messages API with streaming
  • Batch processing
  • Tool use and function calling
  • Multi-cloud providers (Anthropic, AWS Bedrock, Google Vertex AI)
  • Multiple authentication methods
  • Automatic retries and rate limiting

§Quick Start

use turboclaude::{Client, Message, MessageRequest};
use turboclaude_protocol::types::models;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("your-api-key");

    let message = client.messages()
        .create(MessageRequest::builder()
            .model(models::CLAUDE_SONNET_4_5_20250514)
            .max_tokens(1024u32)
            .messages(vec![
                Message::user("Hello, Claude!")
            ])
            .build()?)
        .await?;

    println!("{}", message.text());
    Ok(())
}

Re-exports§

pub use client::Client;
pub use config::ClientConfig;
pub use context::AdaptiveStrategy;
pub use context::PruningPolicy;
pub use error::Error;
pub use error::Result;
pub use http::RawResponse;
pub use resources::BatchRequest;
pub use resources::TokenCount;
pub use types::*;

Modules§

client
Main client implementation for the Anthropic API
config
Configuration for the Anthropic client
context
Adaptive context management with token-aware pruning
error
Error types for the Anthropic SDK
http
HTTP client abstraction and middleware
observability
Centralized observability utilities for structured logging and metrics
prelude
Prelude module for common imports
resources
API resource endpoints
streaming
Streaming support for the Messages API
streaming_validation
Streaming event validation for message streams
types
Core types for the Anthropic API
validation
Request validation for the Anthropic SDK

Enums§

JsonValue
Represents any valid JSON value.

Constants§

AI_PROMPT
Legacy AI prompt constant (for compatibility)
DEFAULT_API_VERSION
Default API version header value
DEFAULT_BASE_URL
Default API base URL
HUMAN_PROMPT
Legacy human prompt constant (for compatibility)
VERSION
SDK version, automatically updated from Cargo.toml

Traits§

Deserialize
A data structure that can be deserialized from any data format supported by Serde.
Serialize
A data structure that can be serialized into any data format supported by Serde.

Attribute Macros§

async_trait

Derive Macros§

Deserialize
Serialize