anthropic_client 0.1.3

A library for interacting with the Anthropic API
Documentation
# Anthropic API Client


A Rust library for interacting with the Anthropic API.

## Installation


Add the following to your `Cargo.toml` file:

```toml
[dependencies]
anthropic_api = "0.1.0"

Usage

Here's a simple example of how to use the anthropic_api crate to send a request to the Anthropic API:

use anthropic_api::send_request;

fn main() {
    let content = "Hello, Anthropic!";
    let model = "claude-3-opus-20240229";

    match send_request(content, model) {
        Ok(response) => println!("Response: {}", response),
        Err(e) => eprintln!("Error: {}", e),
    }
}

Make sure to set the ANTHROPIC_API_KEY environment variable with your Anthropic API key before running the code. Make sure to set the ANTHROPIC_API_URL environment variable with your Anthropic API key before running the code. Make sure to set the ANTHROPIC_API_VERSION environment variable with your Anthropic API key before running the code.

ANTHROPIC_API_URL=https://api.anthropic.com/v1/messages
ANTHROPIC_API_VERSION=2023-06-01
ANTHROPIC_API_KEY=xxxxxxxx

API

send_request(content: &str) -> Result<String, Box<dyn std::error::Error>>

Sends a request to the Anthropic API with the provided content and returns the response as a String.

  • content: The content to send to the Anthropic API.
  • Returns: A Result containing the response string on success, or an error on failure.

License

This project is licensed under the MIT License. See the LICENSE file for details.