how-tos

Seed Audio 1.5 API 가이드: cURL 및 Python 첫 요청 실행하기

Poyo.ai Team
6 min read
Share:

Seed Audio 1.5 API 개발자 가이드

이 Seed Audio 1.5 API 가이드는 Seed Audio 1.5의 4가지 모델 ID(seed-audio-1.5, seed-audio-1.5-video-translation, seed-audio-1.5-video-dubbing, seed-audio-1.5-stem-separation) 전반에 걸쳐 첫 요청을 전송하고, 완료 상태를 폴링하거나 웹훅을 수신하며, 다중 출력 파일을 다운로드하는 과정을 단계별로 안내합니다. 아래의 모든 JSON 본문은 Seed Audio 1.5 API 레퍼런스에 정의된 라이브 PoYo OpenAPI 스키마와 일치합니다.

사전 준비 및 인증

  1. PoYo 대시보드에서 API 키를 발급받아 POYO_API_KEY 환경 변수로 내보냅니다.
  2. 모든 요청은 서버 측에서 https://api.poyo.ai로 전송하며, Authorization: Bearer $POYO_API_KEY 및 Content-Type: application/json 헤더를 포함해야 합니다.
  3. 전달하는 모든 video_url, audio_url, reference_audio_urls, image_urls, subtitle_url은 별도의 커스텀 헤더 없이 HTTP 또는 HTTPS로 공개 접근 가능해야 합니다.
export POYO_API_KEY="YOUR_POYO_API_KEY_HERE"

1. cURL 첫 요청: 씬 오디오 생성(seed-audio-1.5)

seed-audio-1.5는 단일 프롬프트로부터 대화, 환경음, 효과음 및 배경 음악을 생성하며 **청구 초당 0.5크레딧($0.0025)**이 과금됩니다. 모든 대사를 따옴표로 묶고 화자, 감정, 주변 환경, 목표 길이를 prompt에 직접 묘사하세요.

curl -X POST "https://api.poyo.ai/api/generate/submit" \
  -H "Authorization: Bearer $POYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seed-audio-1.5",
    "input": {
      "prompt": "A warm, rainy evening inside a cozy Tokyo jazz cafe. Soft rain taps on the glass window, an espresso cup clinks gently on a saucer, and mellow lo-fi piano plays softly in the background. A calm young woman speaks warmly in English: \"Rainy nights are the best time to ship. One prompt, dialogue, rain, and jazz, all mixed in ten seconds.\" Keep the clip around 10 seconds.",
      "output_format": "mp3",
      "sample_rate": 44100
    }
  }'

요청을 제출하면 즉시 task_id가 반환됩니다:

{
  "code": 200,
  "data": {
    "task_id": "0UE7HJQUU96FJZTI",
    "status": "not_started"
  }
}

data.status가 "finished" 또는 "failed"가 될 때까지 상태 엔드포인트를 폴링합니다:

curl -X GET "https://api.poyo.ai/api/generate/status/0UE7HJQUU96FJZTI" \
  -H "Authorization: Bearer $POYO_API_KEY"

2026년 12월 1일 프로덕션 실행 테스트에서 이 10초 프롬프트는 30.0초 만에 완료되었고 **5.1크레딧($0.0255)**이 청구되었습니다.

2. 나머지 3개 모델 ID를 위한 실행 가능한 JSON 본문

4가지 모델 모두 동일한 비동기 엔드포인트를 공유하므로 워크플로를 전환할 때는 model과 input만 변경하면 됩니다.

30개 언어 영상 번역(seed-audio-1.5-video-translation)

**영상 1초당 3크레딧($0.015)**이 과금됩니다. 영어 또는 중국어 MP4/MOV(4–360s)를 입력받아 더빙된 영상, 더빙 오디오, 대상 언어 SRT, 원본 언어 SRT를 반환합니다.

{
  "model": "seed-audio-1.5-video-translation",
  "input": {
    "video_url": "https://storage.poyo.ai/models/seed-audio-1-5/examples/input-memory-scene-3450acdd2b13.mp4",
    "target_language": "ja",
    "dialogue_enhancement": "medium",
    "output_format": "mp3"
  }
}

