Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

Format capability comparison

Compare request shape, streaming, caching evidence, and usage normalization by format.

developer

The codecs expose the same neutral client contract, but their wire contracts are not interchangeable.

Request shape

FormatConversation shapeImagesToolsStructured output
OpenAI ChatmessagesURL/data URLfunction toolsresponse_format.json_schema
OpenAI Responsesinput itemsinput_imagefunction itemstext.format.json_schema
Anthropicmessages plus top-level systemURL/base64input_schema toolsoutput_config.format
Geminicontents parts plus systemInstructioninline/file datagrouped declarationsresponseJsonSchema
Bedrock Conversetagged content unioninline bytestoolConfig.toolSpecoutputConfig.textFormat

OpenAI and Anthropic put stream in JSON. Gemini and Bedrock do not; streaming is a route or operation concern.

Caching and usage

Only behavior implemented by these codecs is documented here:

FormatRequest-side cache hintResponse usage evidence
OpenAI Chatnone emittedcached_tokens, optional cache_write_tokens
OpenAI Responsesnone emitted; store is always falseinput_tokens_details.cached_tokens and cache_write_tokens
Anthropicopt-in PromptCaching emits up to two cache_control: ephemeral breakpointsseparate read and creation counts
Geminino request cache hintcachedContentTokenCount
Bedrockno cache marker in the request DTOcacheReadInputTokens and cacheWriteInputTokens

An API may perform other server-side caching, but the codecs do not infer or promise it beyond these fields and tests.

Source and proof

Run go test ./codec/....

← back to documentation