Skip to main content

Crate llm_stack_anthropic

Crate llm_stack_anthropic 

Source
Expand description

Anthropic Claude provider for the llm-stack SDK.

This crate implements Provider for Anthropic’s Messages API, supporting both non-streaming and streaming generation with full tool-calling and extended thinking support.

§Quick start

use llm_stack_anthropic::{AnthropicConfig, AnthropicProvider};
use llm_stack::{ChatMessage, ChatParams, Provider};

let provider = AnthropicProvider::new(AnthropicConfig {
    api_key: std::env::var("ANTHROPIC_API_KEY").unwrap(),
    ..Default::default()
});

let params = ChatParams {
    messages: vec![ChatMessage::user("Hello!")],
    ..Default::default()
};

let response = provider.generate(&params).await?;
println!("{}", response.text().unwrap_or("no text"));

Structs§

AnthropicConfig
Configuration for the Anthropic provider.
AnthropicFactory
Factory for creating AnthropicProvider instances from configuration.
AnthropicProvider
Anthropic Claude provider implementing Provider.

Functions§

register_global
Registers the Anthropic factory with the global registry.