Federico Mariani created CAMEL-23966:
----------------------------------------
Summary: camel-openai: add audio speech (TTS) and audio
translation operations
Key: CAMEL-23966
URL: https://issues.apache.org/jira/browse/CAMEL-23966
Project: Camel
Issue Type: New Feature
Components: camel-openai
Affects Versions: 4.21.0
Reporter: Federico Mariani
camel-openai covers speech-to-text ({{audio-transcription}}) but not the other
two audio services of the pinned SDK (4.41.0):
* {{audio().speech().create(SpeechCreateParams)}} — text-to-speech, returns
binary audio ({{HttpResponse}});
* {{audio().translations().create(TranslationCreateParams)}} —
transcribe-and-translate to English.
Proposal:
* {{openai:audio-speech}} — body: input text; options/headers: {{speechModel}}
(e.g. {{gpt-4o-mini-tts}}, {{tts-1}}), {{speechVoice}},
{{speechResponseFormat}} (mp3/opus/wav/pcm...), {{speechSpeed}},
{{speechInstructions}}; output: {{byte[]}} (or streamed {{InputStream}}) body —
chains naturally into {{file:}}, object storage, or messaging endpoints.
* {{openai:audio-translation}} — mirrors the transcription producer (same body
types File/Path/byte[]/InputStream, {{audioModel}}, {{audioPrompt}},
{{audioResponseFormat}}, {{audioTemperature}}), reusing its multipart file
handling.
Intended usage:
{code:java}
// text-to-speech: turn an LLM answer into an mp3 and drop it on object storage
from("direct:speak")
.to("openai:chat-completion?model=gpt-5")
.to("openai:audio-speech?speechModel=gpt-4o-mini-tts&speechVoice=alloy&speechResponseFormat=mp3")
.to("aws2-s3://announcements?keyName=answer-${exchangeId}.mp3");
// translate any incoming voice message to English text
from("file:inbox/voicemail?noop=true")
.to("openai:audio-translation?audioModel=whisper-1")
.log("English transcript: ${body}");
{code}
Both reuse the existing client, SSL and auth infrastructure; the translation
producer can share most of {{OpenAIAudioTranscriptionProducer}} (their
extraction into a common base would piggyback on the CAMEL-23396 refactoring).
_This issue was drafted by Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)