Voiceover generation
Introduction
Voiceover generation turns a script into speech, sound effects or character voices. Use a preset speaker, or upload up to three reference clips and cite them as @音频1, @音频2 and @音频3 in the script. For audio-generate-0.1, send plain text up to 1000 characters; output is WAV at 44100 Hz. Optionally upload one 10–30 second reference recording; no reference transcript is needed. Preset speakers, reference URLs/images and speed, pitch, loudness, subtitle and watermark controls are unavailable. Tasks wait in a single-generation queue; an unknown outcome pauses execution for review. For audio-generate-0.1, settlement uses the generated audio duration, rounded up to seconds; the final credit charge is rounded up to a whole credit.
Unified API (recommended)
New integrations call POST /v1/generations with type=audio. The /v1/audio/* endpoints below remain supported for compatibility.
curl -X POST https://api.anycap.io/v1/generations \ -H "Authorization: Bearer $ANYCAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "audio", "model": "<model from GET /v1/generations/models?type=audio>", "input": { "prompt": "参考 @音频1 的语气,说:姐妹们,这条裤子真的绝了,垂感特别好。", "reference_audio_file_ids": ["<id from POST /v1/video-materials?kind=audio>"] }, "parameters": { "format": "mp3", "sample_rate": 44100, "speech_rate": 15 } }'input.prompt
@音频1..@音频3.input
speaker, owned reference_audio_file_ids, reference_audio_urls, reference_image_file_id or reference_image_url. They are mutually exclusive; omit all for text-only.parameters
format, sample_rate, speech_rate, loudness_rate, pitch_rate, enable_subtitle, watermark.model
GET /v1/generations/models?type=audio.The job object also echoes the reference inputs used for this generation: reference_audio_file_ids, reference_audio_urls, reference_image_file_id and reference_image_url.
Compatibility endpoints
The capability endpoints below remain supported and behave exactly as before. New integrations should use the unified envelope above.
| Purpose | Method | Path |
|---|---|---|
| Discover models | GET | /v1/audio/models |
| Create a generation | POST | /v1/audio/generations |
| Read a generation | GET | /v1/audio/generations/{id} |
| Read with a fresh audio URL | GET | /v1/audio/generations/{id}?result=true |
| Upload reference audio | POST | /v1/video-materials?kind=audio |
curl -X POST https://api.anycap.io/v1/audio/generations \ -H "Authorization: Bearer $ANYCAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "seed-audio-1.0", "prompt": "姐妹们,这条裤子真的绝了,垂感特别好。", "speaker": "zh_female_vv_uranus_bigtts", "format": "mp3", "sample_rate": 44100, "speech_rate": 15 }'The response is a durable job. Poll GET /v1/audio/generations/{id} until state is completed, failed or pending. Transient provider 5xx and network failures are retried automatically; exhausted retries end failed and release the reservation. A completed job carries billing_status and duration; add ?result=true to receive a fresh private audio_url (24 hours at most, never past the stored file).
Generation modes
- Text only: send no references and describe speakers, effects and music in
prompt. - Preset voice: send
speakerwith a Doubao TTS 2.0 voice id; cite nothing. - Reference audio: upload up to three clips (
reference_audio_file_ids) or pass up to three public https links (reference_audio_urls); order maps to@音频1..@音频3. - Reference image: upload one JPEG/PNG/WebP (
reference_image_file_id) or pass one public https link (reference_image_url); the prompt is read as text. - Links are fetched by the provider, so their duration, size and availability cannot be checked before submission.
speaker, ownedreference_audio_file_ids,reference_audio_urls,reference_image_file_idandreference_image_urlare mutually exclusive; pick one mode or none. Mixing them fails with 400.
Reference audio
- Upload each clip first with
POST /v1/video-materials?kind=audio; the platform verifies duration and format. - Pass the returned ids as
reference_audio_file_idsin the generation request. Upload order maps to@音频1..@音频3. - Each uploaded clip must be 30 seconds or shorter and at most 10 MiB; up to three clips and 90 seconds in total. Link-based clips are not pre-checked.
speaker, ownedreference_audio_file_ids,reference_audio_urls,reference_image_file_idandreference_image_urlare mutually exclusive; pick one mode or none.