Voiceover generation
Models and usage
audio-generate-0.1Script to WAV · one optional reference recording
seed-audio-1.0Preset voice or reference audio
List models available to your key
curl 'https://api.anycap.io/v1/generations/models?type=audio' -H "Authorization: Bearer $ANYCAP_API_KEY"Submit a script, then retrieve the audio by job ID.
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": { "duration_seconds": 15, "format": "mp3", "sample_rate": 44100, "speech_rate": 15 } }'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.
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
duration_seconds, format, sample_rate, speech_rate, loudness_rate, pitch_rate, enable_subtitle, watermark.model
GET /v1/generations/models?type=audio.Failed jobs include error_code and, when available, error_message. For seed-audio-1.0 without reference audio, audio_duration_out_of_range means the voiceover exceeds the single-output 120-second limit; shorten the script before creating another request. When supplied, duration_seconds echoes the requested target; duration remains the actual original duration used for settlement. 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.
A known upstream failure is returned through the job query: state is the task status, error_code is the machine code, and error_message explains the saved, sanitized cause. The relevant fields for a known output-duration overflow are shown below. The 120-second limit refers to original generated audio duration. If the source instead reports an actual request-wait timeout, its known timeout reason is retained. Missing causes are never invented.
{ "state": "failed", "error_code": "audio_duration_out_of_range", "error_message": "配音时长超出范围,单次生成最长120秒,请缩短文案后重新提交。"}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 }'On the compatibility endpoint, place duration_seconds at the top level; on the unified endpoint use parameters.duration_seconds. A non-integer or a value outside the source limit returns HTTP 400; error.code is the machine code and error.message explains the failure. For example, duration_seconds=121 is rejected before generation with error.code=invalid_input, error.field=duration_seconds and an error.message explaining the 120-second maximum and suggesting a shorter script or separate requests. Exactly 120 is accepted unless the selected source has a lower max_output_seconds. Avoid conflicting duration instructions in prompt. The response is a durable job. Poll GET /v1/audio/generations/{id} until state is completed, failed or pending. Explicit concurrency refusals stay queued; timeouts, 5xx responses and disconnected requests with unknown outcomes remain pending for reconciliation without automatic resubmission. 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.