Get a key
export DUETA_API_KEY="dueta_sk_..."
curl https://dueta.ai/ v1/ credits \
-H "Authorization: Bearer $DUETA_API_KEY"
# -> {"balance_usd": 20.0, "ledger": [...]}Upload a song
POST
/v1 /uploadsPUT
/v1 /uploads /{id} /contentSIZE=$(wc -c < song.wav)
curl -X POST https://dueta.ai/ v1/ uploads \
-H "Authorization: Bearer $DUETA_API_KEY" \
-H "Content-Type: application/ json" \
-d "{\"filename\": \"song.wav\", \"size_bytes\": $SIZE}"
# -> 201 {"id": "upl_9f2c7a41d0e8", "state": "pending",
# "content_url": "/ v1/ uploads/ upl_9f2c7a41d0e8/ content", ...}# Raw body, not multipart. The response is the upload, now "ready".
curl -X PUT https://dueta.ai/ v1/ uploads/$UPLOAD_ID/content \
-H "Authorization: Bearer $DUETA_API_KEY" \
-H "Content-Type: application/ octet-stream" \
--data-binary @song.wav
# -> {"state": "ready", "duration_seconds": 612.4, "sample_rate": 48000, ...}Run the job
POST
/v1 /jobs /music-separationcurl -X POST https://dueta.ai/ v1/ jobs/ music-separation \
-H "Authorization: Bearer $DUETA_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"inputs": ["upl_9f2c7a41d0e8"]}'
# -> 201, the job. result.stems lists the 14 stems once it succeeds.
# From a YouTube link instead of an upload:
# -d '{"source_url": "https://www.youtube.com/ watch?v=dQw4w9WgXcQ"}'Download the stems
GET
/v1 /jobs /{id}GET
/v1 /jobs /{id} /stems /{name}while :; do
JSON=$(curl -sS --fail-with-body -H "Authorization: Bearer $DUETA_API_KEY" \
https://dueta.ai/ v1/ jobs/$JOB_ID) || { echo "$JSON"; exit 1; } # 4xx/ 5xx: the error body
echo "$JSON" |
jq -r '[.status, .stage, (.progress * 100 | floor | tostring) + "%"] | join(" ")'
case $(echo "$JSON" | jq -r .status) in
succeeded) break ;;
queued|running) ;;
failed|canceled) echo "$JSON" | jq -r .error; exit 1 ;;
*) echo "$JSON"; exit 1 ;; # not a job at all: an error body
esac
sleep 2
done# WAV, byte for byte as rendered:
curl -fL -H "Authorization: Bearer $DUETA_API_KEY" -o stem.wav \
"https://dueta.ai/ v1/ jobs/ $JOB_ID/ stems/ $STEM_NAME"
# FLAC, the same samples losslessly at about half the size:
curl -fL -H "Authorization: Bearer $DUETA_API_KEY" -o stem.flac \
"https://dueta.ai/ v1/ jobs/ $JOB_ID/ stems/ $STEM_NAME?format=flac"Cases
- 402
- Not enough credit. Buy credit, resubmit the same upload.
- 409
- Upload not ready, or email unverified.
- 429
- 1 job (4 paid), or 20 a minute. Wait Retry-After.
- 415
- Video. Upload the audio track instead.