Skip to content

OpenAI

VariableRequired
OPENAI_API_KEYYes
Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-4", "messages": [{"role": "user", "content": "Hello!"}]}'
use llmg_providers::openai::OpenAiClient;
use llmg_core::provider::Provider;
let client = OpenAiClient::from_env()?;
// or
let client = OpenAiClient::new("sk-...");
  • Chat completions
  • Embeddings
  • SSE streaming
  • Custom base URL (for proxies)