メインコンテンツへスキップ

はじめに

Producer は Ace Data Cloud が提供するAI音声サービスで、FUZZ Producer AI 音楽生成をサポートします。Ace Data Cloud の統一APIを通じて、Python を使って Producer を素早く統合し、テキストからの音楽生成、カスタム歌詞、曲の続き作成、カバー、ボーカル分離、MV生成などの機能を実現できます。

前提条件

  • Ace Data Cloud アカウントを持ち、APIトークンを取得していること
  • Python 3.7 以上の環境
  • requests ライブラリのインストール:pip install requests

基本的な使い方

Producer API のメインエンドポイントは以下です:
POST https://api.acedata.cloud/producer/audios
本例では FUZZ-2.0 Pro モデルを使用しています。利用可能なモデルは以下の通りです:FUZZ-2.0 ProFUZZ-2.0FUZZ-1.1 ProFUZZ-1.0 Pro 完全な Python コード例:
import requests

url = "https://api.acedata.cloud/producer/audios"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "action": "generate",
    "prompt": "A relaxing jazz piece for a coffee shop",
    "model": "FUZZ-2.0 Pro",
    "lyric": "[Verse]\nSoft piano keys in the morning light",
    "custom": true
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
YOUR_API_TOKEN は Ace Data Cloud プラットフォームで取得した実際のトークンに置き換えてください。

レスポンス処理

呼び出し成功時、API は JSON 形式のデータを返します。HTTPステータスコードの確認を推奨します:
if response.status_code == 200:
    result = response.json()
    print("呼び出し成功:", result)
else:
    print(f"呼び出し失敗、ステータスコード: {response.status_code}")
    print(response.text)

応用的な使い方

非同期タスクをサポートするAPIでは、コールバックURLを指定して結果を取得可能です:
data['callback_url'] = 'https://your-server.com/callback'
response = requests.post(url, headers=headers, json=data)
# 結果はコールバックURLを通じてあなたのサーバーにプッシュされます

エラー処理

よくあるエラーコード:
ステータスコード説明
401認証失敗、APIトークンを確認してください
403残高不足またはアクセス権限なし
429リクエスト頻度制限超過
500サーバー内部エラー

その他のエンドポイント

Producer サービスは以下のエンドポイントも提供しています:
  • POST https://api.acedata.cloud/producer/videos
  • POST https://api.acedata.cloud/producer/wav
  • POST https://api.acedata.cloud/producer/tasks
  • POST https://api.acedata.cloud/producer/lyrics

次のステップ