> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mountsea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

# ElevenLabs 服务介绍

欢迎使用 **ElevenLabs** 服务文档！

ElevenLabs 提供 AI 驱动的音乐生成（支持结构化作曲计划精细控制）、视频配乐、音轨分离，以及多角色对话合成能力。

## 支持的模型

### 音乐

| 模型         | 描述                  |
| ---------- | ------------------- |
| `music_v1` | ElevenLabs 旗舰音乐生成模型 |
| `music_v2` | 新一代音乐生成模型           |

### 对话

| 模型                       | 描述                        |
| ------------------------ | ------------------------- |
| `eleven_v3`              | Text to Dialogue 默认模型（推荐） |
| `eleven_multilingual_v2` | 多语言语音                     |
| `eleven_turbo_v2_5`      | 更快生成                      |
| `eleven_flash_v2_5`      | 更低延迟                      |

## 功能一览

<CardGroup cols={2}>
  <Card title="音乐生成" icon="music">
    从简单文本提示或详细作曲计划生成音乐，支持段落级别精细控制
  </Card>

  <Card title="作曲计划" icon="list-check">
    AI 生成结构化计划，包含段落、风格和歌词 — 免费，不消耗积分
  </Card>

  <Card title="视频配乐" icon="video">
    根据视频内容自动生成匹配的背景音乐
  </Card>

  <Card title="音轨分离" icon="sliders">
    将音频分离为 2 轨（人声+伴奏）或 6 个独立音轨
  </Card>

  <Card title="音色列表" icon="microphone">
    浏览可用音色（同步，不消耗积分），供对话合成选用
  </Card>

  <Card title="多角色对话" icon="comments">
    合成多角色对话，最多支持 10 个不同音色
  </Card>
</CardGroup>

## 如何使用 ElevenLabs

### 音乐生成

<Steps>
  <Step title="选择输入方式">
    使用简单的 `prompt` 快速生成，或通过 `/eleven/plan` 创建 `compositionPlan` 来精细控制段落、风格和歌词。
  </Step>

  <Step title="生成音乐">
    调用 `POST /eleven/music` 传入提示词或作曲计划，获取 `taskId`。
  </Step>

  <Step title="轮询结果">
    使用 `GET /eleven/tasks?taskId=xxx` 轮询直到状态为 `completed`，结果包含生成的音频及元数据（歌词时间戳、作曲计划等）。
  </Step>
</Steps>

### 对话合成

<Steps>
  <Step title="获取音色">
    调用 `GET /eleven/voices` 获取可用 `voiceId`（同步，不消耗积分）。
  </Step>

  <Step title="创建对话任务">
    调用 `POST /eleven/dialogue`，传入 `inputs[]`（`text` + `voiceId`），获取 `taskId`。
  </Step>

  <Step title="轮询音频">
    使用 `GET /eleven/tasks?taskId=xxx` 轮询直到 `completed`，再读取 `result.audioUrl`。
  </Step>
</Steps>

## 快速示例

<CodeGroup>
  ```bash 简单提示 theme={null}
  curl -X POST "https://api.mountsea.ai/eleven/music" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "prompt": "A melancholic indie folk song with acoustic guitar and soft vocals",
      "model": "music_v1",
      "musicLengthMs": 180000
    }'
  ```

  ```bash 使用作曲计划 theme={null}
  # 第 1 步：生成作曲计划（免费）
  curl -X POST "https://api.mountsea.ai/eleven/plan" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "prompt": "An upbeat pop song about summer adventures",
      "musicLengthMs": 180000
    }'

  # 第 2 步：使用计划生成音乐
  curl -X POST "https://api.mountsea.ai/eleven/music" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "compositionPlan": { "...第 1 步的计划..." },
      "model": "music_v1",
      "musicLengthMs": 180000
    }'
  ```

  ```bash 多角色对话 theme={null}
  # 第 1 步：获取音色（同步）
  curl -X GET "https://api.mountsea.ai/eleven/voices?category=premade" \
    -H "Authorization: Bearer your-api-key"

  # 第 2 步：创建对话任务
  curl -X POST "https://api.mountsea.ai/eleven/dialogue" \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "eleven_v3",
      "inputs": [
        { "text": "[giggling] Knock knock", "voiceId": "JBFqnCBsd6RMkjVDRZzb" },
        { "text": "[curious] Who is there?", "voiceId": "Aw4FAjKCGjjNkVhN1Xmq" }
      ]
    }'
  ```

  ```bash 轮询任务状态 theme={null}
  curl -X GET "https://api.mountsea.ai/eleven/tasks?taskId=your-task-id" \
    -H "Authorization: Bearer your-api-key"
  ```
