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

# 创建作曲计划

> 从文本提示生成结构化作曲计划

从文本提示生成结构化的作曲计划。计划包含段落、风格、时长和歌词 — 可直接自定义后传给[生成音乐](/zh/api-reference/eleven/music)。

<Info>
  此端点**免费**，不消耗积分。用它来预览和自定义作曲结构，然后再生成音乐。
</Info>

<Tip>
  可选提供 `sourceCompositionPlan` 作为参考来引导新计划的结构。`musicLengthMs` 参数在此可选 — 不传时由 AI 自动确定长度。
</Tip>


## OpenAPI

````yaml POST /eleven/plan
openapi: 3.0.0
info:
  title: Eleven AI
  description: API documentation for Eleven AI
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: eleven
    description: ''
paths:
  /eleven/plan:
    post:
      tags:
        - eleven
      summary: 创建作曲计划（不消耗 credits）
      description: |-
        对应 ElevenLabs POST /v1/music/plan。
        根据文字提示生成结构化的作曲计划，供 /eleven/music 的 compositionPlan 参数使用。
        返回 taskId，使用 GET /eleven/tasks 获取结果
      operationId: ApiPublicController_createPlan
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlanDto'
      responses:
        '200':
          description: 任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIdDto'
      security:
        - bearerAuth: []
components:
  schemas:
    CreatePlanDto:
      type: object
      properties:
        prompt:
          type: string
          description: 文字提示
          example: An upbeat pop song about summer adventures
        musicLengthMs:
          type: number
          minimum: 3000
          maximum: 600000
          description: 目标长度（毫秒），范围 3000-600000
          example: 180000
        sourceCompositionPlan:
          description: 参考的已有作曲计划
          allOf:
            - $ref: '#/components/schemas/CompositionPlanDto'
        model:
          enum:
            - music_v1
            - music_v2
            - eleven_multilingual_v2
            - eleven_turbo_v2_5
            - eleven_flash_v2_5
            - eleven_v3
          type: string
          description: 模型 ID
          default: music_v1
      required:
        - prompt
    TaskIdDto:
      type: object
      properties:
        taskId:
          type: string
          description: 任务 ID，用于后续查询结果
      required:
        - taskId
    CompositionPlanDto:
      type: object
      properties:
        positive_global_styles:
          description: 全局正面风格
          example:
            - epic orchestral
            - cinematic
          type: array
          items:
            type: string
        negative_global_styles:
          description: 全局负面风格（排除的风格）
          example:
            - lo-fi
            - acoustic
          type: array
          items:
            type: string
        sections:
          description: 歌曲段落列表
          type: array
          items:
            $ref: '#/components/schemas/SongSectionDto'
    SongSectionDto:
      type: object
      properties:
        section_name:
          type: string
          maxLength: 100
          description: 段落名称，1-100 字符 (如 Intro, Verse, Chorus)
          example: Verse
        positive_local_styles:
          description: 正面风格描述——该段落期望呈现的音乐风格/乐器/氛围，建议使用英语
          example:
            - soft piano
            - building tension
          type: array
          items:
            type: string
        negative_local_styles:
          description: 负面风格描述——该段落需排除的音乐风格，建议使用英语
          example:
            - heavy drums
          type: array
          items:
            type: string
        duration_ms:
          type: number
          minimum: 3000
          maximum: 120000
          description: 段落时长（毫秒），范围 3000-120000
          example: 15000
        lines:
          maxItems: 30
          description: 歌词行（仅限可演唱内容，每行最多 200 字符，最多 30 行）
          example:
            - First line of lyrics
            - Second line
          type: array
          items:
            type: string
        source_from:
          description: Inpainting 段落来源——从已有歌曲中提取片段作为该段落素材。仅限具备 Inpainting 权限的企业客户使用
          allOf:
            - $ref: '#/components/schemas/SectionSourceDto'
      required:
        - section_name
    SectionSourceDto:
      type: object
      properties:
        song_id:
          type: string
          description: 源歌曲 ID（从 compose 响应 header 或 upload 返回值获取）
          example: abc123-song-id
        range:
          description: 要提取的源歌曲时间区间
          allOf:
            - $ref: '#/components/schemas/TimeRangeDto'
        negative_ranges:
          description: 在 range 内需要排除的子区间列表
          type: array
          items:
            $ref: '#/components/schemas/TimeRangeDto'
      required:
        - song_id
        - range
    TimeRangeDto:
      type: object
      properties:
        start_ms:
          type: number
          minimum: 0
          description: 起始位置（毫秒）
          example: 0
        end_ms:
          type: number
          minimum: 0
          description: 结束位置（毫秒）
          example: 30000
      required:
        - start_ms
        - end_ms
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````