Examples
Complete programs for the OpenAI provider. Install the engine, this package, and the tool primitives before running the examples:
npm install @johannes.latzel/llm-chat @johannes.latzel/llm-chat-openai @johannes.latzel/llm-chat-tool
Scenarios
- Structured output: JSON mode and JSON Schema with
lastAssistantJson() - Usage and cost: streamed usage, cached input tokens and a cost estimate
- Reasoning streams: structured fields and inline
<think>markers - Local endpoints: LM Studio, Ollama and vLLM
Guides
- Quick start: install and first request
- Service and configuration: service options and builder
- Environment variables: connection and provider settings
- Tool definitions: define custom tools