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
//! # anthropic — community Rust SDK for the Anthropic API
//!
//! This crate is an early port of the official
//! [`anthropic-sdk-go`](https://github.com/anthropics/anthropic-sdk-go) to Rust.
//! v0 implements only the non-streaming Messages API; streaming, tool use,
//! multimodal, files, batches, Bedrock, Vertex, and the beta surface are
//! tracked in `ROADMAP.md`.
//!
//! ## Quickstart
//!
//! ```no_run
//! use anthropic::types::{InputMessage, MessageCreateParams, model};
//!
//! # async fn run() -> anthropic::Result<()> {
//! // Reads ANTHROPIC_API_KEY from the environment.
//! let client = anthropic::Client::from_env()?;
//!
//! let response = client
//! .messages()
//! .create(
//! MessageCreateParams::builder()
//! .model(model::CLAUDE_HAIKU_4_5)
//! .max_tokens(256)
//! .messages(vec![InputMessage::user("Say hi in one short sentence.")])
//! .build(),
//! )
//! .await?;
//!
//! println!("{}", response.text());
//! # Ok(()) }
//! ```
//!
//! ## Multi-turn
//!
//! ```no_run
//! use anthropic::types::{InputMessage, MessageCreateParams, model};
//!
//! # async fn run() -> anthropic::Result<()> {
//! let client = anthropic::Client::from_env()?;
//! let messages = vec![
//! InputMessage::user("My name is Edinaldo."),
//! InputMessage::assistant("Hello, Edinaldo! How can I help?"),
//! InputMessage::user("What name did I just give you?"),
//! ];
//! let response = client
//! .messages()
//! .create(
//! MessageCreateParams::builder()
//! .model(model::CLAUDE_SONNET_4_6)
//! .max_tokens(256)
//! .messages(messages)
//! .build(),
//! )
//! .await?;
//! println!("{}", response.text());
//! # Ok(()) }
//! ```
//!
//! ## Errors
//!
//! All fallible operations return [`Result<T>`] (alias of `Result<T, Error>`).
//! Non-2xx responses become [`Error::Api`] with the HTTP status, the parsed
//! [`ErrorType`], the server-supplied message, and the `request-id` header.
// Field- and variant-level docs are added selectively where the name isn't
// self-documenting; we don't blanket-warn on every `pub` field for v0.
pub use crate;
pub use crate;
pub use crateMessagesService;
pub use crate;
pub use crate;