桃源 Keys API
API Key 管理(仅网站登录)/ Key management (website session only)
API Key 管理(仅网站登录)/ Key management (website session only)
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/musicsforyou-com:musicsforyou-com-keys-api"
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.
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: 3.2.0
info:
title: Taoyuan Music Keys 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: Keys
description: API Key 管理(仅网站登录)/ Key management (website session only)
paths:
/v1/api-keys:
get:
operationId: list_api_keys
tags:
- Keys
summary: 列出 API Key(需网站登录,Key 不能管理 Key)/ List keys (website session only)
security:
- OAuth2:
- music
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ApiKeysResponse'
'401':
description: 未登录或 Key 无效 / Not authenticated(LOGIN_REQUIRED、INVALID_API_KEY)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: API Key 不能管理 API Key / Keys cannot manage keys
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-credit-cost: 0
post:
operationId: create_api_key
tags:
- Keys
summary: 创建 API Key(明文只显示一次;新 Key 附带 3 次免费额度)/ Create a key (shown once; new keys come…
security:
- OAuth2:
- music
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CreateApiKeyRequest'
responses:
'201':
description: 已创建 / Created
content:
application/json:
schema:
$ref: '#/components/schemas/CreateApiKeyResponse'
'401':
description: 未登录或 Key 无效 / Not authenticated(LOGIN_REQUIRED、INVALID_API_KEY)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: API Key 不能管理 API Key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-credit-cost: 0
/v1/api-keys/{id}:
delete:
operationId: revoke_api_key
tags:
- Keys
summary: 吊销 API Key / Revoke a key
security:
- OAuth2:
- music
parameters:
- name: id
in: path
required: true
schema:
type: string
description: key id
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'401':
description: 未登录或 Key 无效 / Not authenticated(LOGIN_REQUIRED、INVALID_API_KEY)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: 不存在 / Not found
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
x-credit-cost: 0
/v1/api-keys/{id}/webhook:
put:
operationId: set_api_key_webhook
tags:
- Keys
summary: 设置该 Key 的完成回调 / Set the key's completion webhook
description: '作品生成完成(finished)时向 `url` POST JSON `{ event: "generation.finished", generation }`,请求头 `X-Taoyuan-Signature: sha256=`。传 `null` 关闭。
When a generation started with this key reaches a terminal state, we POST `{ event: "generation.finished", generation }` to `url` with header `X-Taoyuan-Signature: sha256=`. Send `null` to turn it off.'
security:
- OAuth2:
- music
parameters:
- name: id
in: path
required: true
schema:
type: string
description: key id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookResponse'
'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'
'404':
description: 不存在 / Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
callbacks:
generationFinished:
'{$request.body#/url}':
post:
summary: 作品完成回调 / Completion webhook
parameters:
- name: X-Taoyuan-Signature
in: header
required: true
schema:
type: string
examples:
- sha256=9f2c…
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookPayload'
responses:
'200':
description: 收到即可,返回任意 2xx / Any 2xx acknowledges
x-credit-cost: 0
components:
schemas:
UiLanguage:
type: string
enum:
- zh
- en
- ja
description: 界面/解释文字语言 / Language of explanations
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
Clip:
type: object
properties:
id:
type: string
audioUrl:
type: string
format: uri
description: 完整音频(finished 后可用)/ Full audio URL once finished
streamAudioUrl:
type:
- string
- 'null'
format: uri
imageUrl:
type:
- string
- 'null'
format: uri
sourceImageUrl:
type:
- string
- 'null'
format: uri
title:
type:
- string
- 'null'
duration:
type:
- number
- 'null'
description: 秒 / seconds
tags:
type:
- string
- 'null'
lyrics:
type:
- string
- 'null'
modelName:
type:
- string
- 'null'
stems:
oneOf:
- $ref: '#/components/schemas/ClipStems'
- type: 'null'
required:
- id
- audioUrl
description: 一首候选 / One candidate track. Each generation returns two.
Generation:
type: object
properties:
id:
type: string
status:
$ref: '#/components/schemas/GenerationStatus'
source:
$ref: '#/components/schemas/GenerationSource'
parentId:
type:
- string
- 'null'
model:
type:
- string
- 'null'
title:
type:
- string
- 'null'
inputPrompt:
type: string
spec:
oneOf:
- $ref: '#/components/schemas/GenerationSpec'
- type: 'null'
clips:
type: array
items:
$ref: '#/components/schemas/Clip'
description: finished 时通常 2 首 / Usually 2 candidates when finished
coverUrl:
type:
- string
- 'null'
format: uri
description: 正式封面 / Cover image
cover:
oneOf:
- $ref: '#/components/schemas/Cover'
- type: 'null'
errorCode:
type:
- string
- 'null'
errorMessage:
type:
- string
- 'null'
creditSource:
type:
- string
- 'null'
enum:
- monthly
- credit
- unlimited
createdAt:
type: string
format: date-time
finishedAt:
type:
- string
- 'null'
format: date-time
required:
- id
- status
- source
- parentId
- model
- title
- inputPrompt
- spec
- clips
- coverUrl
- cover
- errorCode
- errorMessage
- creditSource
- createdAt
- finishedAt
description: 一次生成任务 / A generation job. Poll until status is finished or failed.
WebhookRequest:
type: object
properties:
url:
type:
- string
- 'null'
format: uri
description: HTTPS 地址;null 表示关闭 / HTTPS URL, or null to turn off
required:
- url
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
VocalPreference:
type: string
enum:
- m
- f
- duet
- choir
description: 人声偏好 / Vocal preference
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.
WebhookPayload:
type: object
properties:
event:
type: string
const: generation.finished
generation:
$ref: '#/components/schemas/Generation'
required:
- event
- generation
description: 作品完成(或失败)时 POST 到 webhook 的 JSON / Body POSTed to your webhook when a generation reaches a terminal state
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
WebhookResponse:
type: object
properties:
success:
type: boolean
const: true
webhookUrl:
type:
- string
- 'null'
format: uri
required:
- success
- webhookUrl
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
ClipStems:
type: object
properties:
mode:
type: string
enum:
- separate_vocal
- split_stem
status:
type: string
enum:
- pending
- finished
- failed
taskId:
type: string
files:
type: object
additionalProperties:
type: string
format: uri
description: 轨名 → 音频地址(vocals, instrumental, drums, bass…)/ stem name → audio URL
error:
type:
- string
- 'null'
requestedAt:
type: string
format: date-time
finishedAt:
type:
- string
- 'null'
format: date-time
required:
- mode
- status
- taskId
- files
- requestedAt
ApiKey:
type: object
properties:
id:
type: string
name:
type: string
prefix:
type: string
description: 例如 ty_live_ab12cd… / Masked prefix
lastUsedAt:
type:
- string
- 'null'
format: date-time
createdAt:
type: string
format: date-time
webhookUrl:
type:
- string
- 'null'
format: uri
description: 完成回调地址 / Completion webhook URL
required:
- id
- name
- prefix
- lastUsedAt
- createdAt
SuccessResponse:
type: object
properties:
success:
type: boolean
required:
- success
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
Cover:
type: object
properties:
status:
type: string
url:
type:
- string
- 'null'
format: uri
artworkUrl:
type:
- string
- 'null'
format: uri
styleId:
type:
- string
- 'null'
conceptId:
type:
- string
- 'null'
titleSafeZone:
type:
- string
- 'null'
latencyMs:
type:
- number
- 'null'
errorCode:
type:
- string
- 'null'
updatedAt:
type:
- string
- 'null'
required:
- status
- url
- artworkUrl
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.
GenerationSource:
type: string
enum:
- web
- api
- revise
- replace
- agent
- legacy
LyricLanguage:
type: string
enum:
- zh
- yue
- en
- ja
description: 歌词语言 / Lyric language (yue = Cantonese)
CreateApiKeyRequest:
type: object
properties:
name:
type: string
maxLength: 64
default: default
GenerationStatus:
type: string
enum:
- queued
- submitted
- generating
- finished
- failed
description: queued → submitted → generating → finished | failed
CreateApiKeyResponse:
type: object
properties:
success:
type: boolean
const: true
key:
type: string
description: 完整 Key,只返回这一次 / Full key, shown only once
apiKey:
$ref: '#/components/schemas/ApiKey'
note:
type: string
required:
- success
- key
- apiKey
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
ApiKeysResponse:
type: object
properties:
success:
type: boolean
const: true
keys:
type: array
items:
$ref: '#/components/schemas/ApiKey'
required:
- success
- keys
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.