You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cf ai run prints {} for models that return binary output (text-to-speech audio) #437
The same request sent straight to the REST API (POST /accounts/{account_id}/ai/run/@cf/deepgram/aura-2-en with {"text": "...", "speaker": "athena", "encoding": "mp3"}) returns 200 with content-type: audio/mpeg and the MP3 bytes. So it looks like the CLI JSON-parses or serializes every response, and a binary body turns into {}.
Expected
When the response isn't JSON (audio/*, image/*, application/octet-stream), write the raw bytes to stdout (or to a file given with --output FILE), and refuse with a clear message when stdout is a terminal. Failing that, at least exit non-zero rather than print {} with success.
This affects @cf/deepgram/aura-1, @cf/deepgram/aura-2-en, @cf/deepgram/aura-2-es and likely the image-generation models too.
Environment
cf 1.0.0-beta.20, Node v26.12.1, Linux aarch64, signed in with cf auth login (OAuth).
We haven't been able to reproduce the dropped binary output in the current 1.0.0-beta.24 code. The hand-written cf ai run command already preserves non-JSON responses as bytes. We expanded its regression tests to cover audio/mpeg, audio/wav, image/png, and application/octet-stream; all write the exact bytes to stdout without JSON serialization.
These checks use mocked API responses, so they don't yet reproduce the live Deepgram request or the reported Linux/OAuth environment. Also, cf currently calls POST /accounts/{account_id}/ai/run with { model, input }, whereas the successful direct REST example in this issue uses /ai/run/{model_name}. That difference remains worth investigating if the problem persists.
We found a related generator gap and opened #439: generated commands did not recognize audio/* as binary output. cf ai run is hand-written, so that fix does not explain this particular report.
Could you retry with the latest 1.0.0-beta.24, confirm the version shown by cf --version, and let us know whether the same command still produces {}? It may no longer reproduce on the latest beta, but we couldn't identify a fix between beta.20 and beta.24: the relevant byte-preserving response code is unchanged between those releases.
Activity
petebacondarwin commentedon Oct 28, 2026
We haven't been able to reproduce the dropped binary output in the current
1.0.0-beta.24code. The hand-writtencf ai runcommand already preserves non-JSON responses as bytes. We expanded its regression tests to coveraudio/mpeg,audio/wav,image/png, andapplication/octet-stream; all write the exact bytes to stdout without JSON serialization.These checks use mocked API responses, so they don't yet reproduce the live Deepgram request or the reported Linux/OAuth environment. Also, cf currently calls
POST /accounts/{account_id}/ai/runwith{ model, input }, whereas the successful direct REST example in this issue uses/ai/run/{model_name}. That difference remains worth investigating if the problem persists.We found a related generator gap and opened #439: generated commands did not recognize
audio/*as binary output.cf ai runis hand-written, so that fix does not explain this particular report.Could you retry with the latest
1.0.0-beta.24, confirm the version shown bycf --version, and let us know whether the same command still produces{}? It may no longer reproduce on the latest beta, but we couldn't identify a fix between beta.20 and beta.24: the relevant byte-preserving response code is unchanged between those releases.