OpenAI API for Rust
NOTE: this is a temporary fork of openai_api_rust
(https://github.com/openai-rs/openai-api) which improves the functionality of the image-generation API.
A community-maintained library provides a simple and convenient way to interact with the OpenAI API. No complex async and redundant dependencies.
API
check official API reference
API | Support |
---|---|
Models | ✔️ |
Completions | ✔️ |
Chat | ✔️ |
Images | ✔️ |
Embeddings | ✔️ |
Audio | ✔️ |
Files | ❌ |
Fine-tunes | ❌ |
Moderations | ❌ |
Engines | ❌ |
Usage
Add the following to your Cargo.toml file:
= "0.1.9"
Export your API key into the environment variables
Then use the crate in your Rust code:
use *;
use *;
use *;
Use proxy
Load proxy from env
let openai = new
.use_env_proxy;
Set the proxy manually
let openai = new
.set_proxy;
License
This library is distributed under the terms of the MIT license. See LICENSE for details.