Anthropik
A Rust client for the Anthropic API, named for my love of pikpik carrots.
Status
This library is functional and actively used in strands-rs, which I develop for fun. If there's interest or need, I'm happy to productionize it further. Open an issue if this would be useful to you.
Why This Library?
I wrote this because existing Anthropic clients for Rust lack active maintainers with serious Rust experience, and a client is straightforward to implement and maintain properly.
Alternatives considered:
- anthropic - Last updated over a year ago
- anthropic-sdk-rust - 7 months since last update
- anthropic_client - Over a year old
- genai - Multi-provider, actively developed
Features
- All Claude models (Sonnet 4.5, Haiku 4.5, Opus 4, legacy models)
- Streaming and non-streaming responses
- Tool use (function calling)
- Vision support (images and PDFs)
- Extended thinking mode
- Prompt caching
- MCP server integration
- Type-safe with non-exhaustive structs for forward compatibility
Installation
Getting Started
use ;
async
For streaming, use messages_stream() and set stream: true in the request body.
Documentation
Full API documentation is available on docs.rs.
For Anthropic API details, see the official documentation.
Design Notes
Most structs are marked #[non_exhaustive] to prevent breakage when new API fields are added. This trades some ergonomics (requiring ..Default::default()) for stability as the library approaches 1.0.
Contributing
Contributions welcome. Open an issue or submit a PR.
License
Licensed under either of:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.