音乐
生成音乐
通过一个与提供商无关的端点生成音乐。Phaseo 会等待同步提供商完成,并在内部处理提供商队列的轮询。
POST
/
music
/
generate
生成音乐
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
models: ['anthropic/claude-sonnet-5-5', 'google/gemini-2.5-flash'],
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>",
"models": ["anthropic/claude-sonnet-5-5", "google/gemini-2.5-flash"],
"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>",
"models": [
"anthropic/claude-sonnet-5-5",
"google/gemini-2.5-flash"
],
"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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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>',
'models' => [
'anthropic/claude-sonnet-5-5',
'google/gemini-2.5-flash'
],
'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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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": {}
}将
已完成的生成结果包含
当
model 和 prompt 发送到 POST /v1/music/generate,即可用同一种请求格式从任意音乐提供商获得一首曲目。Phaseo 会替你处理同步提供商以及提供商队列的轮询。
curl https://api.phaseo.app/v1/music/generate \
-H "Authorization: Bearer $PHASEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax/music-3.0:free",
"prompt": "Warm jazz trio with brushed drums",
"format": "mp3"
}'
读取结果
{
"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
}
}
audio_url 或 audio_base64。status 为 queued、in_progress、completed 或 failed。如果尚未到达最终状态,请使用同一个 id 轮询 GET /v1/music/generate/{music_id}。
id 是稳定的 Phaseo 请求 ID。nativeResponseId 是上游提供商的标识符,用于与提供商关联和联系支持。当提供商报告生成时长时,usage 会包含 output_audio_seconds。
设置 Suno 选项
Suno 模型接受一个可选的suno 对象:
| 字段 | 类型 | 说明 |
|---|---|---|
customMode | boolean | 默认为 false |
instrumental | boolean | 默认为 false |
prompt | string | 覆盖顶层 prompt |
style、title | string | 当 customMode 为 true 时必填 |
personaId、personaModel | string | |
negativeTags | string | |
vocalGender | m 或 f | |
styleWeight、weirdnessConstraint、audioWeight | number | 0 到 1 |
customMode 为 false 时,以及当 customMode 为 true 且 instrumental 设为 false 时,prompt 为必填项。
违反提供商规则的请求会返回 400:
{
"error": "validation_error",
"reason": "..."
}
请求体
application/json
在 model 之后按顺序尝试的可选回退模型。model 为必填项,且始终是主模型。当某次尝试以 429、500、502、503 或 504 失败时,会尝试下一项;其他错误按原样返回。最多接受 25 个模型 ID 或预设;重复项以及与 model 相同的项会被忽略。每次尝试都会作为独立请求进行验证、记录和计费,响应中的 model 字段和路由追踪会显示实际处理请求的模型。流式请求仅在发送第一个字节之前回退,视频和音乐任务仅在提交时回退。Batch、realtime 和 council 请求会拒绝 models。动态路由上设置的回退优先,且 phaseo/auto 不能与 models 一起使用。
Required array length:
1 - 25 elementsMinimum string length:
1示例:
[
"anthropic/claude-sonnet-5-5",
"google/gemini-2.5-flash"
]
响应
200 - application/json
音乐生成响应
最后修改于 2026年11月16日
⌘I
生成音乐
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
models: ['anthropic/claude-sonnet-5-5', 'google/gemini-2.5-flash'],
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>",
"models": ["anthropic/claude-sonnet-5-5", "google/gemini-2.5-flash"],
"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>",
"models": [
"anthropic/claude-sonnet-5-5",
"google/gemini-2.5-flash"
],
"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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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>',
'models' => [
'anthropic/claude-sonnet-5-5',
'google/gemini-2.5-flash'
],
'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 \"models\": [\n \"anthropic/claude-sonnet-5-5\",\n \"google/gemini-2.5-flash\"\n ],\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": {}
}