生成音乐
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
duration: 123,
provider: {
order: ['<string>'],
only: ['<string>'],
ignore: ['<string>'],
include_alpha: true,
allow_fallbacks: true,
require_parameters: true,
required_execution_region: '<string>',
required_data_region: '<string>',
require_zero_data_retention: true,
zdr: true,
enforce_distillable_text: true,
quantizations: ['<string>'],
sort: '<string>',
max_price: {prompt: 123, completion: 123, image: 123, audio: 123, request: 123},
preferred_min_throughput: 123,
preferred_max_latency: 123
},
suno: {
prompt: '<string>',
style: '<string>',
title: '<string>',
customMode: true,
instrumental: true,
personaId: '<string>',
model: '<string>',
negativeTags: '<string>',
styleWeight: 0.5,
weirdnessConstraint: 0.5,
audioWeight: 0.5,
callBackUrl: '<string>'
},
elevenlabs: {
prompt: '<string>',
composition_plan: {},
music_length_ms: 123,
model_id: '<string>',
force_instrumental: true,
store_for_inpainting: true,
with_timestamps: true,
sign_with_c2pa: true,
output_format: '<string>'
},
echo_upstream_request: true,
debug: {
enabled: true,
return_upstream_request: true,
return_upstream_response: true,
trace: true
}
})
};
fetch('https://api.phaseo.app/v1/music/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/music/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"duration": 123,
"provider": {
"order": ["<string>"],
"only": ["<string>"],
"ignore": ["<string>"],
"include_alpha": True,
"allow_fallbacks": True,
"require_parameters": True,
"required_execution_region": "<string>",
"required_data_region": "<string>",
"require_zero_data_retention": True,
"zdr": True,
"enforce_distillable_text": True,
"quantizations": ["<string>"],
"sort": "<string>",
"max_price": {
"prompt": 123,
"completion": 123,
"image": 123,
"audio": 123,
"request": 123
},
"preferred_min_throughput": 123,
"preferred_max_latency": 123
},
"suno": {
"prompt": "<string>",
"style": "<string>",
"title": "<string>",
"customMode": True,
"instrumental": True,
"personaId": "<string>",
"model": "<string>",
"negativeTags": "<string>",
"styleWeight": 0.5,
"weirdnessConstraint": 0.5,
"audioWeight": 0.5,
"callBackUrl": "<string>"
},
"elevenlabs": {
"prompt": "<string>",
"composition_plan": {},
"music_length_ms": 123,
"model_id": "<string>",
"force_instrumental": True,
"store_for_inpainting": True,
"with_timestamps": True,
"sign_with_c2pa": True,
"output_format": "<string>"
},
"echo_upstream_request": True,
"debug": {
"enabled": True,
"return_upstream_request": True,
"return_upstream_response": True,
"trace": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/music/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"duration": 123,
"provider": {
"order": [
"<string>"
],
"only": [
"<string>"
],
"ignore": [
"<string>"
],
"include_alpha": true,
"allow_fallbacks": true,
"require_parameters": true,
"required_execution_region": "<string>",
"required_data_region": "<string>",
"require_zero_data_retention": true,
"zdr": true,
"enforce_distillable_text": true,
"quantizations": [
"<string>"
],
"sort": "<string>",
"max_price": {
"prompt": 123,
"completion": 123,
"image": 123,
"audio": 123,
"request": 123
},
"preferred_min_throughput": 123,
"preferred_max_latency": 123
},
"suno": {
"prompt": "<string>",
"style": "<string>",
"title": "<string>",
"customMode": true,
"instrumental": true,
"personaId": "<string>",
"model": "<string>",
"negativeTags": "<string>",
"styleWeight": 0.5,
"weirdnessConstraint": 0.5,
"audioWeight": 0.5,
"callBackUrl": "<string>"
},
"elevenlabs": {
"prompt": "<string>",
"composition_plan": {},
"music_length_ms": 123,
"model_id": "<string>",
"force_instrumental": true,
"store_for_inpainting": true,
"with_timestamps": true,
"sign_with_c2pa": true,
"output_format": "<string>"
},
"echo_upstream_request": true,
"debug": {
"enabled": true,
"return_upstream_request": true,
"return_upstream_response": true,
"trace": true
}
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/music/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phaseo.app/v1/music/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/music/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'duration' => 123,
'provider' => [
'order' => [
'<string>'
],
'only' => [
'<string>'
],
'ignore' => [
'<string>'
],
'include_alpha' => true,
'allow_fallbacks' => true,
'require_parameters' => true,
'required_execution_region' => '<string>',
'required_data_region' => '<string>',
'require_zero_data_retention' => true,
'zdr' => true,
'enforce_distillable_text' => true,
'quantizations' => [
'<string>'
],
'sort' => '<string>',
'max_price' => [
'prompt' => 123,
'completion' => 123,
'image' => 123,
'audio' => 123,
'request' => 123
],
'preferred_min_throughput' => 123,
'preferred_max_latency' => 123
],
'suno' => [
'prompt' => '<string>',
'style' => '<string>',
'title' => '<string>',
'customMode' => true,
'instrumental' => true,
'personaId' => '<string>',
'model' => '<string>',
'negativeTags' => '<string>',
'styleWeight' => 0.5,
'weirdnessConstraint' => 0.5,
'audioWeight' => 0.5,
'callBackUrl' => '<string>'
],
'elevenlabs' => [
'prompt' => '<string>',
'composition_plan' => [
],
'music_length_ms' => 123,
'model_id' => '<string>',
'force_instrumental' => true,
'store_for_inpainting' => true,
'with_timestamps' => true,
'sign_with_c2pa' => true,
'output_format' => '<string>'
],
'echo_upstream_request' => true,
'debug' => [
'enabled' => true,
'return_upstream_request' => true,
'return_upstream_response' => true,
'trace' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/music/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "music",
"status": "queued",
"model": "<string>",
"provider": "<string>",
"nativeResponseId": "<string>",
"audio_url": "<string>",
"audio_base64": "<string>",
"result": "<unknown>",
"output": [
{}
],
"usage": {}
}音乐生成
生成音乐
通过一个与提供商无关的端点生成音乐。Phaseo 会等待同步提供商完成,并在内部处理提供商队列的轮询。
POST
/
music
/
generate
生成音乐
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
duration: 123,
provider: {
order: ['<string>'],
only: ['<string>'],
ignore: ['<string>'],
include_alpha: true,
allow_fallbacks: true,
require_parameters: true,
required_execution_region: '<string>',
required_data_region: '<string>',
require_zero_data_retention: true,
zdr: true,
enforce_distillable_text: true,
quantizations: ['<string>'],
sort: '<string>',
max_price: {prompt: 123, completion: 123, image: 123, audio: 123, request: 123},
preferred_min_throughput: 123,
preferred_max_latency: 123
},
suno: {
prompt: '<string>',
style: '<string>',
title: '<string>',
customMode: true,
instrumental: true,
personaId: '<string>',
model: '<string>',
negativeTags: '<string>',
styleWeight: 0.5,
weirdnessConstraint: 0.5,
audioWeight: 0.5,
callBackUrl: '<string>'
},
elevenlabs: {
prompt: '<string>',
composition_plan: {},
music_length_ms: 123,
model_id: '<string>',
force_instrumental: true,
store_for_inpainting: true,
with_timestamps: true,
sign_with_c2pa: true,
output_format: '<string>'
},
echo_upstream_request: true,
debug: {
enabled: true,
return_upstream_request: true,
return_upstream_response: true,
trace: true
}
})
};
fetch('https://api.phaseo.app/v1/music/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/music/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"duration": 123,
"provider": {
"order": ["<string>"],
"only": ["<string>"],
"ignore": ["<string>"],
"include_alpha": True,
"allow_fallbacks": True,
"require_parameters": True,
"required_execution_region": "<string>",
"required_data_region": "<string>",
"require_zero_data_retention": True,
"zdr": True,
"enforce_distillable_text": True,
"quantizations": ["<string>"],
"sort": "<string>",
"max_price": {
"prompt": 123,
"completion": 123,
"image": 123,
"audio": 123,
"request": 123
},
"preferred_min_throughput": 123,
"preferred_max_latency": 123
},
"suno": {
"prompt": "<string>",
"style": "<string>",
"title": "<string>",
"customMode": True,
"instrumental": True,
"personaId": "<string>",
"model": "<string>",
"negativeTags": "<string>",
"styleWeight": 0.5,
"weirdnessConstraint": 0.5,
"audioWeight": 0.5,
"callBackUrl": "<string>"
},
"elevenlabs": {
"prompt": "<string>",
"composition_plan": {},
"music_length_ms": 123,
"model_id": "<string>",
"force_instrumental": True,
"store_for_inpainting": True,
"with_timestamps": True,
"sign_with_c2pa": True,
"output_format": "<string>"
},
"echo_upstream_request": True,
"debug": {
"enabled": True,
"return_upstream_request": True,
"return_upstream_response": True,
"trace": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/music/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"duration": 123,
"provider": {
"order": [
"<string>"
],
"only": [
"<string>"
],
"ignore": [
"<string>"
],
"include_alpha": true,
"allow_fallbacks": true,
"require_parameters": true,
"required_execution_region": "<string>",
"required_data_region": "<string>",
"require_zero_data_retention": true,
"zdr": true,
"enforce_distillable_text": true,
"quantizations": [
"<string>"
],
"sort": "<string>",
"max_price": {
"prompt": 123,
"completion": 123,
"image": 123,
"audio": 123,
"request": 123
},
"preferred_min_throughput": 123,
"preferred_max_latency": 123
},
"suno": {
"prompt": "<string>",
"style": "<string>",
"title": "<string>",
"customMode": true,
"instrumental": true,
"personaId": "<string>",
"model": "<string>",
"negativeTags": "<string>",
"styleWeight": 0.5,
"weirdnessConstraint": 0.5,
"audioWeight": 0.5,
"callBackUrl": "<string>"
},
"elevenlabs": {
"prompt": "<string>",
"composition_plan": {},
"music_length_ms": 123,
"model_id": "<string>",
"force_instrumental": true,
"store_for_inpainting": true,
"with_timestamps": true,
"sign_with_c2pa": true,
"output_format": "<string>"
},
"echo_upstream_request": true,
"debug": {
"enabled": true,
"return_upstream_request": true,
"return_upstream_response": true,
"trace": true
}
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/music/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phaseo.app/v1/music/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/music/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'duration' => 123,
'provider' => [
'order' => [
'<string>'
],
'only' => [
'<string>'
],
'ignore' => [
'<string>'
],
'include_alpha' => true,
'allow_fallbacks' => true,
'require_parameters' => true,
'required_execution_region' => '<string>',
'required_data_region' => '<string>',
'require_zero_data_retention' => true,
'zdr' => true,
'enforce_distillable_text' => true,
'quantizations' => [
'<string>'
],
'sort' => '<string>',
'max_price' => [
'prompt' => 123,
'completion' => 123,
'image' => 123,
'audio' => 123,
'request' => 123
],
'preferred_min_throughput' => 123,
'preferred_max_latency' => 123
],
'suno' => [
'prompt' => '<string>',
'style' => '<string>',
'title' => '<string>',
'customMode' => true,
'instrumental' => true,
'personaId' => '<string>',
'model' => '<string>',
'negativeTags' => '<string>',
'styleWeight' => 0.5,
'weirdnessConstraint' => 0.5,
'audioWeight' => 0.5,
'callBackUrl' => '<string>'
],
'elevenlabs' => [
'prompt' => '<string>',
'composition_plan' => [
],
'music_length_ms' => 123,
'model_id' => '<string>',
'force_instrumental' => true,
'store_for_inpainting' => true,
'with_timestamps' => true,
'sign_with_c2pa' => true,
'output_format' => '<string>'
],
'echo_upstream_request' => true,
'debug' => [
'enabled' => true,
'return_upstream_request' => true,
'return_upstream_response' => true,
'trace' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/music/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123,\n \"provider\": {\n \"order\": [\n \"<string>\"\n ],\n \"only\": [\n \"<string>\"\n ],\n \"ignore\": [\n \"<string>\"\n ],\n \"include_alpha\": true,\n \"allow_fallbacks\": true,\n \"require_parameters\": true,\n \"required_execution_region\": \"<string>\",\n \"required_data_region\": \"<string>\",\n \"require_zero_data_retention\": true,\n \"zdr\": true,\n \"enforce_distillable_text\": true,\n \"quantizations\": [\n \"<string>\"\n ],\n \"sort\": \"<string>\",\n \"max_price\": {\n \"prompt\": 123,\n \"completion\": 123,\n \"image\": 123,\n \"audio\": 123,\n \"request\": 123\n },\n \"preferred_min_throughput\": 123,\n \"preferred_max_latency\": 123\n },\n \"suno\": {\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"title\": \"<string>\",\n \"customMode\": true,\n \"instrumental\": true,\n \"personaId\": \"<string>\",\n \"model\": \"<string>\",\n \"negativeTags\": \"<string>\",\n \"styleWeight\": 0.5,\n \"weirdnessConstraint\": 0.5,\n \"audioWeight\": 0.5,\n \"callBackUrl\": \"<string>\"\n },\n \"elevenlabs\": {\n \"prompt\": \"<string>\",\n \"composition_plan\": {},\n \"music_length_ms\": 123,\n \"model_id\": \"<string>\",\n \"force_instrumental\": true,\n \"store_for_inpainting\": true,\n \"with_timestamps\": true,\n \"sign_with_c2pa\": true,\n \"output_format\": \"<string>\"\n },\n \"echo_upstream_request\": true,\n \"debug\": {\n \"enabled\": true,\n \"return_upstream_request\": true,\n \"return_upstream_response\": true,\n \"trace\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "music",
"status": "queued",
"model": "<string>",
"provider": "<string>",
"nativeResponseId": "<string>",
"audio_url": "<string>",
"audio_base64": "<string>",
"result": "<unknown>",
"output": [
{}
],
"usage": {}
}通过统一且不依赖供应商的 API 生成音乐。Phaseo 会在后台处理同步响应并轮询供应商队列。
生成完成后,响应会包含
audio_url 或 audio_base64。如果供应商返回的任务尚未结束,请使用响应中的同一 id 调用 GET /music/generate/{music_id}。
请求结构
{
"model": "minimax/music-3.0:free",
"prompt": "Warm jazz trio with brushed drums",
"format": "mp3"
}
Suno 选项
suno.customMode(布尔值,默认值为false)suno.instrumental(布尔值,默认值为false)suno.prompt(可选,用于覆盖顶层prompt)suno.style,suno.title(当customMode = true时必填)suno.personaId,suno.personaModelsuno.negativeTags,suno.vocalGendersuno.styleWeight,suno.weirdnessConstraint,suno.audioWeight
验证规则
- 当
customMode = false时,必须提供prompt。 - 当
customMode = true时,必须提供style和title。 - 当
customMode = true且instrumental = false时,必须提供prompt。
400,并包含:
{
"error": "validation_error",
"reason": "..."
}
响应
{
"id": "req_01JY6MUSIC123",
"object": "music",
"status": "completed",
"provider": "gmicloud",
"model": "minimax/music-3.0:free",
"nativeResponseId": "5c30b275-d669-4a25-8151-de6d60214853",
"audio_url": "https://.../generated-music.mp3",
"usage": {
"requests": 1,
"output_audio_seconds": 25.364
}
}
id是 Phaseo 的稳定请求 ID。使用GET /music/generate/{music_id}检索该请求。nativeResponseId是上游提供商的标识符,用于关联提供商请求并联系其支持团队。status可以是queued、in_progress、completed或failed。- 提供商报告生成时长时,
usage可能包含output_audio_seconds。
授权
Bearer 令牌身份验证
请求体
application/json
响应
200 - application/json
音乐生成响应
稳定的 Phaseo 请求 ID,可与 GET /music/generate/{music_id} 搭配使用。
可用选项:
music 可用选项:
queued, in_progress, completed, failed 用于关联和支持的上游提供商标识符。
由 Phaseo 标准化的提供商结果元数据。
最后修改于 2026年10月2日