| Crates.io | clia_deepseek_rs |
| lib.rs | clia_deepseek_rs |
| version | 0.1.4 |
| created_at | 2025-03-04 07:27:07.590624+00 |
| updated_at | 2025-03-04 07:27:07.590624+00 |
| description | A Rust client library for the DeepSeek API (use rustls) |
| homepage | |
| repository | https://github.com/clia-mod/deepseek_rs |
| max_upload_size | |
| id | 1576845 |
| size | 87,117 |
A Rust client library for the DeepSeek API.
tokioResult typeserde serialization supportAdd this to your Cargo.toml:
[dependencies]
deepseek_rs = "0.1.2"
Here's a basic example of how to use the DeepSeek Rust client:
use deepseek::client::Client;
#[tokio::main]
async fn main() {
let client = Client::new("your_api_key");
let request = RequestBody::new_messages(
vec![Message::new_user_message("Hello".to_string())]
);
let response = client.chat_completion(request).await.unwrap();
println!("{}", response);
}
use deepseek_rs::{DeepSeekClient, client::chat_completions::request::{Message, RequestBody}};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DeepSeekClient::default()?;
let request = RequestBody::new_messages(vec![
Message::new_user_message("Hello".to_string())
]);
let response = client.chat_completions(request).await?;
println!("{}", response.choices[0].message.content.unwrap());
Ok(())
}
use deepseek_rs::{
DeepSeekClient,
client::chat_completions::request::{Message, Model, RequestBody}
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DeepSeekClient::default()?;
let request = RequestBody::new_messages(vec![
Message::new_user_message("What is 15 * 7?".to_string())
])
.with_model(Model::DeepSeekReasoner);
let response = client.chat_completions(request).await?;
println!("Reasoning: {}", response.choices[0].message.reasoning_content.unwrap());
println!("Answer: {}", response.choices[0].message.content.unwrap());
Ok(())
}
For more examples, check out the examples directory.
For more detailed information, please refer to the API documentation.
This project is licensed under the MIT License.