桃源 Compose API

编译与修改(免费)/ Compile and revise (free)

GitHub OpenAPI

Operations 3

POST /v1/prompts/compile 编译:一句需求 → 歌词与风格(免费)/ Compile a request into a spec (free) #
POST /v1/prompts/revise 修改:对 spec 应用一句指令(免费)/ Apply a one-line change to a spec (free) #
POST /v1/prompts/lint 只做代码校验,不调模型(免费)/ Validate a spec without calling a model (free) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/musicsforyou-com:musicsforyou-com-compose-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

musicsforyou-com-compose-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Taoyuan Music Compose API
  version: 1.0.0
  summary: '桃源:为一个人写一首歌 / Taoyuan: a finished song for one person, in about three minutes.'
  description: '桃源(Taoyuan)音乐生成接口。一句话需求 → 歌词、风格、封面和两版完整歌曲(约 3 分钟)。适合 Agent、脚本和产品集成;同一套接口也以 MCP 形式提供(https://api.musicsforyou.com/mcp)。


    典型流程:`POST /v1/prompts/compile`(免费,看歌词和风格)→ `POST /v1/generations`(扣 1 次)→ 轮询 `GET /v1/generations/{id}` 直到 `finished`。不想分步就用 `POST /v1/songs` 一次完成。


    Taoyuan turns one sentence into a finished song: lyrics, style, cover art and two full candidate tracks in about three minutes. Typical flow: compile (free, preview lyrics and style) → generate (1 credit) → poll until finished. Or call `POST /v1/songs` to do it all in one request.


    **Billing.** Generation and replace-section cost 1 credit each (one credit = one song with two candidates). Compile, revise, lint, get and list are free. Stems: the 2-track vocal/instrumental split is free once per song for non-members and unlimited for members; the 12-stem split is Pro only; neither costs credits. API and MCP calls draw only from prepaid API credits (never the Pro monthly allowance). Failed generations are refunded. New API keys come with 3 free credits.


    **Rate limits.** Generation submissions: 5 per minute per IP. Compile/revise: 30 per hour per account (guests 5 per day per IP). **Errors.** Every failure is `{ success: false, code, error }`; branch on `code`.


    Docs and keys: https://www.musicsforyou.com/developers · Plain-text guide for LLMs: https://www.musicsforyou.com/llms.txt'
  termsOfService: https://www.musicsforyou.com/terms
  contact:
    name: Taoyuan support
    email: 2368082693@qq.com
    url: https://www.musicsforyou.com/developers
servers:
- url: https://api.musicsforyou.com
  description: Production
security:
- ApiKeyBearer: []
- OAuth2:
  - music
tags:
- name: Compose
  description: 编译与修改(免费)/ Compile and revise (free)
paths:
  /v1/prompts/compile:
    post:
      operationId: compile_music_prompt
      tags:
      - Compose
      summary: 编译:一句需求 → 歌词与风格(免费)/ Compile a request into a spec (free)
      description: '把一句自然语言需求编译成可直接生成的 GenerationSpec:标题、英文风格标签、带段落标记的歌词、负面标签、时长。不扣额度。


        Turns one sentence into a ready-to-generate spec (title, style tags, sectioned lyrics, negative tags, duration). Free. If `spec.status` is `needs_input`, ask the user `spec.question.question` and call again with `clarificationAnswer`. Guests: 5 calls/day per IP (cached 24 h). Signed-in or API key: 30 calls/hour.'
      security:
      - ApiKeyBearer: []
      - OAuth2:
        - music
      - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompileRequest'
      responses:
        '200':
          description: 编译结果 / Compiled spec
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpecResponse'
        '400':
          description: '参数不合法 / Invalid parameters(code: INVALID_PARAMS 或 SPEC_INVALID,details 为 diagnostics)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未登录或 Key 无效 / Not authenticated(LOGIN_REQUIRED、INVALID_API_KEY)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求过于频繁 / Rate limited(RATE_LIMIT_EXCEEDED、COMPILE_LIMIT)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务端错误 / Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-credit-cost: 0
      x-mcp-tool: compile_music_prompt
  /v1/prompts/revise:
    post:
      operationId: revise_generation_prompt
      tags:
      - Compose
      summary: 修改:对 spec 应用一句指令(免费)/ Apply a one-line change to a spec (free)
      description: 返回新的 spec(revision + 1,parentSpecId 指向旧的)。Returns a new spec with revision + 1.
      security:
      - ApiKeyBearer: []
      - OAuth2:
        - music
      - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReviseRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpecResponse'
        '400':
          description: '参数不合法 / Invalid parameters(code: INVALID_PARAMS 或 SPEC_INVALID,details 为 diagnostics)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未登录或 Key 无效 / Not authenticated(LOGIN_REQUIRED、INVALID_API_KEY)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求过于频繁 / Rate limited(RATE_LIMIT_EXCEEDED、COMPILE_LIMIT)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务端错误 / Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-credit-cost: 0
      x-mcp-tool: revise_generation_prompt
  /v1/prompts/lint:
    post:
      operationId: lint_generation_spec
      tags:
      - Compose
      summary: 只做代码校验,不调模型(免费)/ Validate a spec without calling a model (free)
      security:
      - ApiKeyBearer: []
      - OAuth2:
        - music
      - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                spec:
                  $ref: '#/components/schemas/GenerationSpec'
              required:
              - spec
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  diagnostics:
                    type: array
                    items:
                      $ref: '#/components/schemas/Diagnostic'
                  ready:
                    type: boolean
                required:
                - success
                - diagnostics
                - ready
        '400':
          description: '参数不合法 / Invalid parameters(code: INVALID_PARAMS 或 SPEC_INVALID,details 为 diagnostics)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-credit-cost: 0
