Overview
async-openai
is an unofficial Rust library for OpenAI REST API.
- It's based on OpenAI OpenAPI spec
- Current features:
- Completions (including SSE streaming)
- Edits
- Embeddings
- Files (List, Upload, Delete, Retrieve, Retrieve Content)
- Fine-Tuning
- Images (Generation, Edit, Variation)
- Microsoft Azure Endpoints / AD Authentication
- Models
- Moderations
- Non-streaming requests are retried with exponential backoff when rate limited by the API server.
Being a young project there are rough edges
Usage
The library reads API key from the environment variable OPENAI_API_KEY
.
# On macOS/Linux
# On Windows Powershell
$Env:OPENAI_API_KEY='sk-...'
- Visit examples directory on how to use
async-openai
. - Visit docs.rs/async-openai for docs.
Image Generation Example
use Error;
use async_openai as openai;
use ;
async
Contributing
Thank you for your time to contribute and improve the project, I'd be happy to have you!
License
This project is licensed under MIT license.