Open MadBomber opened 6 months ago
You can do this already using other tools. Take this example:
function hey() {
curl -s https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d "$(
jo \
model="tts-1" \
input="$(mods "$@")" \
voice="nova" \
format="mp3"
)" | sox -t "mp3" - -d 2>/dev/null
}
You can then run it like this:
hey --api anthropic --model opus 'Write me a funny poem comparing coding in Go vs Rust'
Notice that you can provide all the arguments supported by mods
.
I would love to be able to send text to the TTS and get back an audio file.
In the example above the response from the first
mods
execution is piped into the secondmods
execution and sent to OpenAI's audio API with the modle tts-1-hd. The response is an audio file which is saved to local storage and played.