struct LlmClient {
struct String host;
unsigned short port;
struct String model;
struct String apiKey;
}Fields
sent as 'Authorization: Bearer <apiKey>' when non-empty
Methods
POSTs 'messages' (Vec<struct LlmMessage>) to '<client.host>:<client.port>/v1/chat/completions' as '{"model":..., "messages":[{"role":...,"content":...}, ...]}' and returns 'choices[0].message.content' from the JSON response. *ok is set to 0 on any transport, HTTP-status, or JSON-shape failure.
§
static struct LlmClient new(
const &char host,
unsigned short port,
const &char model,
const &char apiKey,
)source · definition