Suno Generate-Voice
以异步 Task 提交Generate Voice请求。
概览
使用必填输入提交Generate Voice请求。使用返回的 Task ID 查询状态,或提供 callback_url 接收下方列出的投递。
快速开始
- 创建 API Key,并将其设置为 RUNAPI_API_KEY。
- 发送与请求 Schema 匹配的 POST 请求。
- 保存返回的任务 ID,随后轮询到终态,或处理下方列出的回调。
端点
- 基础 URL
https://runapi.ai- API 版本
v1- 身份验证
Authorization: Bearer YOUR_API_TOKEN
支持的模型
打开模型页可查看当前价格、限流和商业使用详情。
请求 Schema
只发送文档列出的字段。提供 callback_url 后,它会收到下方列出的 Task 投递。
请求体7 个字段
callback_urlstringWebhook URL for async notifications.
descriptionstringCustom voice description.
singer_skill_levelstringSinger skill level.
可选值:beginner, intermediate, advanced, professional
stylestringStyle preset.
task_idstringPrior validation phrase task ID.
verify_urlstringUser recording URL of the validation phrase.
voice_namestringCustom voice display name.
创建已接受
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"task_replayed": {
"type": "boolean"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
轮询处理中
GET /api/v1/suno/generate_voice/:id
响应 Schema
{
"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
},
"id": {
"type": "string"
},
"provider_status": {
"enum": [
"wait_processing",
"processing_validate",
"wait_validating"
],
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"voice_id": {
"type": "string"
}
},
"required": [
"id",
"status",
"provider_status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"provider_status": "processing_validate",
"status": "processing"
}
轮询已完成
GET /api/v1/suno/generate_voice/:id
响应 Schema
{
"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
},
"id": {
"type": "string"
},
"provider_status": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"voice_id": {
"type": "string"
}
},
"required": [
"id",
"status",
"provider_status",
"voice_id",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"provider_status": "success",
"status": "completed",
"voice_id": "voice_reference"
}
轮询失败
GET /api/v1/suno/generate_voice/:id
响应 Schema
{
"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": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
客户回调:已完成
POST callback_url
响应 Schema
{
"properties": {
"id": {
"type": "string"
},
"provider_status": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"voice_id": {
"type": "string"
}
},
"required": [
"id",
"status",
"provider_status",
"voice_id"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"id": "tsk_reference_demo",
"provider_status": "success",
"status": "completed",
"voice_id": "voice_reference"
}
客户回调:失败
POST callback_url
响应 Schema
{
"properties": {
"error": {
"oneOf": [
{
"type": "string"
},
{
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
]
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error"
],
"type": "object",
"unevaluatedProperties": false
}
响应示例
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
错误
POST /api/v1/suno/generate_voice
此响应不包含正文。
错误
GET /api/v1/suno/generate_voice/:id
此响应不包含正文。
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "task_id_is_required",
"message": "task_id is required"
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance"
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "api_token_credit_limit_exceeded",
"message": "API key credit limit exceeded"
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "request_conflict",
"message": "The request uses features that are not supported for the selected model"
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "rate_limited",
"message": "Rate limit reached. Please retry later."
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "service_unavailable",
"message": "Service under maintenance, please try again later"
}
}
错误
POST /api/v1/suno/generate_voice
响应 Schema
{
"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
}
响应示例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": {
"code": "timeout_error",
"message": "The request timed out"
}
}
错误
GET /api/v1/suno/generate_voice/:id
响应 Schema
{
"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
}
响应示例
{
"error": {
"code": "not_found",
"message": "Task with id 'tsk_reference_demo' not found"
}
}
生成的代码示例
直接使用 cURL,或安装所用语言的 SDK。每个示例都会提交本参考中经过验证的请求。
curl -X POST https://runapi.ai/api/v1/suno/generate_voice \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"task_id":"tsk_validation_phrase","verify_url":"https://file.runapi.ai/validation-recording.mp3","voice_name":"Studio Voice"}'
安装
npm install @runapi.ai/suno
import { SunoClient } from "@runapi.ai/suno";
const client = new SunoClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.generateVoice.create({
"task_id": "tsk_validation_phrase",
"verify_url": "https://file.runapi.ai/validation-recording.mp3",
"voice_name": "Studio Voice"
});
安装
pip install runapi-suno
import os
from runapi.suno import SunoClient
client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.generate_voice.create(
task_id="tsk_validation_phrase",
verify_url="https://file.runapi.ai/validation-recording.mp3",
voice_name="Studio Voice"
)
安装
go get github.com/runapi-ai/suno-sdk/go@latest
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)
}
task, err := client.GenerateVoice.Create(context.Background(), suno.GenerateVoiceParams{
TaskID: "tsk_validation_phrase",
VerifyURL: "https://file.runapi.ai/validation-recording.mp3",
VoiceName: "Studio Voice",
})
if err != nil {
log.Fatal(err)
}
_ = task
}
安装
gem install runapi-suno
require "runapi/suno"
client = RunApi::Suno::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.generate_voice.create(
task_id: "tsk_validation_phrase",
verify_url: "https://file.runapi.ai/validation-recording.mp3",
voice_name: "Studio Voice"
)
安装
implementation("ai.runapi:runapi-suno")
import ai.runapi.suno.SunoClient;
import ai.runapi.suno.types.GenerateVoiceParams;
import ai.runapi.core.polling.TaskCreateResponse;
public final class Example {
public static void main(String[] args) {
SunoClient client = SunoClient.builder()
.apiKey(System.getenv("RUNAPI_API_KEY"))
.build();
TaskCreateResponse task = client.generateVoice().create(
GenerateVoiceParams.builder()
.taskId("tsk_validation_phrase")
.verifyUrl("https://file.runapi.ai/validation-recording.mp3")
.voiceName("Studio Voice")
.build()
);
}
}
安装
composer require runapi-ai/suno
<?php
require __DIR__ . '/vendor/autoload.php';
use RunApi\Core\ClientOptions;
use RunApi\Suno\SunoClient;
$client = new SunoClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->generateVoice->create([
"task_id" => "tsk_validation_phrase",
"verify_url" => "https://file.runapi.ai/validation-recording.mp3",
"voice_name" => "Studio Voice"
]);