| Crates.io | openai-rusty |
| lib.rs | openai-rusty |
| version | 0.3.0 |
| created_at | 2025-06-08 15:46:11.184655+00 |
| updated_at | 2025-06-08 15:46:11.184655+00 |
| description | A Rust wrapper for the OpenAI API. |
| homepage | |
| repository | https://github.com/LunaStev/openai_rust |
| max_upload_size | |
| id | 1705004 |
| size | 55,642 |
A minimal, modern, async-first Rust wrapper for the OpenAI API.
reqwestAdd this to your Cargo.toml:
[dependencies]
openai-rusty = "0.3.0"
use openai_rust::{openai_init, openai_chat};
#[tokio::main]
async fn main() {
openai_init("your-api-key");
match openai_chat("Hello, who are you?").await {
Ok(res) => println!("AI: {}", res),
Err(err) => eprintln!("Error: {:?}", err),
}
}
use openai_rust::{openai_init, openai_generate_image};
#[tokio::main]
async fn main() {
openai_init("your-api-key");
let result = openai_generate_image("A cute robot.", 2, "512x512").await;
println!("{:?}", result);
}
use openai-rusty::{openai_init, openai_transcribe_audio};
#[tokio::main]
async fn main() {
openai_init("your-api-key");
let transcript = openai_transcribe_audio("./audio.mp3").await;
println!("{:?}", transcript);
}
You can run built-in examples using:
cargo run --example 01_chat
cargo run --example 02_image
cargo run --example 03_audio
Made with ❤️ by LunaStev