In-app API docs for /audio-to-text drift from implementation: format list, size limit, unreachable error codes
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
main (dc8dd09450); also present in 1.16.1 and earlier
Cloud or Self Hosted
Cloud and Self Hosted (the drift is in the shipped code, so it affects every deployment)
Steps to reproduce
- Open any Chat/Chatflow app → API Access → the Audio to text section (rendered from
web/app/components/develop/template/template_chat.*.mdx/template_advanced_chat.*.mdx, en/ja/zh). - Compare with the implementation:
api/constants/__init__.pyL12:_AUDIO_EXTENSION_BASE = ("mp3", "m4a", "wav", "amr", "mpga")api/services/audio_service.pyL31–32:FILE_SIZE = 30(MB)
- Read the
/audio-to-textOpenAPI docstring inapi/controllers/service_api/app/audio.py(both@service_api_ns.docresponse blocks, ~L58 and ~L158) and trace the listed 400 codes to their raise sites.
✔️ Expected Behavior
The in-app API docs describe what the endpoint accepts and returns:
- Supported formats:
mp3, m4a, wav, amr, mpga; file size limit 30 MB. - The 400 error list contains only codes reachable via this endpoint.
❌ Actual Behavior
Three documentation surfaces disagree with the implementation:
- Format list — the in-app templates say
['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm'].mp4,mpegandwebmare rejected withunsupported_audio_type(415);amris accepted but undocumented. - Size limit — the templates say 15MB; the service accepts up to 30 MB, so valid 15–30 MB uploads look forbidden to readers.
- Unreachable error codes — the controller docstring advertises
app_unavailable,provider_quota_exceededandmodel_currently_not_supportfor 400 responses, but no code path reachable from/audio-to-textraises the mapped exceptions:AppModelConfigBrokenErroris raised only inmessage_based_app_generator, andQuotaExceededError/ModelCurrentlyNotSupportErroronly in the easy-UI model-config converter andllm/quota.AudioService._invoke_speech_to_textraises none of them. (The reference docs at docs.dify.ai were corrected in langgenius/dify-docs#903; this issue is for the two in-repo surfaces.)
Affected files: web/app/components/develop/template/template_chat.{en,ja,zh}.mdx, template_advanced_chat.{en,ja,zh}.mdx, api/controllers/service_api/app/audio.py.
I'll take this. On current main the in-app MDX templates are gone and the /audio-to-text format list plus 30 MB limit already match the implementation. The remaining drift is the 400 list advertising unreachable codes. I'll send a docs PR that keeps only reachable errors.
Hi @maintainers, I would like to work on this issue. Please assign it to me.
I'd like to take this one. I verified the defect is still present on current main, checked that no open PR covers it, and prepared a minimal patch with an offline check. Opening a focused PR from my fork now.