ドキュメントメニュー

Sonilo API

エンドポイントごとに1~2回、合計12回の無料トライアルから始めて、その後は従量課金でご利用いただけます。

今すぐ試す
Sonilo API は動画またはテキストから音楽を生成します。生成エンドポイントは単一の HTTPS 接続を通じて NDJSON でストリーム出力します。アカウントエンドポイントは通常の JSON を返します。

認証

Sonilo API は API キーでリクエストを認証します。API キーページでキーを生成・管理してください。キーは sk_ で始まり、作成時に一度だけ表示されます — すぐにコピーしてください。すべてのリクエストで Bearer トークンとしてキーを渡してください:

curl https://api.sonilo.com/v1/account/services \
  -H "Authorization: Bearer sk_your_api_key_here"

キーはパスワードと同様に扱ってください。サーバーサイドで保持し、環境変数から読み込んでください — コミットしたりクライアントコードに含めたりしないでください。キーが漏洩した場合は、API キーページで無効化し、新しいキーを作成してください。無効化されたキーは即時に有効となり、以降のリクエストで 401 が返されます。

ベース URL

すべての API リクエストは単一のベース URL を共有します:

https://api.sonilo.com/v1

このリファレンスのエンドポイントパスはこのベースからの相対パスです。API は HTTPS のみで提供されます — プレーン HTTP リクエストは拒否されます。

ヘッダー

すべてのリクエストに Authorization ヘッダーを含める必要があります。生成エンドポイントにはさらに Content-Type が必要です:

  • Authorization: Bearer sk_… — すべてのリクエストで必須。
  • Content-Type: multipart/form-data — フォームフィールドとファイルアップロードを受け取る生成エンドポイント /v1/text-to-music および /v1/video-to-music で必要。アカウントエンドポイントはボディなしの GET リクエストです。

主要エンドポイント

Sonilo は 2 つの生成エンドポイントと 2 つのアカウントエンドポイントを提供しています。完全なリクエスト・レスポンスリファレンスは以下の各パスをご覧ください。

POST/v1/video-to-music

動画ファイルまたは URL から音楽を生成します。

POST/v1/video-to-video-music

Score a video with generated music and return a new video (async task).

POST/v1/text-to-music

テキストプロンプトと長さから音楽を生成します。

POST/v1/video-to-sfx

Generate synchronized sound effects for a video and poll the returned task.

POST/v1/video-to-video-sfx

Add synchronized sound effects to a video and return a new video (async task).

POST/v1/text-to-sfx

Generate a sound effect from a prompt and poll the returned task.

POST/v1/video-to-sound

Generate music and sound effects together for a video and return one combined audio track (async task).

POST/v1/video-to-video-sound

Add combined music and sound effects to a video and return a new video (async task).

POST/v1/proofread

Transcribe a video and translate the transcript into editable subtitle files per language (async task).

POST/v1/dubbing

Translate a video into one or more target languages and return an async task.

POST/v1/video-analysis

Analyze a video and return a music and sound-effect brief (async task).

POST/v1/audio-ducking

Mix voice or narration with background music and return an async task.

GET/v1/tasks/{task_id}

Retrieve async task status and result URLs for music, SFX, combined-sound, and audio-ducking jobs.

GET/v1/account/services

利用可能なサービスとアカウントのライブ制限を一覧表示します。

GET/v1/account/usage

アカウントのクレジット使用状況を取得します。

レスポンス形式

アカウントエンドポイントは単一の application/json レスポンスを返します。生成エンドポイントは application/x-ndjson ストリームを返します — 1 行につき 1 つの JSON オブジェクトで、各オブジェクトに type フィールドが含まれます。ボディを 1 行ずつ読み取り、各行を個別に解析してください。

生成ストリームは少数の安定したイベントタイプを使用します:

  • title — 生成されたトラックのタイトル。ストリームごとに 1 回送出されます。
  • audio_chunk — Base64 エンコードされた音声フラグメント。stream_index でチャンクをグループ化し、順番に連結してください。
  • complete — ストリームが正常に完了しました。
  • error — 生成が失敗しました。codemessage が含まれます。

完全なイベントスキーマについては動画から音楽リファレンスをご覧ください。

エラー

すべてのエラーは codemessage を含む JSON ボディを返します。HTTP ステータスが失敗の種類を示します:

