All notable changes to this project are documented here. The format follows Keep a Changelog, and the project adheres to Semantic Versioning.
Unreleased
Fixed
- The README's
config :llm_call, :poolsexamples used keys the code rejects: a:defaultentry, and origin strings such as"https://api.deepseek.com". OnlyLlmCall.Finch.HTTP1andLlmCall.Finch.HTTP2are accepted, so following those three examples failed at boot. They now show a shape that starts, and per-origin tuning is attributed to a provider'spool:, which is the mechanism that actually does it.
0.4.0 - 2026-11-29
Breaking changes
- Two pools, chosen by scheme.
LlmCall.Finch.HTTP2(count: 1, keep-alive PING) serveshttps://;LlmCall.Finch.HTTP1(size: 50) serveshttp://. That is what curl does, and it makeshttp://localhost:11434work with no configuration whilehttps://api.openai.comgets a multiplexing connection.LlmCall.Finch— one HTTP/1 pool — is gone. A provider may choose with
pool: :http1 | :http2 | <Finch pool options>. The declared options are the base and any Finch key overrides it.http_opts: [name: MyPool]still wins, so a host that supervises its own pool keeps it.config :llm_call, :poolsnow keys on the pool name —LlmCall.Finch.HTTP1orLlmCall.Finch.HTTP2— and merges onto the library's shape instead of replacing it. A key that names neither is an error, because it would start a pool nobody calls.
Added
config :llm_call, :poolssizes the default Finch pool. The map is handed toFinch.start_link/1unchanged, so:size,:count,:protocols,:conn_optsand per-origin keys all work, and it is read at boot soconfig/runtime.exscan set it. Unset, the pool is HTTP/2 as described under breaking changes; how much capacity a deployment needs is still not something this library guesses.LlmCall.Application.h2_pool_opts/0,h1_pool_opts/0,pool_opts_for/1,pool_name_for/1andresolved_pool_opts/1expose the two shapes this library considers right for its traffic and how a configuration resolves, so a host can inspect them instead of copying numbers.LlmCall.Protocol.downgrade/2registers an HTTP/1 pool for one origin at runtime. A TLS host that turns out to speak HTTP/1 only cannot be detected without a failed request — Finch reports:pool_not_availableafter:pool_timeout— so the correction is explicit, once per origin, and not a library-side retry.
Changed
- Two providers whose
pool:declarations disagree on one origin are now reported reliably. The record of what configured an origin is kept inLlmCall.PoolRegistry, which decides from the pool that is actually running rather than from what was asked for; the same module is whatLlmCall.Protocol.downgrade/2updates after it replaces a pool.
Fixed
LlmCall.Protocol.downgrade/2now actually changes an origin's protocol. It calledFinch.start_pool/3, which returns:okwithout touching an origin that already has a pool — so on the one case it exists for, ahttps://host that turned out to speak only HTTP/1.1, it did nothing. It now stops the existing pool and waits for the removal before registering the HTTP/1 one.LlmCall.Protocol.downgrade/2leaves an origin that is already on HTTP/1 running instead of stopping and restarting it. It used to interrupt every request in flight on that origin on every call, so a caller correcting on each failed request kept killing a healthy pool. Passing options always replaces the pool, since a pool's configuration cannot be read back from Finch to compare.LlmCall.Protocol.downgrade/2documents that it interrupts requests in flight, which it always did: stopping a pool terminates its connections, and an open request fails with:connection_process_went_down.LlmCall.Protocol.downgrade/2returns{:error, {:unknown_origin, origin}}for an origin that is not an http(s) URL, instead of raisingArgumentErrorout of a function the@specsays returns a value.LlmCall.Providerreports apool:disagreement between two providers on one origin even when both build a client at the same time. The snapshot was read and then written, so both saw the origin as unregistered and neither logged the warning that says one provider's options are not in effect; the claim is now a single:ets.insert_new/2.- A provider's
pool:options are registered again when the origin's pool is gone. The snapshot table records what was asked for and it outlives the pool, so after a supervisor restart, a crash of the origin's pool, or aLlmCall.Protocol.downgrade/2, building a new client found a snapshot for a pool that no longer existed, skippedFinch.start_pool/3, and left the origin with no pool at all — the opposite of what the documentation said rebuilding a client would do. The snapshot is now checked against the instance and replaced when stale. Clearing it is conditional on the value still being the one this process read, so a concurrent rebuild's fresh record is not erased. LlmCall.Protocol.downgrade/2drops the declaration recorded for the origin it corrects. The record describes what a provider asked Finch for, and the correction replaces the pool on purpose, so leaving it made the table describe options that were not in force.- The conflict warning says the declaration "did not configure" the pool instead of naming
the first declaration as the cause. It was wrong after a
downgrade/2, which is the pool's last writer, and the message cannot know which case it is in. - A provider's
pool:is reported when the origin already has a pool this library did not record — a host supervising its own, or oneLlmCall.Protocol.downgrade/2corrected. It used to be dropped in silence, so the declaration simply did not happen and nothing said so. That path is reached on everyclient/1call, so it is reported once per origin rather than once per request; a recorded disagreement still warns every time, because it is a declaration mistake rather than a runtime condition. - A declaration is checked against the origin before its options are claimed. Without that,
LlmCall.Protocol.downgrade/2forgetting the record (above) reopened the window it was meant to close: the next client build claimed the absent record,Finch.start_pool/3was a no-op because the pool was already there, and the table recorded options that never applied. - Two docs said the second provider on an origin replaces the first.
Finch.start_pool/3leaves an existing entry alone, so the first declaration is the one in force — which is what the warning says, and what a measured pool showed. LlmCall.Protocol.origin_of/1raisesArgumentErrorfor abase_urlthat has no scheme or host, instead of returning an empty string its@specdoes not allow.- An exhausted HTTP/1 connection pool is
reason: :pool_timeoutandretryable?: true, not:exceptionand not retryable. Finch reraise/2s its checkout timeout, so the request never reached the provider and a new attempt — or a larger pool — fixes it; reporting it as an opaque exception told callers the opposite. The message now says the pool is saturated and names the knobs. A test drives a real checkout timeout, so an upstream rewording fails instead of silently reclassifying overload. - Finch's HTTP/2 connection reasons (
:disconnected,:connection_closed,:pool_not_available,:connection_process_went_down,:could_not_connect,:connection_dead,:connection_not_ready) areretryable?: true. They were classified permanent, so a dropped or not-yet-established HTTP/2 connection read as a failure a new attempt could not fix — the opposite of what Finch documents. %LlmCall.Error{}.reasonisatom() | tuple() | nilas documented. A string or struct reason had started passing through unchanged, which a caller matching on the documented reasons would silently miss.
0.3.0 - 2026-11-27
Breaking changes
Capabilities.image_inputandfile_inputare%LlmCall.Capabilities.Input{}records instead of booleans, one flag per source kind (inline,url,uri,file). A boolean could not say "bytes yes, URL no", which is what Anthropic and Gemini accept for some parts.%Input{}accepts nothing, which is whatfalsemeant, andInput.accepts?/2answers the question for a concrete part.- Gemini no longer accepts a URL or a bare-string media source.
fileData.fileUritakes ags://object or a Files API URI, so anhttps://URL was a request the service answers with a 400. Use{:uri, "gs://…"}, or{:base64, data}to send the bytes.
Added
auth: {:sigv4, service: ..., region: ...}signs every request with AWS Signature Version 4.credentials:takes a map or a 0-arity function — read once per request, nothing cached — andregion:overrides the declared region per client. The canonical request follows what an AWS SDK produces for the path, the query and the header set, and no runtime dependency is added.LlmCall.Dialect.Bedrock.Converseencodes and decodes Bedrock'sConverseAPI: text, tool use, images and documents inline or from S3, on/converseand on/converse-streamalike. A streamed call mapscontentBlock*andmessageStoponto the IR stream events; because Bedrock sends usage aftermessageStop, the:message_stopterminator is flushed when the body ends, and a stream that never reachesmessageStopis an:invalid_responserather than a quietly truncated one. A frame that reports a stream failure is a provider error, not an event.provider_options.bedrockis merged into the top level of the Converse request, the rule the other codecs follow, soguardrailConfigand Bedrock's other top-level fields are reachable. The canonical envelope keys are reserved and a collision is a:validationerror.additionalModelRequestFieldsis written nested, as it appears on the wire.LlmCall.EventStreamdecodesapplication/vnd.amazon.eventstream: length-prefixed frames, typed headers, CRC-32 over both the prelude and the message, and a truncation check at end of body.- Framing is a codec decision: the optional
stream_framing/0callback onLlmCall.Codec(LlmCall.SSEby default) and theLlmCall.Framingbehaviour driveLlmCall.Stream, which no longer knows what a body chunk is. The four SSE codecs are untouched; a protocol framed as event stream declaresLlmCall.EventStream. {:uri, uri}is a canonical content source for a location only the provider can resolve (s3://for Converse), as distinct from{:url, _}, which the provider fetches over HTTP.LlmCall.Capabilities.Inputhas the matchingurikind.LlmCall.Codec.Conformancederives its sample part from the declared sources instead of always sending a URL image, so an adapter that declares a kind it rejects now fails the suite.- Telemetry:
[:llm_call, :request, ...]and[:llm_call, :stream, ...]events carry the operation, provider, codec and model;:stopadds the outcome, the status, and the token counts as measurements, and a stream reports:first_event(first event) and:first_text(first visible token) separately. No handler is attached, so the cost is zero until a host subscribes. SeeLlmCall.Telemetry.
Fixed
- Anthropic's document validation accepts exactly the sources it can encode. It used to accept any source and then raise on the way out for one it had no encoder for.
0.2.0 - 2026-11-24
Breaking changes
- A stream that ends without its protocol terminator is now an error. OpenAI Chat
and OpenAI Responses used to synthesize a
:message_stop, and Anthropic ended silently, so a body cut short by a proxy limit or a provider bug looked like a completed stream.finish_stream/2on those three codecs returns{:error, %LlmCall.Error{kind: :invalid_response}}, whichLlmCall.Streamraises asLlmCall.HTTP.Error. Gemini keeps flushing, because its protocol has no terminator. - Header values must be printable ASCII with no leading or trailing whitespace.
Values outside that used to reach Mint, which rejects them with a message that
embedded the value — including an
api_key. :pool_strategyvalidates against Finch's own contract:nil, a module exportingselect/2,{module, state}, a 1-arity function, or{2-arity function, state}. It previously accepted:random,:orderedand integers, none of which Finch dispatches on, so every accepted value raised inside Finch.
Added
Request.toolsaccepts atool_callmodule, or{module, opts}withstrict: boolean(). A module contributes one%LlmCall.ToolSpec{}per declared tool, in declaration order; a%LlmCall.ToolSpec{}entry still passes through unchanged, and the three forms mix freely in one list.strict: trueasks for OpenAI's strict schema, whilestrict: falseis treated as absent rather than sent as a flag; a codec with no per-tool flag rejectstrue.LlmCall.Tools.expand/2turns tool entries into specs for a codec, andLlmCall.Tools.normalize_request/2applies it to a whole request. Every entry point that forwards a request to a codec normalizes first:complete/3,stream/3,encode/3,validate_request/3,init_stream/3, andResponses.Connection.create/3.capabilities/3reads no tools.LlmCall.Codec.Conformancecalls the codec callbacks directly, so a request handed to one of its assertions must already carry%LlmCall.ToolSpec{}entries.LlmCall.StreamAssembler.new/1takesmax_argument_bytes, 8 MiB by default. Fragments accumulate across events, which the SSE frame cap cannot bound; past the cap a call finalises with{:too_large, bytes}, a new variant ofLlmCall.ToolCall.arguments_error, andraw_argumentskeeps the prefix that fit.- New dependency
tool_call ~> 0.4, which has no runtime dependencies of its own.
Changed
- The tool schema projection is chosen from
codec.info().protocol::openai_chatand:openai_responsestake the schemaToolCall.emit/3renders for OpenAI,:gemini_generate_contentthe one it renders for Gemini, and any other protocol the neutral schemaToolCall.describe/2returns. Gemini therefore no longer needs a manualto_gemini/2step. LlmCall.HTTP.request/2andstream/4no longer let a transport failure escape. A Finch exception or exit is reported asreason: :exception, and a failure that never produced a response is classified by its reason: the connection-level causes a new attempt can fix areretryable?: true, where every one of them used to befalse.- Tool-argument fragments are kept as iodata and joined once instead of appended per fragment, which was quadratic for large arguments.
ToolResult.is_erroris dropped on OpenAI Chat and Responses, and a tool call whose arguments did not decode is sent as%{}on Anthropic and Gemini. Those protocols have no field for either, so put the failure in the content text and expect to repair a bad arguments fragment without the model seeing it.
Fixed
- A malformed tool entry, a module that does not
use ToolCall, and a schema the selected protocol cannot render are:validationerrors fromTools.expand/2, naming the codec that refused, rather than raises. poll/3returns a typed validation error when an operation'snextis neithernilnor an%EncodedRequest{}, instead of raisingCaseClauseError.- Gemini streaming no longer reports
stop_reason: :tool_callswhen no call was emitted, an unmappable part arrives asStreamDelta.Rawinstead of nothing, and a thought part carrying only a signature arrives asStreamDelta.Thinking. - The OpenAI Responses codec rejects a text, reasoning or tool-argument delta whose payload is not a string, rather than emitting a delta that breaks the documented fold.
- The Anthropic codec refuses image and document blocks in an assistant turn, and
applies the non-empty text rule to text blocks nested in a
tool_result. - A non-2xx response body is capped at 64 KiB, and the error says the body was
truncated rather than reporting invalid JSON. A status and
Retry-Aftercaptured before the body failed are kept instead of being discarded with the accumulator. - An error message copied from a provider is required to be a string, so a gateway
that answers
{"error": {"message": {…}}}cannot break%LlmCall.Error{}. - Gemini's Imagen codec reports an empty
predictionsarray as a:providererror — everything was filtered — instead of:invalid_response. - A failed MiniMax or Seedance job keeps the codec's own
retryable?verdict, and Seedance normalizes a numeric submit id instead of refusing it.
Security
inspecton%LlmCall.Client{},%LlmCall.HTTP.Request{}and%LlmCall.Stream{}leaves out the parts that carry the resolved credential, so logging one no longer prints the key.
Compatibility
- The supported floor moves from OTP 27 to 27.1, which
tool_callrequires forjson:format/1.
0.1.1 - 2026-11-23
Breaking changes
Helpers.validate_params/3is removed. It validated the key names ofparamsbut not their values, sotemperature: "hot"andmax_tokens: -5passed, and its shorter name made it the obvious choice over the spec-driven validator for an out-of-tree adapter. UseHelpers.validate_params_with_spec/4with a@param_spec;Helpers.validate_param_keys/3andHelpers.validate_param_values/4remain as the two halves it composes.
Added
LlmCall.SSEkeeps the server'sretry:hint on the state asretry_msinstead of dropping it, so a caller that owns reconnection policy can read it. The library still never reconnects a stream on its own.
Changed
Gemini tool
parametersandresponseSchemanow reject schemas its OpenAPI subset cannot express: a lowercasetype,additionalProperties,$ref/$defs,prefixItems,oneOforconstis a:validationerror instead of a provider request.ToolSpec.parametersis documented as already-projected wire data.Error.retryable?is now the union of the codec's verdict and the HTTP status (LlmCall.Error.retryable_status?/1:408,425,429,500,502,503,504). Before, a429whose body named a code the codec did not list reportedretryable?: false, while the same429with an unparseable body reportedtrue— better evidence gave the worse answer, and a provider that introduced a new rate-limit code silently stopped retries.LlmCall.Codec.Conformance.assert_capability_consistency/3no longer reports a reasoning budget as rejected by a codec that correctly requires it to be belowparams.max_tokens. The sample now tracks the request, so the suite can be run against Anthropic, which it previously could not.A
paramsvalue is now validated against the protocol, not only its key: atemperatureoutside the documented range, a non-numerictop_p, amax_tokensbelow 1, aseedthat is not an integer, or astopthat is empty, over the limit, or not a string, is a:validationerror instead of a value sent to the provider. The bounds differ per protocol (temperatureis0..2on OpenAI and Gemini,0..1on Anthropic) and are recorded indocs/design.md§8.11.A content part now validates its payload. A
{:base64, data}source must be base64, padding optional; amedia_typemust be atype/subtypesuch asimage/pngrather than free text. Both were previously sent verbatim.
Fixed
- A tool call the decoder could not parse could not be replayed. The decoder keeps
the malformed
raw_argumentsand setsarguments_error, but every codec's validator demanded a decodable object, so an assistant turn carrying that call was rejected. A model does not always generate valid JSON, and the repair is to send that turn back with a tool result saying so — the round trip is now open, while a hand-written fragment with noarguments_erroris still rejected. - The Anthropic codec accepted an empty or whitespace-only text block, and a
whitespace-only
systemprompt, all of which the Messages API rejects (messages: text content blocks must be non-empty,... must contain non-whitespace text). A response can carry an empty text block, so replaying that history produced a request the provider refuses; it is now a:validationerror. OpenAI and Gemini accept the same shape, so the rule stays in this codec. tool_choicewas not cross-referenced againsttools, so{:tool, "typo"}produced a request naming a tool the request never declares. OpenAI and Anthropic reject that with a 400 (Anthropic: "tool_choice not in tools"), and Gemini requiresallowedFunctionNamesto match aFunctionDeclaration.name. It is now a:validationerror naming the undeclared tool; a builtin tool'snamecounts as declared. Gemini's{:allowed, []}is rejected as well, sincemode: ANYderived from it would require a call while allowing none.- The default WebSocket transport raised
FunctionClauseErrorfor a URL that is not a string, becauseURI.parse/1only accepts a binary. TheLlmCall.WSbehaviour promises{:ok, conn()} | {:error, error()}, so a non-string URL is now{:error, {:invalid_url, url}}like any other unusable URL. - The Gemini codec accepted
allOfandnotin toolparametersand inresponseSchema, though its OpenAPI subset cannot express either; both are now:validationerrors likeoneOfandconst. - Two tool specs sharing a
nameare now a:validationerror. The second entry was unreachable, and a provider either rejects the request or picks one. - A provider error whose body is not JSON (a gateway's HTML or plain text) now
keeps an excerpt in
Error.messageinstead of reporting only "unrecognized error payload".Error.rawstill carries maps only, so a non-map body is visible in the message rather than inraw. - A function tool name is now checked against the target protocol's published
class: 64 characters of
[a-zA-Z0-9_-]on OpenAI Chat, 128 on Anthropic, and[a-zA-Z_][a-zA-Z0-9_.:-]*up to 128 on Gemini. OpenAI Responses publishes no constraint and is left unchecked. A name outside the class was previously sent and rejected by the provider. LlmCall.Application.default_children/1raised an opaqueArgumentErrorfor a pool name that is not an atom; it now says the name must be an atom.LlmCall.HTTP.build_url/3no longer renders a trailing?when the query is an empty string.- An SSE stream whose pending event grew without bound now raises
LlmCall.SSE.Errorat 1 MiB instead of consuming memory until the process dies.LlmCall.Streamreports it as an:invalid_responseLlmCall.HTTP.Error. - A non-
2xxwhose body is not the provider's error envelope (a gateway's HTML, an empty body) reportedretryable?: falsewhatever the status was, so a real429or503answered by a CDN told the caller not to retry. The hint is now derived from the status in that case —408,425,429,500,502,503and504are retryable. When the body does decode, the codec's own verdict still stands. - Every dispatch and top-level call raised
FunctionClauseErrorfor an argument that was not the expected struct, though each@specpromises{:ok, _} | {:error, %LlmCall.Error{}}.encode/3,validate_request/3,capabilities/3,init_stream/3,decode_stream_event/4,finish_stream/3,encode_media/3,validate_media/3,media_capabilities/3,complete/3,stream/3,generate/3,poll/3,execute/2andfetch/2now return a:validationerror naming the expected type. A top-level call names whichever of its two struct arguments did not match. - A stream whose payload is not JSON dropped both the payload and the decoder's reason, leaving only "stream payload is not JSON". A truncated frame, a gateway's plain-text body and a malformed chunk all read the same, and the stream could not be diagnosed from the error. The message now quotes the payload and carries the decoder's reason. The same applies to a request or response body that fails to encode or decode on the non-streaming path.
- The Anthropic codec put a
tool_resultblock wherever the caller placed it, including after text, which the Messages API rejects: results must come first in the message that answers a call. That ordering is now a:validationerror. - A
%LlmCall.ToolResult{}that answers no tool call in the immediately preceding message is now a:validationerror naming the id and index, instead of a request both OpenAI and Anthropic reject with a 400. A history with an unanswered tool call is still accepted, because a truncated turn is the caller's decision. Capabilities.prompt_cacheandCapabilities.statefulclaimed a request capability they never had: the canonical IR has no field to place a cache breakpoint or continue a response. They are now documented as reporting capabilities — cache accounting inUsage, server-side continuation throughprovider_options— which is whattruealways meant.
0.1.0 - 2026-11-20
Added
- One-call client:
LlmCall.complete/3,stream/3,generate/3,poll/3,execute/2,fetch/2, withLlmCall.Provider(use LlmCall.Provider) and%LlmCall.Client{}. HTTP is Finch; JSON is theLlmCall.JSONfacade over Elixir's built-inJSON, selected at compile time withjson_library:; Torque, Jason and Poison work directly. Calls acceptheaders:merged after the client headers and before the codec's protocol headers. - A provider-level
query:(or aquery:client option) adds URL parameters to every request, for vendors that key on one — MiniMax'sGroupId, Azure OpenAI'sapi-version. A codec's own parameter wins on the same key, and the Responses WebSocket handshake inherits the same parameters. LlmCall.Error.retry_after_mscarries the parsedRetry-Afterhint; retry policy stays outside the core.LlmCall.Error.reasoncarries the structured transport reason (:econnrefused,:timeout,:unknown_pool, ...), so callers match on it instead of parsing the message.LlmCall.HTTP.build_url/3joins a base URL, a request path and an encoded query on theURIstruct, keeping the base path. The client and the Responses WebSocket handshake both use it, so a caller that owns a transport joins its URLs the way the library does.LlmCall.Codec.Conformance.assert_replays/3pins which decoded content parts a codec accepts back in an assistant message, the contract an agent loop depends on;docs/design.md§8.3 carries the replay table.config :llm_call, capture_raw: ...sets the compile-time capture default, symmetric withjson_library:;LlmCall.Config.new(capture_raw: ...)still overrides it per client.- Codecs validate the types of known native
provider_optionskeys (access_programs,logprobs,metadata,safetySettings, ...); unknown native keys still pass through. - WebSocket transport: the
LlmCall.WSbehaviour andLlmCall.WS.Mint, with the upgrade, text/binary frames, ping handling and peer close. Mint's HTTP proxy options are forwarded (ws://forward proxy,wss://CONNECT). - Responses WebSocket connection: one socket multiplexed by
stream_id,Connection.response_id/2forprevious_response_id,response.create/response.steer/response.cancel, per-lane event decoding, and reconnect before the 60-minute limit. Reconnect failures keep the connection process alive with exponential backoff; while disconnected, creates return a:transporterror. In-flight responses are reported as interrupted, not silently resumed. No realtime audio session. - Streaming in the library:
LlmCall.SSEframing,LlmCall.Streamas a lazyEnumerable,stream/3'son_event:observer, andLlmCall.HTTP.Errorfor mid-stream failures. - Provider-hosted tools:
ToolSpec{kind: :builtin}forwarded verbatim andCapabilities.builtin_tools. - Canonical wire IR:
Request,Message,Content,ToolSpec,ToolCall,ToolResult,Reasoning,Response,Usage,Error,Capabilities,Config,EncodedRequest. LlmCall.Codecbehaviour and the public dispatch API, with typed errors for every unsupported field.- Reference adapters: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, Gemini GenerateContent.
- Adapter authoring macros:
LlmCall.Dialect.Adapterinjects the behaviour, aliases, andencode_request/2;LlmCall.Media.Dialect.Adapteradditionally injects the shared media validation pipeline. Shared rules live inLlmCall.Dialect.Helpers. provider_optionsis validated, not just merged: a codec reserves the wire keys it derives from canonical fields, rejects a namespace it does not read, and refuses aConfigdefault that would override an explicit request.- Streaming primitives (
StreamEvent,StreamDelta,StreamState) and the pureStreamAssembler. - Media IR:
LlmCall.Media.{Request,Response,Capabilities,Codec},LlmCall.Operation, and theencode_media/3…decode_operation/3API for synchronous and long-running generation. - Vendored media adapters: OpenAI Images, Gemini Imagen
predict, Seedance (BytePlus ModelArk), MiniMax Hailuo. - Conformance suites published from
lib/:LlmCall.Codec.ConformanceandLlmCall.Media.Conformance, covering response/error decoding, stream order, the streaming signal on an encoded request, tool-call assembly,capture_raw, and capability↔validation consistency. - Documentation:
docs/design.md(canonical spec) andCONTRIBUTING.md(adapter bar).
Fixed
http_opts: [receive_timeout: ...]was validated and then dropped: the client always forwards the request's own timeout. It is now anArgumentErrorthat points attimeout:, and any key the client would drop is rejected the same way.- A CRLF split across two body chunks ended an SSE event early, which broke the
documented newline join for multi-line
data:fields. ToolCall.arguments_errorcarried the raw arguments in one path and a decoder message in another.raw_argumentsis now the only place the payload lives:{:invalid_json, reason}always carries a message, and a missing decoder is:no_json_decoder.response.steerandresponse.cancelcarriedstream_id, which the provider does not route them by: a steer carriesprevious_response_idand a cancel carriesresponse_id. Steering a lane that has not receivedresponse.createdis a:validationerror instead of an untenanted event.- A Responses connection whose server does not echo
stream_id(the endpoint does for named lanes) no longer accepts a second concurrent lane once an event has proven the echo is missing, because that lane's events could not be routed and the connection would drop every in-flight response with an opaqueunroutable_event. Back-to-back creates before the first event stay allowed. LlmCall.Configmerged provider-option namespaces one level deep, so a nesteddefault_provider_optionskey was dropped as soon as the request set a sibling key inside the same object — for six of the eight codecs; Gemini already deep-merged. The merge is now recursive for every codec.Error.rawcarried the provider error envelope whatevercapture_rawsaid, whileResponse.raw,StreamEvent.rawandOperation.rawhonoured it. It now follows the same policy, so:nonekeeps no provider payload at all. The conformance suites check it for completion and media codecs.LlmCall.Media.Dialect.Gemini.Predictaccepted a non-stringparams.negative_promptand put it on the wire; it is now a:validationerror like its sibling knobs.- A query string in
base_url(https://…/openai?api-version=1) was glued in front of the codec path over HTTP, producing/openai?api-version=1/v1/…on the wire; the WebSocket handshake already merged it. It is now folded into the client'squeryat build time, with an explicitquery:winning. - The Anthropic codec emitted server tools as
{"type": …}alone, but the API requires the callablenameas well (web_searchnext toweb_search_20250305). It is now derived from the type's date suffix and can be overridden throughprovider_options.anthropic. - The Anthropic codec accepted
thinking.budget_tokensfrom 1 upward; the API requires at least 1024 and less thanmax_tokens, so both bounds are validation errors now. Usage.total_tokensfor Anthropic counted onlyinput_tokens + output_tokens, while the API definesinput_tokensas the tokens after the last cache breakpoint: cache creation and cache reads were missing from the total.- The Anthropic
anthropic-versionheader was pinned to2023-06-01; it now sends the version the provider's own SDK sends,2026-10-21. A codec header wins over a client header, so the pin was not overridable. - The OpenAI Chat and Responses codecs rejected
reasoning effort: :xhighand:max, whichReasoningEffortaccepts, and theirUsage.cache_write_tokenswas alwaysnilalthough both usage breakdowns report it (prompt_tokens_details.cache_write_tokens,input_tokens_details.cache_write_tokens). - The OpenAI Responses codec replayed an assistant turn with
output_textcontent parts, which are not valid in an input content list: the documentedinputshape allowsinput_text,input_image, andinput_file, and an assistant turn is either an easy-input message with those parts or the original output item with its id. It now emitsinput_text. - The Gemini codec mapped most
finishReasonvalues to:unknown. The documented set now maps as it reads:CONTINUATION(a resumable token-limit stop) to:max_tokens, the content-policy family (safety, recitation, language, blocklist, prohibited content, SPII, the image variants, escalation) to:content_filter, and the failed-generation reasons (MALFORMED_FUNCTION_CALL,UNEXPECTED_TOOL_CALL,TOO_MANY_TOOL_CALLS,MISSING_THOUGHT_SIGNATURE,MALFORMED_RESPONSE,NO_IMAGE,IMAGE_OTHER,PUP_LIMITED_DISABLED) to:error. - The OpenAI Images codec sent
response_format: "b64_json"todall-e-*models. That parameter is legacy for the retired DALL·E models and is unsupported by the GPT image models, which always return base64; it is now only sent when a caller sets it throughprovider_options.openai. - The Seedance video codec dropped the task's token usage; a finished task reports
completion_tokensandtotal_tokens, which now land onLlmCall.Media.Response.usage.