This HTTP Val converts text files to speech using Deepgram's TTS API with async callbacks to handle large files without timeouts.
DEEPGRAM_API_KEY environment variable in your Val Town settingsAUTH_TOKEN environment variable for API authorizationThe system uses Deepgram's TTS callback feature to handle large text files:
/deepgram-callback/test for a web interface to upload and convert text filesWeb interface for testing file uploads and conversions.
Starts async text-to-speech conversion. Requires authorization.
Headers:
Authorization: Bearer YOUR_AUTH_TOKENParameters:
file (File): Text file to convertname (string): Name/title for the episodeExample using curl:
curl -X POST https://your-val-url.web.val.run/convert \ -H "Authorization: Bearer your-auth-token-here" \ -F "file=@your-text-file.txt" \ -F "name=My First Episode"
Response:
{ "success": true, "message": "Text-to-speech conversion started", "data": { "job_id": "job_1234567890_abc123", "name": "My First Episode", "text_length": 1250, "status": "processing", "note": "Audio will be available once all chunks are processed. Check /job-status/:job_id for updates." } }
Check the progress of a conversion job.
Response:
{ "success": true, "job_id": "job_1234567890_abc123", "name": "My First Episode", "status": "completed", "progress": { "total_chunks": 3, "completed_chunks": 3, "failed_chunks": 0, "pending_chunks": 0, "percentage": 100 }, "mp3_url": "https://your-val-url.web.val.run/audio/tts_job_1234567890_abc123_1234567890.mp3", "created_at": "2024-01-01 12:00:00", "completed_at": "2024-01-01 12:05:00", "chunks": [ { "index": 0, "status": "completed", "completed_at": "2024-01-01 12:02:00", "error": null } ] }
Internal callback endpoint for Deepgram to post completed audio chunks. Not for direct use.
Serves MP3 audio files from storage.
Lists all converted episodes.
Get database statistics and cleanup information.
Manually trigger cleanup of old episodes. Requires authorization.
Generates an RSS podcast feed from all episodes. Requires authorization.
id (INTEGER PRIMARY KEY)name (TEXT) - Episode titletext (TEXT) - Original text contentmp3_url (TEXT) - URL to the final MP3 filetext_length (INTEGER) - Length of original textchunk_count (INTEGER) - Number of chunks processeddate_added (DATETIME) - Timestamp when addedid (INTEGER PRIMARY KEY)job_id (TEXT UNIQUE) - Unique job identifiername (TEXT) - Episode titletext (TEXT) - Original text contenttext_length (INTEGER) - Length of original textchunk_count (INTEGER) - Number of chunksstatus (TEXT) - Job status: 'processing', 'completed', 'failed'created_at (DATETIME) - When job was createdcompleted_at (DATETIME) - When job was completedmp3_url (TEXT) - Final MP3 URL when completedid (INTEGER PRIMARY KEY)job_id (TEXT) - References jobchunk_index (INTEGER) - Order of chunk in sequencechunk_text (TEXT) - Text content of chunkaudio_blob_key (TEXT) - Blob storage key for audio chunkstatus (TEXT) - 'pending', 'completed', 'failed'created_at (DATETIME) - When chunk was createdcompleted_at (DATETIME) - When chunk was completederror_message (TEXT) - Error details if failedAuthorization: Bearer YOUR_TOKEN headerdg-token header matches DEEPGRAM_API_KEY?key=YOUR_TOKEN query parameteraura-2-draco-en TTS model