1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Anthropic/Claude provider implementation for ADK.
//!
//! This module provides full API parity with Anthropic's Claude models,
//! including system prompt routing, multimodal content (images and PDFs),
//! streaming with thinking deltas, structured errors, rate-limit-aware retry,
//! prompt caching, extended thinking, token counting, and model discovery.
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
//!
//! let client = AnthropicClient::new(AnthropicConfig::new(
//! std::env::var("ANTHROPIC_API_KEY").unwrap(),
//! "claude-sonnet-4-5-20250929",
//! ))?;
//! ```
//!
//! # Extended Thinking
//!
//! Enable chain-of-thought reasoning with a token budget:
//!
//! ```rust,ignore
//! use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
//!
//! let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-5-20250929")
//! .with_thinking(8192);
//! let client = AnthropicClient::new(config)?;
//! ```
//!
//! # Prompt Caching
//!
//! Reduce latency and cost for repeated prefixes:
//!
//! ```rust,ignore
//! let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-5-20250929")
//! .with_prompt_caching(true);
//! ```
//!
//! # Token Counting
//!
//! Count input tokens without generating a response:
//!
//! ```rust,ignore
//! let count = client.count_tokens(&request).await?;
//! println!("Input tokens: {}", count.input_tokens);
//! ```
//!
//! # Model Discovery
//!
//! List available models or get details for a specific model:
//!
//! ```rust,ignore
//! let models = client.list_models().await?;
//! let info = client.get_model("claude-sonnet-4-5-20250929").await?;
//! ```
//!
//! # Rate Limit Information
//!
//! Inspect rate-limit state after each request:
//!
//! ```rust,ignore
//! let info = client.latest_rate_limit_info().await;
//! if let Some(remaining) = info.requests_remaining {
//! println!("Requests remaining: {remaining}");
//! }
//! ```
//!
//! # Error Handling
//!
//! Structured errors preserve the Anthropic error type, message, status code,
//! and request ID for debugging:
//!
//! ```rust
//! use adk_model::anthropic::AnthropicApiError;
//!
//! let err = AnthropicApiError {
//! error_type: "rate_limit_error".to_string(),
//! message: "Too many requests".to_string(),
//! status_code: 429,
//! request_id: Some("req_abc123".to_string()),
//! };
//! assert!(err.to_string().contains("429"));
//! ```
pub use AnthropicClient;
pub use ;
pub use ;
pub use ModelInfo;
pub use RateLimitInfo;
pub use TokenCount;
// Re-export ToolSearchConfig from adk-anthropic for convenience.
pub use ToolSearchConfig;