Repository navigation
Conversation
Map inline WAV and MP3 audio parts to Chat Completions input_audio and report Audio: true, leaving per-model gating to composition and the server. Refuse URL-sourced and other audio types with a clear error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Chat Completions adapter refused every audio part before sending, so a
custom provider with
api_flavor: openai-chat-completionscould not send audioeven to a model that hears it. Chat Completions defines an
input_audiousercontent part, and llama.cpp's
llama-serveraccepts it for models with anaudio projector.
input_audio, with the format taken from the MIMEtype, ignoring case and parameters. Only
audio/mpegis IANA-registered; WAVhas no registered type, so each toolchain uses its own name:
audio/wav: Go's MIME tableaudio/wave: WHATWG sniffing, sohttp.DetectContentTypeandmecatuiaudio/x-wav: Pythonmimetypes, libmagic, Linux/etc/mime.typesaudio/vnd.wave: freedesktop shared-mime-info, so GIO andxdg-mimeaudio/mpegandaudio/mp3map tomp3; Chromium and shared-mime-infoboth recognize
audio/mp3as an alias ofaudio/mpeg.cause, since
input_audiocarries only inline wav or mp3 data.Audio: truefromCapabilities(). As in the Responses adapter, thebit describes what the wire can carry; per-model gating stays with
composition's model metadata and the server hosting the model.
internal/appand the multimodal inputuser documentation.
Issue relationship
Fixes #2949
Type of change
Test plan
Baseline checks
task lint)task test)task test:race)go run ./cmd/mecademo)task docs)task site:build)task api:check)task api:update+engine/CHANGELOG.mdtask site:build(needs Node 24 and pnpm) and thedocs:grpc-refstep oftask docs(needsbuf; no protobuf changes) were not run locally; left to CI.No engine API change, so
task api:checkandtask api:updatedo not apply.Manual verification
Against llama.cpp
llama-server(build b12633) servingunsloth/gemma-4-E4B-it-GGUF:Q4_K_M, using the steps in #2949: before,mecatuirefuses the attachment; after, WAV and MP3 reach the model and itanswers questions about the clip. An
audio/oggpart is refused before sending.Changes
provider/openaichat/request.goinput_audio; MIME-to-format table; refusalsprovider/openaichat/openaichat.goCapabilities()reportsAudio: true; comment states the transmit-authority ruleprovider/openaichat/multimodal_test.goopenaiandanthropicadapters' files: the image test (moved fromrequest_test.go, renamedTestBuildParamsImagePart), tests for each MIME alias, the refusals, the request body on the wire, and the capabilityprovider/openaichat/request_test.goTestBuildParamsToolResultDropsMediapins that tool messages stay text-only althoughCapabilities()now reports audioprovider/openaichat/session_header_test.godrainStreamso the new wire test reuses the stream-draining helperinternal/app/capability.go,capability_test.go,registry.gouser-docs/features/sessions/multimodal-input.mdUser-facing change
Sessions on a custom provider with
api_flavor: openai-chat-completionsadvertise audio input, and
mecatuilets users attach WAV and MP3 files. Amodel that cannot hear is refused by its server. Responses and Messages
sessions are unchanged.
Special notes for reviewers
API compatibility: no break. No contract fields change. The existing
session_capabilities.audioflag reportstruefor sessions on ChatCompletions providers (see the
opencodenote below);mecatuiand ACP alreadyhandle that value. A newly enabled capability is a discoverable addition under
the wire API policy, so no major or feature-identifier change is needed. No
stored-data or Go API change.
opencode: the built-in provider uses the same adapter, so its sessionscan advertise audio until its model listing loads; the listing declares text
and image input, which then removes audio. Default and ACP sessions compute
capabilities before discovery runs, so with
opencodeas the default providerthey advertise audio. Its server refuses audio a model cannot take. This is the
same rule the fix applies everywhere: the adapter reports what the wire can
carry, and the model's server decides.
provider/openaichatis published independently; this changes its behavior,not its exported API.