Anthropic Rust SDK
An unofficial Rust SDK for the Anthropic API.
Features
- Full async/await support
- Comprehensive error handling
- Pagination support
- Token counting utilities
Installation
Add this to your Cargo.toml:
toml
[dependencies]
anthropic-ai-sdk = "0.0.1"
Quick Start
use AnthropicClient;
use ModelClient;
use env;
async
Examples
Check out the examples directory for more usage examples:
- List Models - How to list available models
- Count Message Tokens - How to count tokens in a message
API Coverage
- List Models
- Create Message
- Count Message Tokens
- Stream Message
- Upload Files
- Delete Files
Development
Prerequisites
- Rust 1.75 or later
- An Anthropic API key
Running Tests
Running Examples
Set your API key
export ANTHROPIC_API_KEY="your-api-key"
Run an example
cargo run --example list-models
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Security
If you discover a security vulnerability within this package, please send an e-mail to the maintainers. All security vulnerabilities will be promptly addressed.
Support
For support questions, please use the GitHub Issues.