OpenAI Chat Completions adapter.
Handles the wire format for the /v1/chat/completions endpoint.
This adapter is also used by OpenRouter, Ollama, Groq, DeepSeek,
xAI, and other OpenAI-compatible providers.
Capabilities
- Streaming via SSE
- Tool/function calling
- Extended thinking via
reasoning_effort(o-series models) - Model listing via
/v1/models
Request format
Encodes messages into OpenAI's %{"role" => ..., "content" => ...} format.
System prompts become a system message. Tool definitions use the
%{"type" => "function", "function" => ...} wrapper.
SSE events
data: {"choices": [{"delta": ...}]}— text, thinking, or tool call chunksdata: [DONE]— end of stream