跳转到内容

Elevenlabs Music

集成

模型 id elevenlabs/music
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/elevenlabs/music?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

与示例类似的文件: $1.80 1,800 API 积分 运行前会测量你的文件 在此页面运行

获取 API 密钥
ElevenLabs 文本生成音乐 #music#text-to-music

根据提示词或结构化作曲方案生成音乐,支持纯器乐选项

ElevenLabs · 音频

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

88 / 4100

所需音乐的文本描述。

可选的歌曲时长(以毫秒为单位),范围为 3000 ms 至 600000 ms;仅在使用提示词时适用。省略时,模型会根据提示词确定时长。

高级 output_format · force_instrumental · respect_sections_durations · composition_plan
默认 mp3_44100_128

音频输出格式,受套餐等级要求限制:192 kbps MP3 需要 Creator 套餐或更高等级,44.1 kHz PCM 需要 Pro 套餐或更高等级。值遵循 `codec_sample_rate_bitrate`;例如,`mp3_22050_32` 表示采样率为 22.05 kHz、比特率为 32 kbs 的 MP3。对于 Twilio 音频输入,通常使用 μ-law;该格式也写作 mu-law,或近似写作 u-law。

定义音乐编排的计划。

POST /run/elevenlabs/music?wait=20 报价 → $1.80
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/elevenlabs/music?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 Elevenlabs Music

根据最多 4100 个字符的文本 `prompt` 或详细的 `composition_plan` 创作音乐。使用提示词时,`music_length_ms` 可在 3000 到 600000 毫秒之间,`force_instrumental` 可确保没有人声。`respect_sections_durations` 控制计划中各部分计时的严格程度。通过 `output_format` 提供多种编解码器和采样率选项。

参数

名称类型 默认值允许值 描述
prompt可选
类型string | null
≤ 4,100 个字符
所需音乐的文本描述。
composition_plan可选
类型object
定义音乐编排的计划。
composition_plan.positive_global_styles必填
类型string[]
整首歌曲中要包含的风格。
composition_plan.negative_global_styles必填
类型string[]
整首歌曲中要排除的风格。
composition_plan.sections必填
类型object[]
构成歌曲的部分。
composition_plan.sections[].section_name必填
类型string
1 – 100 characters
部分名称,长度为 1 到 100 个字符。
composition_plan.sections[].positive_local_styles必填
类型string[]
该部分中要包含的风格。
composition_plan.sections[].negative_local_styles必填
类型string[]
该部分中要排除的风格。
composition_plan.sections[].duration_ms必填
类型integer
3,000 – 120,000
部分时长(以毫秒为单位),范围为 3000 ms 至 120000 ms。
composition_plan.sections[].lines必填
类型string[]
该部分的歌词,每行最多 200 个字符。
music_length_ms可选
类型integer | null
3,000 – 600,000
可选的歌曲时长(以毫秒为单位),范围为 3000 ms 至 600000 ms;仅在使用提示词时适用。省略时,模型会根据提示词确定时长。
force_instrumental可选
类型boolean
默认值false
仅器乐控制,仅在使用提示词时可用。设置为 true 可保证输出器乐;false 则根据提示词允许输出器乐或非器乐音乐。
respect_sections_durations可选
类型boolean
默认值true
`composition_plan` 的部分时长强制设置,在该计划之外不起作用。False 允许模型调整各部分时长,通常可提高质量并降低延迟,同时不改变歌曲总时长;true 则强制每个部分严格使用其 `duration_ms`。
output_format可选
类型enum
默认值mp3_44100_128
mp3_22050_32mp3_44100_32mp3_44100_64mp3_44100_96mp3_44100_128mp3_44100_192pcm_8000pcm_16000pcm_22050pcm_24000pcm_44100pcm_48000ulaw_8000alaw_8000opus_48000_32opus_48000_64
另外 3 个opus_48000_96opus_48000_128opus_48000_192
音频输出格式,受套餐等级要求限制:192 kbps MP3 需要 Creator 套餐或更高等级,44.1 kHz PCM 需要 Pro 套餐或更高等级。值遵循 `codec_sample_rate_bitrate`;例如,`mp3_22050_32` 表示采样率为 22.05 kHz、比特率为 32 kbs 的 MP3。对于 Twilio 音频输入,通常使用 μ-law;该格式也写作 mu-law,或近似写作 u-law。
必填

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "elevenlabs/music",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 1800,
    "usd": "1.80",
    "charged": 1800,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
  },
  "output": {
    "audio": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_name": "0-output.mp3",
      "file_size": 1843200
    }
  },
  "outputs": [
    {
      "type": "audio",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_size": 1843200,
      "duration": 12,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
audio
object {url, content_type, file_name, file_size}编码为 MP3 音频的生成音乐文件。

更多模型:文本生成音乐

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/elevenlabs/music.md. 所有模型和指南: https://doitong.com/developers/llms.txt