브랜드명 등의 번역어를 고정해야 하는 경우 glossaries(최대 1,000개의 {"source": "...", "target": "..."} 객체)를 전달하세요. 이미 번역된 SRT 파일이 있다면 glossaries 대신 subtitle_url을 전달하면 됩니다.

대본 기반 영상 재더빙(seed-audio-1.5-video-dubbing)

**영상 1초당 2크레딧($0.01)**이 과금됩니다. prompt에 작성한 전체 대본을 video_url 속 화자의 타이밍에 맞춰 연기하며, 선택적으로 최대 6개의 reference_audio_urls로 목소리를 가이드할 수 있습니다.

{
  "model": "seed-audio-1.5-video-dubbing",
  "input": {
    "video_url": "https://storage.poyo.ai/models/seed-audio-1-5/examples/input-shell-presenter-1619916465d3.mp4",
    "prompt": "Clear, confident male narrator speaking in English at a steady pace: \"Welcome back. Today we are testing a single API call that replaces every spoken line in sync with the video.\"",
    "output_format": "mp3",
    "sample_rate": 44100
  }
}

스템 분리(seed-audio-1.5-stem-separation)

**반환된 모든 트랙을 합산한 오디오 1분당 10크레딧($0.05)**이 과금됩니다. prompt를 비워 두면 2–360s 길이의 WAV/MP3를 기본 3개 트랙인 speaker(보컬), sfx(효과음), bgm(배경 음악)으로 분리합니다.

{
  "model": "seed-audio-1.5-stem-separation",
  "input": {
    "audio_url": "https://storage.poyo.ai/models/seed-audio-1-5/examples/input-rain-bookshop-mix-4f3560ae6cfd.mp3",
    "output_format": "mp3",
    "sample_rate": 44100
  }
}

3. 제한된 폴링과 다중 파일 다운로드를 지원하는 전체 Python 클라이언트

단일 파일 오디오 엔드포인트와 달리 seed-audio-1.5-video-translation은 최대 4개의 파일(MP4, MP3 및 SRT 2개)을 반환하며, seed-audio-1.5-stem-separation은 track_type 태그가 붙은 여러 스템 오디오를 반환합니다. 아래 Python 스크립트는 표준 라이브러리만 사용하여 4가지 모델을 모두 처리하며, 제한된 폴링 및 안전한 다운로드(파일 CDN으로 API 키를 전달하지 않음)를 구현합니다.

import json
import os
import time
import urllib.parse
import urllib.request
from pathlib import Path

API_KEY = os.environ["POYO_API_KEY"]
BASE_URL = "https://api.poyo.ai"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}

def api_call(path: str, payload: dict | None = None) -> dict:
    data = json.dumps(payload).encode("utf-8") if payload is not None else None
    req = urllib.request.Request(
        f"{BASE_URL}{path}",
        data=data,
        headers=HEADERS,
        method="POST" if data else "GET",
    )
    with urllib.request.urlopen(req, timeout=60) as resp:
        body = json.loads(resp.read().decode("utf-8"))
    if body.get("code") not in (0, 200):
        raise RuntimeError(f"PoYo API error: {body}")
    return body

def run_seed_audio(payload: dict, out_dir: str = "output") -> dict:
    submitted = api_call("/api/generate/submit", payload)
    task_id = submitted["data"]["task_id"]
    print(f"Submitted {payload['model']} -> {task_id}")

    for attempt in range(1, 121):  # max 10 minutes at 5s intervals
        status_resp = api_call(f"/api/generate/status/{task_id}")
        data = status_resp["data"]
        state = data.get("status")
        print(f"[{attempt}] {state} (progress={data.get('progress')})")
        if state == "failed":
            raise RuntimeError(f"Task failed: {data.get('error_message')}")
        if state == "finished":
            Path(out_dir).mkdir(parents=True, exist_ok=True)
            for idx, item in enumerate(data.get("files") or [], 1):
                url = item["file_url"]
                ext = Path(urllib.parse.urlparse(url).path).suffix or ".mp3"
                label = item.get("track_type") or item.get("name") or item.get("file_type") or str(idx)
                dest = Path(out_dir) / f"{task_id}-{idx}-{label}{ext}"
                # Public CDN URL: do NOT send Authorization header
                with urllib.request.urlopen(url, timeout=120) as r:
                    dest.write_bytes(r.read())
                print(f"Saved {dest} ({dest.stat().st_size:,} bytes)")
            print(f"Credits billed: {data.get('credits_amount')}")
            return data
        time.sleep(5)
    raise TimeoutError(f"Task {task_id} did not finish within timeout")

