API âm nhạc Suno
Tạo, chỉnh sửa, phân tích và xuất nhạc bằng Suno Premier.
Tạo, chỉnh sửa, phân tích và xuất nhạc bằng Suno Premier.
Mô hình
suno-v6· Mô hình tiêu chuẩn cho bản hòa âm không lời hoặc bài hát có giọng ca.suno-v6-wild· Dùng cho bản phối thử nghiệm và kết hợp nhiều phong cách.suno-v6-mini· Dùng để thử nhanh giai điệu và âm sắc.
Gửi và kiểm tra tác vụ
Gửi khóa APIMaster dưới dạng mã Bearer. Nếu có lỗi mạng, gửi lại cùng yêu cầu với cùng Idempotency-Key. Dùng khóa mới cho mỗi tác vụ mới. Kiểm tra đường dẫn trạng thái đến khi nhận được completed hoặc failed.
curl "$APIMASTER_API_BASE/v1/music/tasks/$TASK_ID" \
-H "Authorization: Bearer $APIMASTER_KEY"
Tải tệp WAV lên, tạo bản cover và nối dài
Gửi trực tiếp tệp WAV trong phần thân yêu cầu, tối đa 32 MiB. Tham số truy vấn không bắt buộc title dùng để đặt tiêu đề. Giá cơ sở là 0,004 USD mỗi lần tải lên. Sau khi hoàn tất, dùng ID tác vụ tải lên và chỉ số bản nhạc 0 để tạo bản cover hoặc nối dài. Khi nối dài, khai báo continue_at tính bằng giây, từ 0,4 trở lên và trong thời lượng của bản gốc.
curl -X POST "$APIMASTER_API_BASE/v1/music/uploads?title=Original%20demo" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: audio/wav" \
-H "Idempotency-Key: suno-upload-example-001" \
--data-binary @demo.wav
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-cover-example-001" \
-d '{"model":"suno-v6","operation":"cover","source":{"task_id":"UPLOAD_TASK_ID","track_index":0},"style":"Acoustic string trio","duration":20}'
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-extend-example-001" \
-d '{"model":"suno-v6","operation":"extend","source":{"task_id":"UPLOAD_TASK_ID","track_index":0},"style":"Acoustic string trio","continue_at":8,"duration":20}'
Ghép, phân tích và làm lại bài hát
Dùng tác vụ đã hoàn tất của cùng tài khoản làm nguồn. source.task_id là ID tác vụ. source.track_index là chỉ số trong tracks[] bắt đầu từ 0. Giá cơ sở áp dụng cho mỗi tác vụ thành công. Số tiền thực tế phụ thuộc vào nhóm giá và quy tắc của tài khoản.
| Thao tác | Kết quả và tham số | Giá cơ sở (USD) |
|---|---|---|
concat |
Ghép phần nối dài đã hoàn tất với bài hát gốc. Dùng tác vụ nối dài làm nguồn. | 0.004 |
bpm |
Trả về tốc độ, giọng và số chỉ nhịp. Xem tốc độ tại result.bpm. |
0.0008 |
aligned_lyrics |
Trả về lời bài hát theo từng từ và mốc thời gian. Đọc word, start_s và end_s trong result.words[]. |
0.0008 |
inspo |
Tạo bài hát từ một bản nhạc của tài khoản và tool_options.prompt. Yêu cầu suno-v6. |
0.068 |
remaster |
Remaster bản nhạc của tài khoản bằng AI. Yêu cầu suno-v6. Có thể dùng tool_options.prompt để mô tả các điều chỉnh mong muốn. |
0.05 |
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-concat-example-001" \
-d '{"model":"suno-v6","operation":"concat","source":{"task_id":"EXTENSION_TASK_ID","track_index":0}}'
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-bpm-example-001" \
-d '{"model":"suno-v6","operation":"bpm","source":{"task_id":"SONG_TASK_ID","track_index":0}}'
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-aligned_lyrics-example-001" \
-d '{"model":"suno-v6","operation":"aligned_lyrics","source":{"task_id":"VOCAL_TASK_ID","track_index":0}}'
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-inspo-example-001" \
-d '{"model":"suno-v6","operation":"inspo","source":{"task_id":"SONG_TASK_ID","track_index":0},"tool_options":{"prompt":"Create an acoustic variation with soft piano."}}'
curl "$APIMASTER_API_BASE/v1/music/generations" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: suno-remaster-example-001" \
-d '{"model":"suno-v6","operation":"remaster","source":{"task_id":"SONG_TASK_ID","track_index":0},"tool_options":{"prompt":"Keep the original arrangement and clarify the vocals."}}'
Nghe thử và xuất MP3 hoặc WAV
Mở preview_url để nghe miễn phí trên Suno. Để xuất, gửi yêu cầu POST đã xác thực đến export_url. Đặt confirm: true để chấp nhận phí 2,99 USD cho lần xuất thành công đầu tiên của bản nhạc. format nhận mp3 (mặc định) hoặc wav. Các lần xuất tiếp theo của cùng bản nhạc đều miễn phí ở cả hai định dạng. Khi hoàn tất, đọc tracks[0].download_url. Nếu xuất thất bại, khoản tiền giữ trước sẽ được hoàn lại.
Với thao tác tiếp theo tương thích như dò BPM, có thể dùng ID tác vụ xuất WAV đã hoàn tất và chỉ số bản nhạc 0.
curl -X POST "$APIMASTER_API_BASE/v1/music/tasks/$TASK_ID/tracks/0/export" \
-H "Authorization: Bearer $APIMASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm":true,"format":"wav"}'
curl "$APIMASTER_API_BASE/v1/music/tasks/$EXPORT_TASK_ID" \
-H "Authorization: Bearer $APIMASTER_KEY"
curl "$APIMASTER_API_BASE$TRACK_DOWNLOAD_URL" \
-H "Authorization: Bearer $APIMASTER_KEY" -o track.wav
Các thao tác APIMaster khác
generate· Tạo nhạcmashup· Kết hợp hai bản nhạc của tài khoảnstems· Tách stemmidi· Chuyển bài hát sang MIDIsounds· Tạo hiệu ứng âm thanhspeech· Tạo giọng nóivideo· Tạo video ngắn
Toàn bộ tham số mô hình và ví dụ API bổ sung bằng tiếng Anh
