pub fn set_key(value: String)
๐Deprecated since 1.0.0-alpha.16: use the
Credentials
struct insteadExpand description
Sets the key for all OpenAI API functions.
ยงExamples
Use environment variable OPENAI_KEY
defined from .env
file:
use openai::set_key;
use dotenvy::dotenv;
use std::env;
dotenv().ok();
set_key(env::var("OPENAI_KEY").unwrap());