claude-api 0.5.0

Type-safe Rust client for the Anthropic API
Documentation
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2024"
rust-version = "1.90"
name = "claude-api"
version = "0.5.0"
build = "build.rs"
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Type-safe Rust client for the Anthropic API"
documentation = "https://docs.rs/claude-api"
readme = "README.md"
keywords = [
    "anthropic",
    "claude",
    "api",
    "ai",
    "llm",
]
categories = [
    "api-bindings",
    "asynchronous",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/joshrotenberg/claude-api"
resolver = "2"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
    "--cfg",
    "docsrs",
]

[features]
admin = ["async"]
async = [
    "dep:tokio",
    "dep:reqwest",
    "dep:async-trait",
    "dep:futures-util",
    "dep:bytes",
    "dep:tokio-util",
    "reqwest?/stream",
    "reqwest?/multipart",
]
bedrock = [
    "dep:aws-sigv4",
    "dep:aws-credential-types",
]
conversation = ["async"]
default = [
    "async",
    "rustls",
    "streaming",
]
derive = [
    "dep:claude-api-derive",
    "schemars-tools",
    "async",
]
managed-agents = []
managed-agents-preview = ["async"]
native-tls = ["reqwest?/native-tls"]
pricing = []
rustls = ["reqwest?/rustls-tls"]
schemars-tools = ["dep:schemars"]
skills = ["async"]
streaming = ["dep:eventsource-stream"]
sync = [
    "dep:reqwest",
    "reqwest?/blocking",
]
user-profiles = ["async"]
vertex = ["dep:gcp_auth"]

[lib]
name = "claude_api"
path = "src/lib.rs"

[[example]]
name = "agent_loop"
path = "examples/agent_loop.rs"
required-features = [
    "async",
    "conversation",
]

[[example]]
name = "basic"
path = "examples/basic.rs"
required-features = ["async"]

[[example]]
name = "blocking"
path = "examples/blocking.rs"
required-features = ["sync"]

[[example]]
name = "conversation"
path = "examples/conversation.rs"
required-features = [
    "async",
    "conversation",
    "pricing",
]

[[example]]
name = "derived_tool"
path = "examples/derived_tool.rs"
required-features = [
    "async",
    "conversation",
    "derive",
]

[[example]]
name = "document"
path = "examples/document.rs"
required-features = ["async"]

[[example]]
name = "streaming"
path = "examples/streaming.rs"
required-features = [
    "async",
    "streaming",
]

[[example]]
name = "streaming_callbacks"
path = "examples/streaming_callbacks.rs"
required-features = [
    "async",
    "streaming",
]

[[example]]
name = "tool_use"
path = "examples/tool_use.rs"
required-features = ["async"]

[[example]]
name = "typed_tools"
path = "examples/typed_tools.rs"
required-features = [
    "async",
    "conversation",
    "schemars-tools",
]

[[example]]
name = "vision"
path = "examples/vision.rs"
required-features = ["async"]

[[test]]
name = "bedrock_live"
path = "tests/bedrock_live.rs"

[[test]]
name = "blocking"
path = "tests/blocking.rs"

[[test]]
name = "derive"
path = "tests/derive.rs"

[[test]]
name = "messages"
path = "tests/messages.rs"

[[test]]
name = "models"
path = "tests/models.rs"

[[test]]
name = "streaming"
path = "tests/streaming.rs"

[dependencies.async-trait]
version = "0.1"
optional = true

[dependencies.aws-credential-types]
version = "1"
optional = true

[dependencies.aws-sigv4]
version = "1"
optional = true

[dependencies.bytes]
version = "1"
optional = true

[dependencies.claude-api-derive]
version = "0.5.0"
optional = true

[dependencies.eventsource-stream]
version = "0.2"
optional = true

[dependencies.futures-util]
version = "0.3"
optional = true

[dependencies.gcp_auth]
version = "0.12"
optional = true

[dependencies.http]
version = "1.1"

[dependencies.reqwest]
version = "0.12"
features = ["json"]
optional = true
default-features = false

[dependencies.schemars]
version = "0.8"
optional = true

[dependencies.serde]
version = "1.0"
features = ["derive"]

[dependencies.serde_json]
version = "1.0"

[dependencies.thiserror]
version = "2.0"

[dependencies.tokio]
version = "1"
features = [
    "time",
    "sync",
]
optional = true

[dependencies.tokio-util]
version = "0.7"
features = [
    "io",
    "rt",
]
optional = true

[dependencies.tracing]
version = "0.1"

[dev-dependencies.futures-util]
version = "0.3"

[dev-dependencies.pretty_assertions]
version = "1.4"

[dev-dependencies.serde_json]
version = "1.0"

[dev-dependencies.tokio]
version = "1"
features = [
    "macros",
    "rt-multi-thread",
    "time",
]

[dev-dependencies.wiremock]
version = "0.6"

[build-dependencies.serde]
version = "1.0"
features = ["derive"]

[build-dependencies.toml]
version = "0.8"
features = ["parse"]
default-features = false

[lints.clippy]
missing_errors_doc = "allow"
module_name_repetitions = "allow"
must_use_candidate = "allow"

[lints.clippy.pedantic]
level = "warn"
priority = -1

[lints.rust]
missing_docs = "warn"
unsafe_code = "forbid"