Expand description
OpenAI-compatible API client.
Works with any provider that implements the OpenAI Chat Completions
API with streaming: OpenAI itself, DeepSeek, Grok, Ollama (via
the ollama() constructor in the parent module), vLLM, LM Studio, etc.
§Construction
ⓘ
use loopctl::provider::OpenAiClient;
// From environment (OPENAI_API_KEY, optional OPENAI_BASE_URL):
let client = OpenAiClient::from_env()?;
// Explicit:
let client = OpenAiClient::builder()
.with_api_key("sk-...")
.with_base_url("https://api.deepseek.com/v1")
.with_model("deepseek-chat")
.build()?;Structs§
- Open
AiClient - An OpenAI-compatible chat completions client with streaming support.
- Open
AiClient Builder - Builder for
OpenAiClient.