Voiceover generation

Models and usage

  • audio-generate-0.1

    Script to WAV · one optional reference recording

  • seed-audio-1.0

    Preset voice or reference audio

List models available to your key

BASH
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.

BASH
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.

FieldMeaning
input.prompt
Script to synthesize; cite uploaded reference clips as @音频1..@音频3.
input
One reference mode: 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
Output controls: duration_seconds, format, sample_rate, speech_rate, loudness_rate, pitch_rate, enable_subtitle, watermark.
model
From GET /v1/generations/models?type=audio.
Audio jobs return 202 with job. Poll GET /v1/generations/{id}; intermediate states are queued, submitting and finalizing, terminal states are completed, failed and pending. Explicit concurrency refusals remain queued. Timeouts, 5xx responses and disconnected requests with unknown outcomes remain pending for reconciliation and are not resubmitted automatically. Add ?result=true to receive a fresh private audio_url; one link is valid for 24 hours at most and never outlives the stored file. Audio jobs are not cancellable.

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.

JSON
{  "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.

PurposeMethodPath
Discover modelsGET/v1/audio/models
Create a generationPOST/v1/audio/generations
Read a generationGET/v1/audio/generations/{id}
Read with a fresh audio URLGET/v1/audio/generations/{id}?result=true
Upload reference audioPOST/v1/video-materials?kind=audio
BASH
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 speaker with 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, owned reference_audio_file_ids, reference_audio_urls, reference_image_file_id and reference_image_url are 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_ids in 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, owned reference_audio_file_ids, reference_audio_urls, reference_image_file_id and reference_image_url are mutually exclusive; pick one mode or none.

Controls and limits

FieldValuesNotes
format
Valueswav / mp3 / pcm / ogg_opus
NotesDefault mp3. ogg_opus requires 48000 Hz.
sample_rate
Values8000–48000
Notesmp3 does not accept 40000.
duration_seconds
Valuesoptional integer, 1–120 seconds
NotesTarget total duration for seed-audio-1.0; model discovery reports supports_duration=true. The selected source may have a lower max_output_seconds. Anycap adds the seconds as a generation instruction; actual duration may vary. Omit for the original behavior. Unsupported by audio-generate-0.1 and seed-audio-0.1. The prompt plus the added instruction must fit max_prompt_characters.
speech_rate
Values-50 to 100
Notes0 is normal; 100 is 2.0x.
loudness_rate
Values-50 to 100
Notes0 is unchanged.
pitch_rate
Values-12 to 12
Notes0 is unchanged.
enable_subtitle
Valuestrue / false
NotesDefault false; completed jobs include a sentence-level timeline.
watermark
Valuestrue / false
NotesDefault false; appends the provider AIGC rhythm marker.
prompt
Valuesup to 3000 characters
NotesThe selected source may be stricter.