提交音乐生成任务
curl --request POST \
--url https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis \
--header 'Content-Type: application/json' \
--data '
{
"model": "pre-qwen-music-async-dev",
"input": {
"prompt": "<string>",
"lyrics": "<string>",
"style": "<string>",
"media": [
{
"type": "melody",
"url": "<string>"
}
]
},
"parameters": {
"custom_mode": false,
"return_candidate_audio": true,
"return_post_info": true,
"output_audio_settings": {
"format": "wav",
"sample_rate": 48000
}
},
"hook_url": "<string>"
}
'import requests
url = "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis"
payload = {
"model": "pre-qwen-music-async-dev",
"input": {
"prompt": "<string>",
"lyrics": "<string>",
"style": "<string>",
"media": [
{
"type": "melody",
"url": "<string>"
}
]
},
"parameters": {
"custom_mode": False,
"return_candidate_audio": True,
"return_post_info": True,
"output_audio_settings": {
"format": "wav",
"sample_rate": 48000
}
},
"hook_url": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'pre-qwen-music-async-dev',
input: {
prompt: '<string>',
lyrics: '<string>',
style: '<string>',
media: [{type: 'melody', url: '<string>'}]
},
parameters: {
custom_mode: false,
return_candidate_audio: true,
return_post_info: true,
output_audio_settings: {format: 'wav', sample_rate: 48000}
},
hook_url: '<string>'
})
};
fetch('https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis",
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' => 'pre-qwen-music-async-dev',
'input' => [
'prompt' => '<string>',
'lyrics' => '<string>',
'style' => '<string>',
'media' => [
[
'type' => 'melody',
'url' => '<string>'
]
]
],
'parameters' => [
'custom_mode' => false,
'return_candidate_audio' => true,
'return_post_info' => true,
'output_audio_settings' => [
'format' => 'wav',
'sample_rate' => 48000
]
],
'hook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis"
payload := strings.NewReader("{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"output": {
"task_id": "<string>"
}
}提交音乐生成任务
提交 QW Music 音乐生成任务。支持文生曲(prompt 模式)和自定义歌词模式。
POST
/
qwm
/
api
/
v1
/
services
/
aigc
/
audio-generation
/
audio-synthesis
提交音乐生成任务
curl --request POST \
--url https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis \
--header 'Content-Type: application/json' \
--data '
{
"model": "pre-qwen-music-async-dev",
"input": {
"prompt": "<string>",
"lyrics": "<string>",
"style": "<string>",
"media": [
{
"type": "melody",
"url": "<string>"
}
]
},
"parameters": {
"custom_mode": false,
"return_candidate_audio": true,
"return_post_info": true,
"output_audio_settings": {
"format": "wav",
"sample_rate": 48000
}
},
"hook_url": "<string>"
}
'import requests
url = "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis"
payload = {
"model": "pre-qwen-music-async-dev",
"input": {
"prompt": "<string>",
"lyrics": "<string>",
"style": "<string>",
"media": [
{
"type": "melody",
"url": "<string>"
}
]
},
"parameters": {
"custom_mode": False,
"return_candidate_audio": True,
"return_post_info": True,
"output_audio_settings": {
"format": "wav",
"sample_rate": 48000
}
},
"hook_url": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'pre-qwen-music-async-dev',
input: {
prompt: '<string>',
lyrics: '<string>',
style: '<string>',
media: [{type: 'melody', url: '<string>'}]
},
parameters: {
custom_mode: false,
return_candidate_audio: true,
return_post_info: true,
output_audio_settings: {format: 'wav', sample_rate: 48000}
},
hook_url: '<string>'
})
};
fetch('https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis",
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' => 'pre-qwen-music-async-dev',
'input' => [
'prompt' => '<string>',
'lyrics' => '<string>',
'style' => '<string>',
'media' => [
[
'type' => 'melody',
'url' => '<string>'
]
]
],
'parameters' => [
'custom_mode' => false,
'return_candidate_audio' => true,
'return_post_info' => true,
'output_audio_settings' => [
'format' => 'wav',
'sample_rate' => 48000
]
],
'hook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis"
payload := strings.NewReader("{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/qwm/api/v1/services/aigc/audio-generation/audio-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"pre-qwen-music-async-dev\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"style\": \"<string>\",\n \"media\": [\n {\n \"type\": \"melody\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"custom_mode\": false,\n \"return_candidate_audio\": true,\n \"return_post_info\": true,\n \"output_audio_settings\": {\n \"format\": \"wav\",\n \"sample_rate\": 48000\n }\n },\n \"hook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"output": {
"task_id": "<string>"
}
}
提交 QW Music 音乐生成任务。支持以下模式:
- 文生曲(custom_mode=false):通过自然语言 prompt 描述生成音乐
- 自定义歌词(custom_mode=true):指定 style + lyrics 精确控制歌词和风格
- 翻唱/改编:携带
media参考音频,可在上述任一模式下使用
Body
application/json
Last modified on July 2, 2026
⌘I