OpenAI Chat Completions (POST /v1/chat/completions).
OpenAI-compatible providers use this codec too; their differences belong in
LlmCall.Request.provider_options and the transport's base URL, not in a new
protocol.
System instructions become a leading system message. Tool results become
role: "tool" messages, emitted before the message's remaining content
because OpenAI requires them directly after the assistant tool call.
usage.prompt_tokens_details carries both cache counters (read and write), and
reasoning_effort accepts none, minimal, low, medium, high, xhigh,
and max; the model decides which it honours.
The deprecated message.function_call and delta.function_call are not decoded
into ToolCalls: OpenAI replaced them with tool_calls, and only the old shape
is kept as Content.Raw, so a legacy provider's call is visible but not
dispatchable through LlmCall.Response.tool_calls/1.
Summary
Functions
Validates the request and encodes it as a POST to the codec's @path.
Functions
@spec encode_request(LlmCall.Request.t(), LlmCall.Config.t()) :: {:ok, LlmCall.EncodedRequest.t()} | {:error, LlmCall.Error.t()}
Validates the request and encodes it as a POST to the codec's @path.