components:
  schemas:
    UiLanguage:
      type: string
      enum:
      - zh
      - en
      - ja
      description: 界面/解释文字语言 / Language of explanations
    Diagnostic:
      type: object
      properties:
        code:
          type: string
        severity:
          type: string
          enum:
          - error
          - warning
          - info
        path:
          type: string
        message:
          type: string
        autoFixable:
          type: boolean
      required:
      - code
      - severity
      - path
      - message
      - autoFixable
    CompileRequest:
      type: object
      properties:
        text:
          type: string
          minLength: 1
          maxLength: 2000
          description: 一句话需求,任何语言 / What the song is for, in any language
          examples:
          - 给妈妈 60 岁生日写一首温暖的歌,她最爱在厨房唱歌
        uiLanguage:
          $ref: '#/components/schemas/UiLanguage'
          default: zh
        sceneId:
          type:
          - string
          - 'null'
          description: 场景 id,见 GET /v1/presets / Scene id from list_presets
        lyricLanguage:
          oneOf:
          - $ref: '#/components/schemas/LyricLanguage'
          - type: 'null'
        vocalPreference:
          oneOf:
          - $ref: '#/components/schemas/VocalPreference'
          - type: 'null'
        instrumental:
          type:
          - boolean
          - 'null'
          description: 纯音乐 / Instrumental only
        durationSeconds:
          type:
          - integer
          - 'null'
          minimum: 10
          maximum: 360
          description: 目标时长(秒)/ Target length in seconds
        userLyrics:
          oneOf:
          - $ref: '#/components/schemas/UserLyrics'
          - type: 'null'
        clarificationAnswer:
          type:
          - string
          - 'null'
          maxLength: 500
          description: 对上一次 status=needs_input 的 question 的回答 / Answer to a previous needs_input question
      required:
      - text
    PersonalFact:
      type: object
      properties:
        id:
          type: string
        kind:
          type: string
          enum:
          - person
          - relationship
          - date
          - place
          - memory
          - phrase
          - trait
        value:
          type: string
        sourceQuote:
          type: string
        inclusion:
          type: string
          enum:
          - required
          - optional
        preservation:
          type: string
          enum:
          - exact
          - semantic
        preferredSection:
          type: string
          enum:
          - chorus
          - verse
          - bridge
          - any
      required:
      - id
      - kind
      - value
      - sourceQuote
      - inclusion
      - preservation
      - preferredSection
    Provenance:
      type: object
      properties:
        compilerVersion:
          type: string
        parserModel:
          type:
          - string
          - 'null'
        composerModel:
          type:
          - string
          - 'null'
        knowledgeIds:
          type: array
          items:
            type: string
        llmCalls:
          type: number
        cached:
          type: boolean
      required:
      - compilerVersion
      - parserModel
      - composerModel
      - knowledgeIds
      - llmCalls
      - cached
    GenerationSpec:
      type: object
      properties:
        schemaVersion:
          type: string
          const: '3.0'
        id:
          type: string
        revision:
          type: integer
        parentSpecId:
          type:
          - string
          - 'null'
        status:
          type: string
          enum:
          - ready
          - needs_input
          - needs_revision
          description: ready 可提交;needs_input 看 question 追问;needs_revision 看 error 级 diagnostics / ready = submit; needs_input = ask `question`; needs_revision = fix error diagnostics
        profileId:
          type: string
        request:
          $ref: '#/components/schemas/CompileRequestEcho'
        intent:
          oneOf:
          - $ref: '#/components/schemas/IntentSpec'
          - type: 'null'
        composition:
          oneOf:
          - $ref: '#/components/schemas/CompositionPlan'
          - type: 'null'
        rendered:
          oneOf:
          - $ref: '#/components/schemas/Rendered'
          - type: 'null'
        diagnostics:
          type: array
          items:
            $ref: '#/components/schemas/Diagnostic'
        question:
          type:
          - object
          - 'null'
          properties:
            question:
              type: string
            field:
              type: string
          required:
          - question
          - field
        explanation:
          type: string
          description: 给用户看的解释 / Explanation for the end user
        provenance:
          $ref: '#/components/schemas/Provenance'
      required:
      - schemaVersion
      - id
      - revision
      - parentSpecId
      - status
      - profileId
      - request
      - intent
      - composition
      - rendered
      - diagnostics
      - question
      - explanation
      - provenance
      description: 编译结果(GenerationSpec v3)。原样回传给 POST /v1/generations 即可生成 / Compiled spec; pass it back unchanged to generate.
    VocalPreference:
      type: string
      enum:
      - m
      - f
      - duet
      - choir
      description: 人声偏好 / Vocal preference
    CompositionPlan:
      type: object
      properties:
        title:
          type: string
        titleAlternatives:
          type: array
          items:
            type: string
        centralIdea:
          type: string
        hook:
          type:
          - string
          - 'null'
        genre:
          type: object
          properties:
            primary:
              type: string
            accents:
              type: array
              items:
                type: string
          required:
          - primary
          - accents
        tempo:
          type: object
          properties:
            feel:
              type: string
            bpmHint:
              type:
              - number
              - 'null'
          required:
          - feel
          - bpmHint
        instruments:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              role:
                type: string
                enum:
                - lead
                - rhythm
                - harmony
                - accent
            required:
            - name
            - role
        vocal:
          type:
          - object
          - 'null'
          properties:
            gender:
              type:
              - string
              - 'null'
              enum:
              - m
              - f
            texture:
              type: string
          required:
          - gender
          - texture
        sections:
          type: array
          items:
            $ref: '#/components/schemas/Section'
        styleDraft:
          type: object
          properties:
            identity:
              type: string
            mood:
              type: string
            rhythm:
              type: string
            instrumentation:
              type: string
            production:
              type: string
          required:
          - identity
          - mood
          - rhythm
          - instrumentation
          - production
        exclusions:
          type: array
          items:
            type: string
        explanation:
          type: string
      required:
      - title
      - titleAlternatives
      - centralIdea
      - hook
      - genre
      - tempo
      - instruments
      - vocal
      - sections
      - styleDraft
      - exclusions
      - explanation
      description: 作曲方案 / Composition plan
    SpecResponse:
      type: object
      properties:
        success:
          type: boolean
          const: true
        spec:
          $ref: '#/components/schemas/GenerationSpec'
      required:
      - success
      - spec
    Section:
      type: object
      properties:
        id:
          type: string
        kind:
          type: string
          enum:
          - intro
          - verse
          - pre_chorus
          - chorus
          - post_chorus
          - bridge
          - instrumental
          - outro
        label:
          type: string
          examples:
          - Verse 1
          - Chorus
        cues:
          type: array
          items:
            type: string
          description: 段落级表演提示 / Performance cues
        lines:
          type: array
          items:
            type: string
          description: 歌词行;器乐段为空 / Lyric lines, empty for instrumental sections
        usedFactIds:
          type: array
          items:
            type: string
      required:
      - id
      - kind
      - label
      - cues
      - lines
      - usedFactIds
    ReviseRequest:
      type: object
      properties:
        spec:
          $ref: '#/components/schemas/GenerationSpec'
        instruction:
          type: string
          minLength: 1
          maxLength: 500
          description: 一句修改指令 / One-sentence change request
          examples:
          - 副歌更有力
          - 换成女声
        locks:
          type: object
          properties:
            lyrics:
              type: boolean
            title:
              type: boolean
            sectionIds:
              type: array
              items:
                type: string
          description: 锁定不改的部分 / Parts to keep unchanged
      required:
      - spec
      - instruction
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        code:
          type: string
          description: 稳定的错误码,按它分支 / Stable machine-readable code
          examples:
          - LOGIN_REQUIRED
          - NEED_TOPUP
          - SPEC_INVALID
          - COMPILE_LIMIT
          - GENERATION_NOT_FOUND
          - FORBIDDEN
          - PROVIDER_REJECTED
          - PROVIDER_TIMEOUT
          - PROVIDER_UNAVAILABLE
          - IDEMPOTENCY_CONFLICT
          - PRO_REQUIRED
          - STEMS_ONE_PER_SONG
          - NOT_FINISHED
          - UNSUPPORTED
          - RATE_LIMIT_EXCEEDED
          - INVALID_PARAMS
          - INTERNAL_ERROR
        error:
          type: string
          description: 给人看的说明(中文为主)/ Human-readable message
        details:
          description: 可选的附加信息,SPEC_INVALID 时是 diagnostics 数组 / Optional extra data
      required:
      - success
      - code
      - error
      description: 统一错误信封 / Error envelope. All failures use this shape.
    LyricLanguage:
      type: string
      enum:
      - zh
      - yue
      - en
      - ja
      description: 歌词语言 / Lyric language (yue = Cantonese)
    Rendered:
      type: object
      properties:
        model:
          type: string
          description: 供应商模型 id / Provider model id
        instrumental:
          type: boolean
        title:
          type: string
        style:
          type: string
          description: 英文风格标签,逗号分隔 / English style tags, comma separated
        lyrics:
          type:
          - string
          - 'null'
          description: 带 [Verse]/[Chorus] 段落标记的歌词 / Lyrics with section markers
        negativeTags:
          type:
          - string
          - 'null'
        vocalGender:
          type:
          - string
          - 'null'
          enum:
          - m
          - f
        duration:
          type:
          - number
          - 'null'
          description: 秒 / seconds
      required:
      - model
      - instrumental
      - title
      - style
      - lyrics
      - negativeTags
      - vocalGender
      - duration
      description: 可直接提交生成的字段 / Fields ready to submit to generate_music
    IntentSpec:
      type: object
      properties:
        kind:
          type: string
          enum:
          - song
          - instrumental
        sceneId:
          type:
          - string
          - 'null'
        genreRefs:
          type: array
          items:
            type: string
        lyricLanguage:
          oneOf:
          - $ref: '#/components/schemas/LyricLanguage'
          - type: 'null'
        vocalPreference:
          oneOf:
          - $ref: '#/components/schemas/VocalPreference'
          - type: 'null'
        moods:
          type: array
          items:
            type: string
        tempoFeel:
          type:
          - string
          - 'null'
        artistRefs:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              requestedTraits:
                type: array
                items:
                  type: string
            required:
            - name
            - requestedTraits
        facts:
          type: array
          items:
            $ref: '#/components/schemas/PersonalFact'
        exclusions:
          type: array
          items:
            type: object
            properties:
              term:
                type: string
              sourceQuote:
                type: string
            required:
            - term
            - sourceQuote
        durationSeconds:
          type:
          - number
          - 'null'
        assumptions:
          type: array
          items:
            type: string
        clarification:
          type:
          - object
          - 'null'
          properties:
            question:
              type: string
            field:
              type: string
          required:
          - question
          - field
      required:
      - kind
      - sceneId
      - genreRefs
      - lyricLanguage
      - vocalPreference
      - moods
      - tempoFeel
      - artistRefs
      - facts
      - exclusions
      - durationSeconds
      - assumptions
      - clarification
      description: 解析出的意图 / Parsed intent
    CompileRequestEcho:
      type: object
      properties:
        userText:
          type: string
        uiLanguage:
          $ref: '#/components/schemas/UiLanguage'
        sceneId:
          type:
          - string
          - 'null'
        lyricLanguage:
          oneOf:
          - $ref: '#/components/schemas/LyricLanguage'
          - type: 'null'
        vocalPreference:
          oneOf:
          - $ref: '#/components/schemas/VocalPreference'
          - type: 'null'
        instrumental:
          type:
          - boolean
          - 'null'
        durationSeconds:
          type:
          - number
          - 'null'
        userLyrics:
          oneOf:
          - $ref: '#/components/schemas/UserLyrics'
          - type: 'null'
        clarificationAnswer:
          type:
          - string
          - 'null'
      required:
      - userText
      - uiLanguage
    UserLyrics:
      type: object
      properties:
        text:
          type: string
          maxLength: 10000
          description: 用户自带歌词 / User-supplied lyrics
        action:
          type: string
          enum:
          - preserve
          - edit
          description: preserve 一字不改;edit 允许润色 / preserve = keep verbatim, edit = may polish
      required:
      - text
      - action
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: ty_live_…
      description: '开发者 API Key,以 `ty_live_` 开头,在 https://www.musicsforyou.com/developers 创建。请求头 `Authorization: Bearer ty_live_…`。


        API keys start with `ty_live_`; create one at https://www.musicsforyou.com/developers. Send as `Authorization: Bearer ty_live_…`.'
    OAuth2:
      type: oauth2
      description: 给 ChatGPT / claude.ai 等连接器用的授权码流程 / Authorization-code flow for connector platforms.
      flows:
        authorizationCode:
          authorizationUrl: https://www.musicsforyou.com/oauth/authorize
          tokenUrl: https://api.musicsforyou.com/oauth/token
          scopes:
            music: 编译、生成、查询作品与额度 / Compile, generate, read tracks and credits
