Skip to content

Add ai/stt, ai/tts and ai/redact commands - #31

Merged
josiasmontag merged 2 commits into
masterfrom
ai-stt-tts-redact
Nov 23, 2026
Merged

josiasmontag merged 2 commits into
masterfrom
ai-stt-tts-redact

Conversation

@josiasmontag

Copy link
Copy Markdown
Contributor

The API has three new AI operations: speech to text (ai/stt), text to speech (ai/tts) and redacting personal data (ai/redact). The CLI had no commands for them, though the API docs already show CLI examples like cloudconvert ai/stt -f srt interview.mp3. This PR adds the commands, so those examples work as written.

cloudconvert ai/stt -f srt --language=en interview.mp4
cloudconvert ai/tts --text="Your file is ready." --voice=ryan
cloudconvert ai/tts -f wav --instruct="Calm and slow." story.txt
cloudconvert ai/redact --ocr=true --ocr_language.0=eng contract.pdf
  • ai/stt (ai-stt, stt): -f picks txt, srt, vtt or json. If -f is not set, the API default (txt) is used.
  • ai/tts (ai-tts, tts): speaks either --text or text files, never both, as the API requires. --text is declared as a string, so --text=123 is not sent as a number.
  • ai/redact (ai-redact, redact, pdf/redact, pdf-redact): handles PDF, TXT and MD files.

All other options (voice, language, preset, entities…) work as dynamic options, like in the other commands.

One fix in job.ts: for ai/stt and ai/tts, output_format is an option, not a format of the operation. Looking up /operations?filter[operation]=ai/stt&filter[output_format]=srt returns nothing, so with -f set the CLI found no options to cast values by. --translate=true would have gone out as a string. For these two operations, the options are now looked up without the format filter. The new tests fail without this change.

README covers the three commands. npm run typecheck, npm test (62 tests) and npm run build pass. I did not run real jobs against the API.

- ai/stt (aliases ai-stt, stt): transcribe audio and video files. -f sets
  the transcript format (txt, srt, vtt, json); the API default is txt.
- ai/tts (aliases ai-tts, tts): speak --text or UTF-8 text files, never
  both. -f sets the audio format (mp3, wav, flac, ogg).
- ai/redact (aliases ai-redact, redact, pdf/redact, pdf-redact): remove
  personal data from PDF, TXT and MD files.
- The operations API lists nothing for ai/stt and ai/tts when filtered by
  output_format, which is an option of these operations. The options used to
  cast parameter values are now looked up without the format filter for
  them, so --translate=true or --max_line_length=42 still get their types.
@josiasmontag
josiasmontag merged commit 9057453 into master Nov 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant