Generate voice replies using OpenAI TTS API and send audio responses.
Generate spoken audio responses using OpenAI's Text-to-Speech API.
When the user asks to "reply by voice", "voice reply", "speak this", or similar voice-related requests.
Command trigger: When user sends /voice_note, resend the last message as a voice note.
Write your response without emojis โ they don't translate well to speech.
Important: Use opus format for Telegram voice notes (shows waveform bubble).
curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "<your text here>",
"voice": "echo",
"speed": 1.2,
"response_format": "opus"
}' -s --output /tmp/voice_reply.ogg
Copy to outbound folder and send via message tool:
mkdir -p /home/exedev/.clawdbot/media/outbound
cp /tmp/voice_reply.ogg /home/exedev/.clawdbot/media/outbound/voice_reply.ogg
Then use the message tool with asVoice: true for proper voice message format:
{
"action": "send",
"channel": "telegram",
"to": "<user_id>",
"media": "/home/exedev/.clawdbot/media/outbound/voice_reply.ogg",
"asVoice": true
}
Important:
.ogg (opus) format โ required for Telegram voice notesasVoice: true sends as voice bubble with waveformmessage caption is optional for voice notes| Voice | Description |
|---|---|
alloy |
Neutral, balanced |
echo |
Warm, conversational (default) |
fable |
British, expressive |
onyx |
Deep, authoritative |
nova |
Friendly, upbeat |
shimmer |
Soft, calm |
0.25 to 4.01.2 (slightly faster than normal)gpt-4o-mini-tts โ Fast, cost-effectivetts-1 โ Standard qualitytts-1-hd โ High definition# 1. Generate audio (opus format for Telegram voice notes)
curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "Hey Oscar! Your main task today is Create Task Skill. Let me know if you need help!",
"voice": "echo",
"speed": 1.2,
"response_format": "opus"
}' -s --output /tmp/reply.ogg
# 2. Copy to outbound
cp /tmp/reply.ogg ~/.clawdbot/media/outbound/reply.ogg
# 3. Send via message tool with asVoice: true