| Crates.io | openai2 |
| lib.rs | openai2 |
| version | 2.0.0 |
| created_at | 2022-08-05 21:52:42.936921+00 |
| updated_at | 2023-03-17 15:08:15.580924+00 |
| description | OpenAi client, generated from the OpenAPI spec. |
| homepage | https://github.com/libninja/openai-rs |
| repository | https://github.com/libninja/openai-rs |
| max_upload_size | |
| id | 639577 |
| size | 132,581 |
OpenAi client, generated from the OpenAPI spec.
use openai::OpenAiClient;
use openai::model::*;
#[tokio::main]
async fn main() {
let client = OpenAiClient::from_env();
let response = client.list_engines().await.unwrap();
println!("{:#?}", response);
}
This example loads configuration from environment variables, specifically:
OPENAI_API_KEY - Your OpenAI API keyAdd this to your Cargo.toml:
[dependencies]
openai2 = "2"
The crate is named openai2, but it is imported as openai:
use openai;
You can see working examples of every API call in the examples/ directory.
Contributions are welcome!
Library created with Libninja.