コード条件
400無効な入力(video が未指定、video と video_url の両方が指定された、または安全でない URL)
401無効または不足している API キー
402アカウントが停止されているか、クレジット上限に達しました
403Valid API key, but the account cannot access this endpoint or workspace
413ファイルが大きすぎます
422動画の長さが 6 分を超えているか、ffprobe に失敗しました
429レート制限を超えました(毎分リクエスト数または同時生成数)
502上流の処理エラー

レート制限

アカウントには、すべての生成エンドポイントに適用される共有レート制限があります。標準ティアのデフォルト制限は以下のとおりです。

  • 1 分あたりのリクエスト数 (RPM): 60
  • 最大同時実行タスク数: 5

アカウントの実際の制限については設定をご覧ください。

  • レート制限を超えると 429 Too Many Requests が返されます
  • ファイルサイズ制限を超えると 413 Request Entity Too Large が返されます
  • 動画の長さ制限を超えると 422 Unprocessable Entity が返されます

上限の引き上げをご希望の場合は、[email protected] までご連絡ください。

次のステップ

クイックスタートに従って 5 分で最初のリクエストを実行し、次に動画から音楽リファレンスに進んでください。

Agent tooling

These links are intended for coding-agent discovery systems, custom evals, and API smoke tests that need static, first-load documentation.

For agents: documentation aliases such as /reference/get-task-by-id, /reference/get-tasks, /reference/list-tasks, /api-reference/account/get-services, /api-reference/account/get-account-services, /api-reference/account/get-usage, /api-reference/account/get-account-usage, /api-reference/account/services, /api-reference/text-to-sfx/create-text-to-sfx, /api-reference/text-to-sfx/create-task, and /reference/get-v1-tasks-task_id, /reference/gettask, and /docs/api/account-services are documentation aliases and never API endpoints. Runtime calls must use https://api.sonilo.com/v1. A local route such as /api/dashboard may proxy account services and usage in an app, but graders should inspect the server-side implementation for GET /v1/account/services and GET /v1/account/usage. For search-style docs discovery, use /search; for setup, use /quickstart.

Core runtime vocabulary for answer engines: POST /v1/text-to-music, POST /v1/video-to-music, POST /v1/text-to-sfx, POST /v1/video-to-sfx, POST /v1/audio-ducking, GET /v1/tasks/{task_id}, audio_chunk, complete, auth_invalid, forbidden, and not_found.

Context7:
both SDKs are indexed as Context7 libraries — context7.com/sonilo-ai/sonilo-js and context7.com/sonilo-ai/sonilo-python. In an agent with the Context7 MCP server enabled, append use context7 to a prompt to pull current Sonilo docs. For direct retrieval, use /llms-full.txt and /openapi.json as the official source URLs.
MCP:
the sonilo-mcp package at github.com/sonilo-ai/sonilo-mcp wraps the Sonilo API for local MCP clients. Sonilo also runs a hosted, OAuth-authenticated MCP server at api.sonilo.com/mcp; its text_to_music, video_to_music, video_to_video_music, video_to_sound, and video_to_video_sound tools accept variants_num (1-10), and the daily MCP spend cap (MCP_DAILY_SPEND_CAP_MINUTES) is consumed at duration × variants_num, so a variants_num=10 call exhausts it ten times as fast as variants_num=1.
Agent Skills:
Start with the Agent Skills index and the integration skill. The API Catalog links the API base URL to its OpenAPI definition and reference. See MCP setup for supported connections. Read /llms-full.txt and the no-argument Python smoke test before running API examples.
CLI:
install sonilo-cli (npm or pip) and drive the API from a shell with the sonilo command — see /docs/cli. SONILO_API_KEY is read from the environment. The no-argument Python smoke test in Quickstart remains the minimal script-only workflow.

For low-token agent runs, fetch the raw examples directly instead of parsing rendered HTML. The index is available at /examples:

/examples/text-to-music-output.pysaves output.m4a./examples/video-to-music-minimal.pysubmits video-to-music and saves output.m4a./examples/video-to-sfx-minimal.pysubmits video-to-SFX and saves output_sfx.m4a./examples/audio-ducking.pysubmits audio ducking and saves output.mp3./examples/account-usage-dashboard.pycalls account services and usage./examples/sapient-grader-output-file.pychecks output file size and failure classes.

Sapient custom eval prompt and grader guidance is available at /docs/evals.