x-taoyuan:
  mcp:
    url: https://api.musicsforyou.com/mcp
    transport: streamable-http
    auth: 'Authorization: Bearer ty_live_…'
  llmsTxt: https://www.musicsforyou.com/llms.txt
  developers: https://www.musicsforyou.com/developers
  openapi:
    v31: https://api.musicsforyou.com/openapi.json
    v30: https://api.musicsforyou.com/openapi-coze.json
  credits:
    generate_music: 1
    create_song: 1
    replace_section: 1
    compile_music_prompt: 0
    revise_generation_prompt: 0
    get_generation: 0
    list_tracks: 0
    list_presets: 0
    get_credit_balance: 0
    separate_stems: 2-track free once per song for non-members, unlimited for members; 12-stem Pro only; no credits
  rateLimits:
    generate: 5 / minute / IP
    compile: 30 / hour / account; guests 5 / day / IP
  packs:
  - id: api-100
    currency: CNY
    price: 300
    credits: 100
  - id: api-10-usd
    currency: USD
    price: 9.9
    credits: 10
  - id: api-50-usd
    currency: USD
    price: 39
    credits: 50
  agentNotes:
  - Show the user the compiled title, lyrics and style before spending a credit.
  - Poll get_generation every 5–10 s; a song usually takes 1–3 minutes. Or use POST /v1/songs with waitSeconds.
  - Always pass idempotencyKey when retrying generate_music.
  - Songs made through the API may be used commercially by the key owner.