使用原生登录 access_token 提交 KIE 异步媒体任务(Go 路由为 POST /pg/tasks/{key},KIE 插件 key 为 kie;Suno 音乐模型调用 ID 为 ai-music-api/generate,单次请求正常生成两条 MP3 音轨)。返回原生 {task_id},随后通过 GET /pg/tasks/{task_id} 与 /pg/tasks/{task_id}/artifacts 轮询并带登录 Bearer 下载音轨。
/pg/tasks/kieAuthorizations
AuthorizationstringrequiredUse a native login access_token (required access: Native access token) with owner isolation and trusted browser Origin; generation writes use wallet billing while reads do not precharge; inference API Keys (sk-…) and PATs (nap_…) are rejected.
Authorization: Bearer $ONEASTER_ACCESS_TOKEN
Parameters
Idempotency-Keystringheader · 每次新发起的 /pg 生成提交建议由前端生成并持久化稳定的 1–100 位无空格可打印 ASCII 标识(推荐 UUID),断线重试保持原标识与原请求字节。同账号跨所有 /pg POST 协议共用一个命名空间;省略时后端兼容生成并通过 X-OneAster-Intent-ID 返回,但若响应头丢失将无法按意图恢复。
Body · application/json
modelstringrequired公开模型调用 ID;KIE Suno 异步音乐为 ai-music-api/generate(不能使用 display_name)
promptstring提示词(上限 3000 字符)
ninteger仅允许省略或 1;不通过 n 重复创建付费任务
audioobjectJSON Schema
{
"type": "object",
"required": [
"model"
],
"properties": {
"model": {
"type": "string",
"description": "公开模型调用 ID;KIE Suno 异步音乐为 ai-music-api/generate(不能使用 display_name)"
},
"prompt": {
"type": "string",
"maxLength": 3000,
"description": "提示词(上限 3000 字符)"
},
"n": {
"type": "integer",
"enum": [
1
],
"description": "仅允许省略或 1;不通过 n 重复创建付费任务"
},
"audio": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"music"
],
"description": "KIE Suno 音乐模式固定为 music"
},
"music_version": {
"type": "string",
"enum": [
"V6",
"V6_MINI",
"V6_WILD"
],
"default": "V6"
},
"custom_mode": {
"type": "boolean",
"default": false
},
"instrumental": {
"type": "boolean",
"default": false
},
"style": {
"type": "string",
"maxLength": 1000,
"description": "音乐风格(上限 1000 字符;style 与 lyrics 至少一项非空)"
},
"lyrics": {
"type": "string",
"maxLength": 5000,
"description": "歌词内容(上限 5000 字符;style 与 lyrics 至少一项非空)"
},
"title": {
"type": "string",
"maxLength": 80,
"description": "曲目标题(上限 80 字符;custom_mode=true 时必填)"
},
"duration": {
"type": "integer",
"anyOf": [
{
"const": 0
},
{
"type": "integer",
"minimum": 10,
"maximum": 360
}
],
"description": "目标时长秒(整数 10–360,仅 custom_mode=true 有效;省略或 0 不指定目标时长)"
}
},
"additionalProperties": true
}
},
"additionalProperties": true
}