Overview
async-openai
is an unofficial Rust library for OpenAI.
- It's based on OpenAI OpenAPI spec
- Current features:
- Assistants (Beta)
- Audio (Whisper/TTS)
- Chat
- Completions (Legacy)
- Edits (Deprecated)
- Embeddings
- Files
- Fine-Tuning
- Fine-Tunes (Deprecated)
- Images
- Microsoft Azure OpenAI Service
- Models
- Moderations
- Support SSE streaming on available APIs
- All requests including form submissions (except SSE streaming) are retried with exponential backoff when rate limited by the API server.
- Ergonomic builder pattern for all request objects.
Note on Azure OpenAI Service (AOS): async-openai
primarily implements OpenAI spec, and doesn't try to maintain parity with spec of AOS.
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 ;
use Error;
async
Contributing
Thank you for your time to contribute and improve the project, I'd be happy to have you!
A good starting point would be existing open issues.
License
This project is licensed under MIT license.