openapi: 3.0.0 info: title: AI Toolkit API version: "206" description: | Advanced AI Toolkit with Media Processing, TTS, and Voice Cloning capabilities **Author:** NetzPrinz aka Oliver Hees **Based on:** no-code-architects-toolkit by Stephen G. Pope ## Features - Audio/Video Processing & Looping - Text-to-Speech (23 languages) - Voice Cloning - Image Processing - Cloud Storage Integration - Asynchronous Processing with Webhooks contact: name: NetzPrinz aka Oliver Hees servers: - url: http://srv964214.hstgr.cloud description: Production server - url: http://localhost:8080 description: Local development security: - ApiKeyAuth: [] tags: - name: Chatterbox TTS description: Text-to-Speech and Voice Cloning powered by Chatterbox AI - name: Audio description: Audio processing and manipulation - name: Video description: Video processing and manipulation - name: Toolkit description: System and testing endpoints components: securitySchemes: ApiKeyAuth: type: apiKey in: header name: X-API-Key description: API Key for authentication schemas: SuccessResponse: type: object properties: code: type: integer example: 200 id: type: string example: "custom-id-123" job_id: type: string format: uuid response: type: string example: "file:///app/storage/output.mp3" message: type: string example: "success" run_time: type: number example: 1.234 queue_time: type: number example: 0 total_time: type: number example: 1.234 pid: type: integer example: 8 queue_id: type: integer queue_length: type: integer example: 0 build_number: type: string example: "206" AsyncResponse: type: object properties: code: type: integer example: 202 id: type: string job_id: type: string format: uuid message: type: string example: "processing" pid: type: integer queue_id: type: integer max_queue_length: type: string queue_length: type: integer build_number: type: string ErrorResponse: type: object properties: code: type: integer example: 500 message: type: string example: "Error message" job_id: type: string paths: /v1/toolkit/test: get: tags: - Toolkit summary: Test API endpoint description: Simple test to verify API is working security: - ApiKeyAuth: [] responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /v1/audio/loop: post: tags: - Audio summary: Loop audio file description: | Repeat an audio file a specified number of times efficiently. **Features:** - Download audio once, loop 1-100 times - No re-encoding (uses FFmpeg concat demuxer) - Output format: MP3 - Supports webhook for async processing security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - audio_url - loop_count properties: audio_url: type: string format: uri example: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" description: URL of the audio file to loop loop_count: type: integer minimum: 1 maximum: 100 example: 5 description: Number of times to repeat the audio webhook_url: type: string format: uri example: "https://your-app.com/webhook" description: Optional webhook URL for async processing id: type: string example: "audio-loop-123" description: Custom identifier for tracking responses: '200': description: Success - Audio looped content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '202': description: Accepted for async processing content: application/json: schema: $ref: '#/components/schemas/AsyncResponse' '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/video/loop: post: tags: - Video summary: Loop video file description: | Repeat a video file a specified number of times efficiently. **Features:** - Download video once, loop 1-100 times - No re-encoding (uses FFmpeg concat demuxer) - Output format: MP4 - Supports webhook for async processing security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - video_url - loop_count properties: video_url: type: string format: uri example: "https://example.com/video.mp4" description: URL of the video file to loop loop_count: type: integer minimum: 1 maximum: 100 example: 3 description: Number of times to repeat the video webhook_url: type: string format: uri description: Optional webhook URL for async processing id: type: string example: "video-loop-456" description: Custom identifier for tracking responses: '200': description: Success - Video looped content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '202': description: Accepted for async processing '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/video/add_audio: post: tags: - Video summary: Add or replace audio track in video description: | Combine a video file with an audio file, replacing or adding the audio track. **Features:** - Video stream copied without re-encoding (fast) - Audio encoded to AAC for compatibility - Output format: MP4 - Supports webhook for async processing **Use Cases:** - Add background music to video - Replace existing audio track - Combine merged videos with merged audio security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - video_url - audio_url properties: video_url: type: string format: uri example: "https://example.com/video.mp4" description: URL of the video file audio_url: type: string format: uri example: "https://example.com/audio.mp3" description: URL of the audio file to add/replace webhook_url: type: string format: uri description: Optional webhook URL for async processing id: type: string example: "add-audio-789" description: Custom identifier for tracking responses: '200': description: Success - Audio added to video content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '202': description: Accepted for async processing '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/video/extract-frame: post: tags: - Video summary: Extract frame from video description: | Extract the first, middle, or last frame from a video as a JPEG image. **Features:** - Extract first frame (at 0.1 seconds) - Extract middle frame (at 50% of duration) - Extract last frame (at duration - 0.1 seconds) - Automatic video duration detection - Output format: JPEG - Supports webhook for async processing **Use Cases:** - Create video thumbnails - Extract keyframes for previews - Get end-frame for seamless video loops security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - video_url properties: video_url: type: string format: uri example: "https://example.com/video.mp4" description: URL of the video file position: type: string enum: [first, middle, last] default: first example: "last" description: Which frame to extract (first, middle, or last) webhook_url: type: string format: uri example: "https://your-app.com/webhook" description: Optional webhook URL for async processing id: type: string example: "frame-extract-123" description: Custom identifier for tracking responses: '200': description: Success - Frame extracted content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' example: code: 200 response: "https://ai-toolkit.fra1.digitaloceanspaces.com/last_frame.jpg" message: "success" '202': description: Accepted for async processing content: application/json: schema: $ref: '#/components/schemas/AsyncResponse' '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/video/caption: post: tags: - Video summary: Add captions/subtitles to video description: | Add captions or subtitles to a video with extensive styling options. **Features:** - **Automatic transcription** - If no captions provided, audio is transcribed - **Custom text** - Provide your own caption text - **SRT/ASS import** - Use existing subtitle files - **5 caption styles**: classic, karaoke, highlight, underline, word_by_word - **9 screen positions** - Place captions anywhere on screen - **Full styling control** - Colors, fonts, outline, shadow, spacing **Caption Styles:** - `classic` - Regular subtitles (all text at once) - `karaoke` - TikTok-style word-by-word highlighting - `highlight` - Full text with current word highlighted - `underline` - Full text with current word underlined - `word_by_word` - Show only one word at a time **9 Screen Positions:** ``` top_left top_center top_right middle_left middle_center middle_right bottom_left bottom_center bottom_right ``` **Use Cases:** - Auto-generate captions from video audio - Add TikTok-style word highlighting - Import existing SRT/ASS subtitle files - Create custom styled captions - Remove filler words (um, uh, like) - Exclude time ranges from captioning security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - video_url properties: video_url: type: string format: uri example: "https://example.com/video.mp4" description: URL of the video file captions: type: string example: "Hello world! This is a caption." description: | Caption text or URL to subtitle file: - Plain text: Used as captions for entire video - URL to .srt file: Import SRT subtitles - URL to .ass file: Import ASS subtitles (preserves styling) - Omit for automatic transcription from audio language: type: string default: "auto" example: "en" description: Language code for transcription (en, de, fr, es, etc.) settings: type: object description: Caption styling and positioning options properties: style: type: string enum: [classic, karaoke, highlight, underline, word_by_word] default: classic example: "karaoke" description: | Caption display style: - classic: Regular subtitles - karaoke: TikTok-style word highlighting - highlight: Full text, highlight current word - underline: Full text, underline current word - word_by_word: One word at a time position: type: string enum: [ bottom_left, bottom_center, bottom_right, middle_left, middle_center, middle_right, top_left, top_center, top_right ] default: bottom_center example: "bottom_center" description: Screen position (9 positions available) alignment: type: string enum: [left, center, right] default: center example: "center" description: Text alignment within position line_color: type: string default: "#FFFFFF" example: "#FFFFFF" description: Main text color (hex code) word_color: type: string example: "#FFFF00" description: Highlighted word color for karaoke/highlight styles (hex code) outline_color: type: string default: "#000000" example: "#000000" description: Text outline color (hex code) font_family: type: string default: "Arial" example: "Arial" description: Font family name (system font) font_size: type: integer default: 24 example: 32 description: Font size in pixels bold: type: boolean default: false example: true description: Bold text italic: type: boolean default: false description: Italic text underline: type: boolean default: false description: Underline text strikeout: type: boolean default: false description: Strikethrough text outline_width: type: integer default: 2 example: 3 description: Outline thickness in pixels shadow_offset: type: integer default: 0 example: 2 description: Shadow offset in pixels spacing: type: integer default: 0 example: 5 description: Letter spacing angle: type: integer default: 0 example: 0 description: Text rotation angle all_caps: type: boolean default: false example: true description: Convert all text to uppercase max_words_per_line: type: integer default: 10 example: 8 description: Maximum words per caption line x: type: integer example: 100 description: Custom X position (overrides position) y: type: integer example: 50 description: Custom Y position (overrides position) replace: type: array description: Text replacements (remove filler words, etc.) items: type: object required: - find - replace properties: find: type: string example: "um" description: Text to find replace: type: string example: "" description: Replacement text (empty string to remove) example: - find: "um" replace: "" - find: "uh" replace: "" exclude_time_ranges: type: array description: Time ranges to skip captioning items: type: object required: - start - end properties: start: type: string example: "00:00:10.000" description: Start time (hh:mm:ss.ms) end: type: string example: "00:00:20.000" description: End time (hh:mm:ss.ms) example: - start: "00:00:10.000" end: "00:00:20.000" webhook_url: type: string format: uri example: "https://your-app.com/webhook" description: Optional webhook URL for async processing id: type: string example: "caption-job-123" description: Custom identifier for tracking responses: '200': description: Success - Video captioned content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' example: code: 200 response: "https://ai-toolkit.fra1.digitaloceanspaces.com/captioned_video.mp4" message: "success" '202': description: Accepted for async processing content: application/json: schema: $ref: '#/components/schemas/AsyncResponse' '400': description: Bad Request - Invalid font or parameters content: application/json: schema: type: object properties: code: type: integer example: 400 error: type: string example: "The requested font 'InvalidFont' is not available" available_fonts: type: array items: type: string example: ["Arial", "Times New Roman", "Courier New"] '401': description: Unauthorized '500': description: Internal Server Error /v1/media/transcribe: post: tags: - Audio summary: Transcribe or translate audio/video description: | Transcribe audio/video to text or translate to English using OpenAI Whisper. **Powered by:** OpenAI Whisper (open-source, runs locally) **Model:** Whisper Base (fast, good quality) **Features:** - **Transcribe** - Convert speech to text in original language - **Translate** - Convert speech to English text - **Multiple output formats** - Text, SRT subtitles, JSON segments - **Word-level timestamps** - Precise timing for each word - **Custom SRT formatting** - Control words per subtitle line - **Language detection** - Auto-detect or specify language - **Direct or cloud response** - Get results inline or via cloud URL **Supported Languages:** Afrikaans, Arabic, Armenian, Azerbaijani, Belarusian, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Kannada, Kazakh, Korean, Latvian, Lithuanian, Macedonian, Malay, Marathi, Maori, Nepali, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tagalog, Tamil, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh **Use Cases:** - Generate subtitles from video - Transcribe podcast episodes - Translate foreign language content to English - Create searchable text from audio - Generate SRT files for video editing security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - media_url properties: media_url: type: string format: uri example: "https://example.com/audio.mp3" description: URL of audio or video file to transcribe task: type: string enum: [transcribe, translate] default: transcribe example: "transcribe" description: | Task to perform: - transcribe: Convert to text in original language - translate: Convert to English text language: type: string example: "de" description: | Language code (ISO 639-1): en, de, fr, es, it, pt, ja, zh, ko, ru, ar, hi, etc. If not specified, language is auto-detected include_text: type: boolean default: true example: true description: Include plain text transcript in response include_srt: type: boolean default: false example: true description: Include SRT subtitle file include_segments: type: boolean default: false example: false description: Include JSON with timestamped segments word_timestamps: type: boolean default: false example: false description: Enable word-level timestamps (more precise) words_per_line: type: integer minimum: 1 example: 8 description: | Number of words per SRT subtitle line. Only used when include_srt is true. If not specified, one subtitle per natural segment. response_type: type: string enum: [direct, cloud] default: direct example: "direct" description: | Response format: - direct: Return text/SRT directly in JSON response - cloud: Upload to storage and return URLs webhook_url: type: string format: uri example: "https://your-app.com/webhook" description: Optional webhook URL for async processing id: type: string example: "transcribe-job-123" description: Custom identifier for tracking responses: '200': description: Success - Transcription completed content: application/json: schema: oneOf: - type: object title: Direct Response properties: code: type: integer example: 200 response: type: object properties: text: type: string example: "This is the transcribed text from the audio." description: Transcribed text (if include_text=true) srt: type: string example: "1\n00:00:00,000 --> 00:00:05,000\nThis is the transcribed text\n\n2\n00:00:05,000 --> 00:00:10,000\nfrom the audio." description: SRT subtitle content (if include_srt=true) segments: type: array description: Timestamped segments (if include_segments=true) items: type: object properties: start: type: number example: 0.0 end: type: number example: 5.0 text: type: string example: "This is the transcribed text" - type: object title: Cloud Response properties: code: type: integer example: 200 response: type: object properties: text_url: type: string format: uri example: "https://ai-toolkit.fra1.digitaloceanspaces.com/transcript.txt" description: URL to text file srt_url: type: string format: uri example: "https://ai-toolkit.fra1.digitaloceanspaces.com/subtitles.srt" description: URL to SRT file segments_url: type: string format: uri example: "https://ai-toolkit.fra1.digitaloceanspaces.com/segments.json" description: URL to segments JSON '202': description: Accepted for async processing content: application/json: schema: $ref: '#/components/schemas/AsyncResponse' '400': description: Bad Request - Invalid parameters '401': description: Unauthorized '500': description: Internal Server Error /v1/video/add-tts-with-captions: post: tags: - Video summary: Add TTS audio + karaoke captions (all-in-one) description: | **Complete TikTok-style video creation workflow in ONE request!** This endpoint combines 3 steps into one: 1. **Generate TTS audio** from your text (23 languages) 2. **Add audio** to your silent video 3. **Add synchronized karaoke captions** matching the TTS timing **Perfect for:** - TikTok/Reels style videos with text-to-speech - Educational content with synchronized narration + subtitles - Automated video creation workflows - Multi-language video localization **Default Style:** TikTok-style karaoke - White text with yellow word highlighting - Bottom center position - Bold Arial 32px font - Black outline for readability **What you need:** - Silent video (or video where audio will be replaced) - Text to convert to speech - Language selection **What you get:** - Video with TTS audio + perfectly synchronized karaoke captions security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - video_url - text properties: video_url: type: string format: uri example: "https://example.com/silent-video.mp4" description: URL of the video file (without audio or audio will be replaced) text: type: string minLength: 1 maxLength: 5000 example: "Willkommen zu diesem Tutorial. Heute zeige ich dir wie das funktioniert." description: Text to convert to speech (also used for captions) language: type: string default: "de" example: "de" description: Language code (en, de, fr, es, it, pt, ja, zh, ko, etc.) emotion_intensity: type: number format: float minimum: 0.25 maximum: 2.0 default: 0.5 example: 0.7 description: TTS emotion level (0.5=neutral, higher=more expressive) model_type: type: string enum: [english, multilingual] default: "multilingual" example: "multilingual" description: TTS model (use multilingual for non-English) caption_settings: type: object description: | Optional caption customization. If not provided, uses TikTok-style defaults: - karaoke style with white text, yellow highlight - bottom center position - Arial bold 32px properties: style: type: string enum: [classic, karaoke, highlight, underline, word_by_word] default: karaoke example: "karaoke" description: Caption animation style position: type: string enum: [ bottom_left, bottom_center, bottom_right, middle_left, middle_center, middle_right, top_left, top_center, top_right ] default: bottom_center example: "bottom_center" line_color: type: string default: "#FFFFFF" example: "#FFFFFF" description: Main text color (hex) word_color: type: string default: "#FFFF00" example: "#FFFF00" description: Highlighted word color (hex) outline_color: type: string default: "#000000" example: "#000000" description: Text outline color (hex) font_family: type: string default: "Arial" example: "Arial" font_size: type: integer default: 32 example: 36 bold: type: boolean default: true outline_width: type: integer default: 3 example: 3 all_caps: type: boolean default: false max_words_per_line: type: integer default: 8 example: 10 replace: type: array description: Remove filler words from captions items: type: object properties: find: type: string example: "ähm" replace: type: string example: "" example: - find: "ähm" replace: "" - find: "äh" replace: "" webhook_url: type: string format: uri example: "https://your-app.com/webhook" description: Optional webhook for async processing id: type: string example: "tiktok-video-123" description: Custom tracking identifier responses: '200': description: Success - Video with TTS + captions created content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' example: code: 200 response: "https://ai-toolkit.fra1.digitaloceanspaces.com/final_video.mp4" message: "success" run_time: 45.2 '202': description: Accepted for async processing content: application/json: schema: $ref: '#/components/schemas/AsyncResponse' '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/chatterbox/text-to-speech: post: tags: - Chatterbox TTS summary: Text-to-Speech Generation description: | Convert text to natural-sounding speech using Chatterbox TTS model. **Features:** - Supports 23 languages (with multilingual model) - Adjustable emotion intensity - High-quality 24kHz audio output - GPU-accelerated processing **Model Types:** - `english`: English-only, faster - `multilingual`: 23 languages **Languages:** en, de, es, fr, it, pt, pl, tr, ru, nl, cs, ar, zh, ja, ko, hu, hi, and more security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - text properties: text: type: string minLength: 1 maxLength: 5000 example: "Hello! Welcome to our AI-powered text-to-speech service." description: Text to convert to speech (1-5000 characters) language: type: string default: "en" example: "en" description: Language code (e.g., en, de, es, fr, it) model_type: type: string enum: [english, multilingual] default: "english" description: Model type emotion_intensity: type: number format: float minimum: 0.0 maximum: 2.0 default: 1.0 example: 1.0 description: Emotion exaggeration level (0.0 = neutral, 2.0 = maximum) webhook_url: type: string format: uri description: Optional webhook URL for async processing id: type: string example: "tts-request-123" responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '202': description: Accepted for async processing '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error /v1/chatterbox/voice-cloning: post: tags: - Chatterbox TTS summary: Voice Cloning description: | Clone a voice from an audio sample and generate speech. **Features:** - Zero-shot voice cloning from 3-30 second audio sample - Works with any language - Cross-lingual support (clone voice, speak different language) - High-quality output security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object required: - text - voice_audio_url properties: text: type: string minLength: 1 maxLength: 5000 example: "This is my cloned voice speaking!" description: Text to speak with cloned voice voice_audio_url: type: string format: uri example: "https://example.com/reference-voice.wav" description: URL of reference audio (3-30 seconds) language: type: string default: "en" description: Language code for output speech model_type: type: string enum: [english, multilingual] default: "multilingual" emotion_intensity: type: number minimum: 0.0 maximum: 2.0 default: 1.0 webhook_url: type: string format: uri id: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/SuccessResponse' '202': description: Accepted for async processing '400': description: Bad Request '401': description: Unauthorized '500': description: Internal Server Error