</CodeGroup>

## 可用端点

| 端点                       | 方法   | 描述                        |
| ------------------------ | ---- | ------------------------- |
| `/eleven/music`          | POST | 从提示词或作曲计划生成音乐（返回详细结果）     |
| `/eleven/plan`           | POST | 创建作曲计划（免费，不消耗积分）          |
| `/eleven/video-to-music` | POST | 根据视频内容生成背景音乐              |
| `/eleven/voices`         | GET  | 获取可用音色列表（同步，不消耗积分）        |
| `/eleven/dialogue`       | POST | 多角色对话合成                   |
| `/eleven/tasks`          | GET  | 查询任务状态和结果                 |
| `/eleven/stems`          | POST | 音轨分离                      |
| `/eleven/upload`         | POST | 上传音频用于 Inpainting 编辑（企业版） |

## 两种输入模式

ElevenLabs 支持两种互斥的音乐生成输入方式：

### 1. 简单提示模式

提供文本 `prompt` 描述所需音乐，简单快捷，AI 自动处理所有细节。

```json theme={null}
{
  "prompt": "A melancholic indie folk song with acoustic guitar",
  "model": "music_v1",
  "musicLengthMs": 180000
}
```

### 2. 作曲计划模式

使用结构化的 `compositionPlan`，按段落精细控制风格、时长和歌词。可先通过 `/eleven/plan` 自动生成计划，再自定义后生成。

```json theme={null}
{
  "compositionPlan": {
    "positive_global_styles": ["epic orchestral", "cinematic"],
    "negative_global_styles": ["lo-fi"],
    "sections": [
      {
        "section_name": "Intro",
        "positive_local_styles": ["soft piano", "building tension"],
        "duration_ms": 15000
      },
      {
        "section_name": "Verse",
        "positive_local_styles": ["warm vocals", "acoustic guitar"],
        "duration_ms": 30000,
        "lines": ["Walking through the golden fields", "Sunlight on my face"]
      }
    ]
  },
  "model": "music_v1",
  "musicLengthMs": 180000
}
```

<Tip>
  先使用 `/eleven/plan` 从简单提示生成作曲计划（免费），查看并自定义段落后再传给 `/eleven/music`。
</Tip>

## 输出格式

ElevenLabs 通过 `outputFormat` 参数支持多种输出格式：

| 格式               | 说明                                 |
| ---------------- | ---------------------------------- |
| `mp3_44100_128`  | MP3 44.1kHz 128kbps（默认）            |
| `mp3_44100_192`  | MP3 44.1kHz 192kbps（需 Creator 及以上） |
| `pcm_44100`      | PCM 44.1kHz 无压缩（需 Pro 及以上）         |
| `opus_48000_128` | Opus 48kHz 128kbps                 |

<Info>
  完整格式列表请查看[音乐生成](/zh/api-reference/eleven/music)端点文档。
</Info>

***

### 探索 API 文档

* [生成音乐](music) — 从提示词或作曲计划创建音乐
* [创建作曲计划](plan) — 生成结构化作曲计划（免费）
* [视频配乐](video-to-music) — 用 AI 为视频生成背景音乐
* [获取音色列表](voices) — 浏览对话合成可用音色
* [多角色对话合成](dialogue) — 多角色对话音频合成
* [获取任务状态](task) — 轮询任务状态和结果
* [音轨分离](stems) — 将音频分离为独立音轨
* [上传音频](upload) — 上传音频用于 Inpainting 编辑（企业版）
