API 参考
Suno Generate-Persona
提交同步Generate Persona请求,并在同一响应中接收结果。
01
概览
提交Generate Persona请求,并直接使用同一响应返回的结果。
快速开始
- 创建 API Key,并将其设置为 RUNAPI_API_KEY。
- 发送与请求 Schema 匹配的 POST 请求。
- 从成功响应正文中读取结果。
端点
- 基础 URL
https://runapi.ai- API 版本
v1- 身份验证
Authorization: Bearer YOUR_API_TOKEN
02
支持的模型
打开模型页可查看当前价格、限流和商业使用详情。
03
JSON 请求体请求 Schema
只发送此端点声明的字段。
请求体4 个字段
audio_idstring
必填
Audio ID within the source task.
descriptionstring
必填
Persona description.
namestring
必填
Persona name.
task_idstring
必填
Source task ID with reference vocals.
04
HTTP 200成功响应
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"persona": {
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name",
"description"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"persona",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"persona": {
"description": "A warm and expressive vocal character.",
"id": "persona_reference",
"name": "Studio Voice"
}
}
05
HTTP 401错误
POST /api/v1/suno/generate_persona
此响应不包含正文。
06
HTTP 400错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "task_id_is_required",
"message": "task_id is required"
}
}
07
HTTP 402错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance"
}
}
08
HTTP 403错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "api_token_credit_limit_exceeded",
"message": "API key credit limit exceeded"
}
}
09
HTTP 409错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "request_conflict",
"message": "The request uses features that are not supported for the selected model"
}
}
10
HTTP 429错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "rate_limited",
"message": "Rate limit reached. Please retry later."
}
}
11
HTTP 503错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"error": {
"code": "service_unavailable",
"message": "Service under maintenance, please try again later"
}
}
12
HTTP 504错误
POST /api/v1/suno/generate_persona
响应 Schema
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
JSON
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": {
"code": "timeout_error",
"message": "The request timed out"
}
}
13
生成的代码示例
直接使用 cURL,或安装所用语言的 SDK。每个示例都会提交本参考中经过验证的请求。
CURL
curl -X POST https://runapi.ai/api/v1/suno/generate_persona \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"task_id":"tsk_source_music","audio_id":"audio_reference","name":"Studio Voice","description":"A warm and expressive vocal character."}'
安装
BASH
npm install @runapi.ai/suno
JAVASCRIPT
import { SunoClient } from "@runapi.ai/suno";
const client = new SunoClient({ apiKey: process.env.RUNAPI_API_KEY });
const result = await client.generatePersona.run({
"task_id": "tsk_source_music",
"audio_id": "audio_reference",
"name": "Studio Voice",
"description": "A warm and expressive vocal character."
});
安装
BASH
pip install runapi-suno
PYTHON
import os
from runapi.suno import SunoClient
client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.generate_persona.run(
task_id="tsk_source_music",
audio_id="audio_reference",
name="Studio Voice",
description="A warm and expressive vocal character."
)
安装
BASH
go get github.com/runapi-ai/suno-sdk/go@latest
GO
package main
import (
"context"
"log"
"os"
"github.com/runapi-ai/core-sdk/go/option"
suno "github.com/runapi-ai/suno-sdk/go/suno"
)
func main() {
client, err := suno.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
if err != nil {
log.Fatal(err)
}
result, err := client.GeneratePersona.Run(context.Background(), suno.GeneratePersonaParams{
TaskID: "tsk_source_music",
AudioID: "audio_reference",
Name: "Studio Voice",
Description: "A warm and expressive vocal character.",
})
if err != nil {
log.Fatal(err)
}
_ = result
}
安装
BASH
gem install runapi-suno
RUBY
require "runapi/suno"
client = RunApi::Suno::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
result = client.generate_persona.run(
task_id: "tsk_source_music",
audio_id: "audio_reference",
name: "Studio Voice",
description: "A warm and expressive vocal character."
)
安装
KOTLIN
implementation("ai.runapi:runapi-suno")
JAVA
import ai.runapi.suno.SunoClient;
import ai.runapi.suno.types.GeneratePersonaParams;
import ai.runapi.suno.types.GeneratePersonaResponse;
public final class Example {
public static void main(String[] args) {
SunoClient client = SunoClient.builder()
.apiKey(System.getenv("RUNAPI_API_KEY"))
.build();
GeneratePersonaResponse result = client.generatePersona().run(
GeneratePersonaParams.builder()
.taskId("tsk_source_music")
.audioId("audio_reference")
.name("Studio Voice")
.description("A warm and expressive vocal character.")
.build()
);
}
}
安装
BASH
composer require runapi-ai/suno
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use RunApi\Core\ClientOptions;
use RunApi\Suno\SunoClient;
$client = new SunoClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$result = $client->generatePersona->run([
"task_id" => "tsk_source_music",
"audio_id" => "audio_reference",
"name" => "Studio Voice",
"description" => "A warm and expressive vocal character."
]);
14