if __name__ == "__main__":
    run_seed_audio({
        "model": "seed-audio-1.5-video-translation",
        "input": {
            "video_url": "https://storage.poyo.ai/models/seed-audio-1-5/examples/input-memory-scene-3450acdd2b13.mp4",
            "target_language": "ja",
            "dialogue_enhancement": "medium",
            "output_format": "mp3",
        },
    })

프로덕션 워크로드에서는 제출 페이로드 최상위에 "callback_url": "https://your-app.example.com/webhooks/poyo" 필드를 추가하면 폴링 대신 PoYo가 최종 상태 페이로드를 서버로 직접 푸시해 줍니다.

유효성 검사 규칙 및 주요 오류 처리

  • 지원되지 않는 길이: 4초 미만 또는 360초 초과 영상은 유효성 검사에서 실패하며, 스템 분리 입력은 2–360초여야 합니다. 제출 전 ffprobe로 미디어를 사전 점검하세요.
  • 상호 배타적 필드: seed-audio-1.5-video-translation에 glossaries와 subtitle_url을 동시에 전달하면 요청이 거부됩니다.
  • 접근 불가능한 미디어 URL: 5분 이내에 만료되는 서명된 URL이나 비브라우저 User-Agent를 차단하는 URL은 작업 실패를 유발합니다. 미디어 URL이 최소 15분 이상 유효하도록 유지하세요.
  • 잔액 부족(402): 재시도 전에 HTTP 402 또는 200이 아닌 code 값을 감지하여 알림을 발생시키세요.

첫 청구 금액 계산 방식

PoYo는 완료된 작업에 대해 크레딧(1 크레딧 = $0.005)으로 과금하고 data.credits_amount에 정확한 청구 금액을 반환합니다:

  • 10초 분량의 seed-audio-1.5 클립은 약 5크레딧($0.025)이 청구됩니다.
  • 12초 분량의 seed-audio-1.5-video-translation 작업은 36크레딧($0.18)이 청구됩니다.
  • 3개 트랙(총 약 32.4초 오디오)을 반환하는 10.8초 seed-audio-1.5-stem-separation 작업은 5.4크레딧($0.027)이 청구됩니다.

전체 단위 경제성 및 배치 비용 계산은 Seed Audio 1.5 API 요금과 Seed Audio 1.5 API 개요를 참고하세요.

자주 묻는 질문

Seed Audio 1.5 API는 어떤 엔드포인트를 사용하나요?

4가지 Seed Audio 1.5 모델 모두 작업 생성에 POST https://api.poyo.ai/api/generate/submit, 결과 조회에 GET https://api.poyo.ai/api/generate/status/{task_id}를 사용합니다.

폴링 대신 웹훅을 사용할 수 있나요?

네. 제출 JSON 본문 최상위에 callback_url을 포함하면 완료 및 실패 알림을 직접 수신할 수 있습니다.

seed-audio-1.5-stem-separation에서 어떤 스템이 무엇인지 어떻게 구분하나요?

data.files의 각 객체에는 file_url과 함께 track_type(speaker, sfx 또는 bgm) 및 description 문자열이 포함됩니다.

어떤 오디오 포맷과 샘플 레이트를 지원하나요?

4가지 엔드포인트 모두 mp3(기본값), wav, pcm, ogg_opus를 지원하며 샘플 레이트는 8000, 16000, 24000, 32000, 44100(기본값), 48000 Hz를 지원합니다(ogg_opus는 항상 48000 Hz 사용).

Share: