claude-api 0.5.0

Type-safe Rust client for the Anthropic API
Documentation
//! Type-safe Rust client for the Anthropic API.
//!
//! See the [crate README](https://github.com/joshrotenberg/claude-api) for an overview.

#![cfg_attr(docsrs, feature(doc_cfg))]

#[allow(dead_code)]
pub(crate) const ANTHROPIC_VERSION: &str = "2023-06-01";
#[allow(dead_code)]
pub(crate) const DEFAULT_BASE_URL: &str = "https://api.anthropic.com";
#[allow(dead_code)]
pub(crate) const USER_AGENT: &str = concat!("claude-api-rs/", env!("CARGO_PKG_VERSION"));

pub mod auth;
pub mod beta;
pub mod error;

#[cfg(feature = "bedrock")]
#[cfg_attr(docsrs, doc(cfg(feature = "bedrock")))]
pub mod bedrock;

#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub mod client;

#[cfg(feature = "sync")]
#[cfg_attr(docsrs, doc(cfg(feature = "sync")))]
pub mod blocking;

#[cfg(any(feature = "async", feature = "sync"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "async", feature = "sync"))))]
pub mod retry;

pub(crate) mod forward_compat;

#[cfg(feature = "streaming")]
#[cfg_attr(docsrs, doc(cfg(feature = "streaming")))]
pub mod sse;

pub mod pagination;

#[cfg(feature = "pricing")]
#[cfg_attr(docsrs, doc(cfg(feature = "pricing")))]
pub mod pricing;

#[cfg(feature = "conversation")]
#[cfg_attr(docsrs, doc(cfg(feature = "conversation")))]
pub mod conversation;

#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub mod tool_dispatch;

#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub mod dry_run;

#[cfg(all(feature = "async", feature = "pricing"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "async", feature = "pricing"))))]
pub mod cost_preview;

pub mod types;

pub mod batches;
pub mod files;
pub mod messages;
pub mod models;

#[cfg(feature = "managed-agents-preview")]
#[cfg_attr(docsrs, doc(cfg(feature = "managed-agents-preview")))]
pub mod managed_agents;

#[cfg(feature = "admin")]
#[cfg_attr(docsrs, doc(cfg(feature = "admin")))]
pub mod admin;

#[cfg(feature = "skills")]
#[cfg_attr(docsrs, doc(cfg(feature = "skills")))]
pub mod skills;

#[cfg(feature = "user-profiles")]
#[cfg_attr(docsrs, doc(cfg(feature = "user-profiles")))]
pub mod user_profiles;

pub use beta::BetaHeader;
#[cfg(feature = "async")]
pub use client::{Client, ClientBuilder};
pub use error::{Error, Result};

/// Procedural-macro re-exports for the `derive` feature.
///
/// Bring [`Tool`](crate::derive::Tool) into scope to derive
/// [`tool_dispatch::Tool`] on a struct that
/// implements [`serde::Deserialize`] and [`schemars::JsonSchema`].
#[cfg(feature = "derive")]
#[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
pub mod derive {
    pub use claude_api_derive::Tool;
}

/// Implementation detail: re-exports used by macros generated by the
/// `derive` feature. Not part of the public API; do not use directly.
#[cfg(feature = "derive")]
#[doc(hidden)]
pub mod __private {
    pub use async_trait;
    pub use schemars;
    pub use serde_json;
}