DramaMasterAPIドキュメント

ショートドラマ制作API

ショートドラマの制作工程をひとつの API で。画像や動画の生成も必要に応じて呼び出せます。

Base URL
https://dramamaster.ai/api/developer/v1

GET /models が返す製品 ID を使用してください。model フィールドには ponys-generation-image などの安定した製品 ID を指定します。

OpenAPI 仕様

認証

ベース URL: https://dramamaster.ai/api/developer/v1. すべてのオープン API エンドTokensは API キーを使用します: 認証: ベアラー dm_live_xxx または dm_test_xxx。

応答と請求

API とウェブサイトで Ponys Tokens を共有します。テストキーでの生成も有料です。

  • 構成、脚本、絵コンテ、エピソードの書き出しは各 4 Tokens です。
  • 画像と動画の料金はモデルと設定で変わります。送信前にモデル一覧を確認してください。 モデルのリスト
  • 音声、写真の顔交換、動画の人物置換は、事前の見積もり承認が必要です。 Preview and lock Tokens

短編ドラマ

脚本 → 絵コンテ → 素材画像 → 動画 → エピソード出力。DramaMaster が直接生成し、画像・動画は Ponys と同じ仕様の価格です。

01

アカウントを接続

開発者センターでキーを作成し、サーバーで保管してください。Authorization ヘッダーで送信します。

02

脚本を送信

貼り付けた脚本の 00:00–00:10 は、容量の上限が10秒であることを示します。内容が短ければ実際の長さを保存します。目標の尺は制作設定で別に指定します。

03

生成結果を確認

進捗確認は 10 秒以上間隔を空けてください。前の段階が完了してから次へ進みます。

Pythonクライアントをダウンロード
POST /dramas
curl https://dramamaster.ai/api/developer/v1/dramas \
  -H "Authorization: Bearer $DRAMAMASTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept-Language: en-US" \
  -H "Idempotency-Key: episode-001" \
  -d '{"script":"00:00–00:10\nA woman opens a letter.\nShe looks toward the door."}'

制作フローのエンドTokens

POST/dramas
脚本から絵コンテを作り、素材とショットを生成してエピソードを書き出します。
POST/dramas/ideas
アイデアから短編を作る
PATCH/dramas/{drama_id}/review
最初のショットを承認
GET/dramas/{drama_id}
ドラマを確認
POST/dramas/{drama_id}/assets
素材を生成
POST/dramas/{drama_id}/images
画像を生成
POST/dramas/{drama_id}/videos
動画を生成
POST/dramas/{drama_id}/export
エピソードを書き出す
POST/dramas/{drama_id}/run
バックグラウンド制作
GET/dramas/{drama_id}/run
バックグラウンド制作の状態
POST/generation/images
テキストや参照画像から画像を生成します。
POST/generation/videos
テキスト、開始フレーム、参照素材から動画を生成します。
GET/tasks/{task_id}
タスクを確認
アイデアから短編を作る

1 話分のアイデアを入力します。DM が絵コンテを作り始め、素材画像や確認が必要になると停止します。

HTTP / JSON
POST /api/developer/v1/dramas/ideas
Idempotency-Key: idea-001

{"idea":"Two strangers find the same letter.",
 "duration_seconds":15,"aspect_ratio":"9:16","style":"realistic"}

→ data.drama_id, data.task_id, data.run_id
GET /api/developer/v1/dramas/{drama_id}/run

長さは 10、15、20、30 秒、画面は縦、横、正方形から選べます。スタイルは実写風またはアニメです。reference_image_urls には /files でこのワークスペースにアップロードした画像を 5 枚まで指定できます。

画像・動画のサンプル
HTTP / JSON
POST /api/developer/v1/generation/images
{"prompt":"A sealed letter on a table","aspect_ratio":"9:16","image_resolution":"1K"}

POST /api/developer/v1/generation/videos
{"motion_instruction":"The letter slowly opens","aspect_ratio":"9:16","duration_seconds":5,"resolution":"1080P"}

POST /api/developer/v1/generation/videos
{
  "model": "Video-Generation-2.0",
  "motion_instruction": "The letter opens",
  "duration_seconds": 5,
  "resolution": "720P"
}

POST /api/developer/v1/generation/videos
{
  "model": "2.0-flash",
  "motion_instruction": "The letter opens",
  "duration_seconds": 5,
  "resolution": "720P"
}

POST /api/developer/v1/dramas/{drama_id}/assets
{}

HTTP 200 · /generation/images · /generation/videos
{"code":200,"message":"ok","data":{"task_id":"..."}}

HTTP 200 · /dramas/{drama_id}/assets
{"code":200,"message":"ok","data":{"drama_id":1,"tasks":[{"task_id":"...","points_cost":3}]}}

クイックスタートは /generation/images と /generation/videos を使用します。下の互換ルートには個別のパラメーターがあります。

画像: 1Kまたは2K、参照画像は最大10枚、1タスクにつき1枚出力。

動画: 整数秒、テキスト2–15秒、画像・参照2–30秒。480P・720P・1080P(テキストは720P・1080P)。参照動画合計15秒以内、入力と出力合計30秒以内。

model に Video-Generation-2.0 または 2.0-flash を指定できます。省略すると既定の動画モデルを使います。利用可能なモデルは GET /models で確認できます。

バックグラウンド制作

支出上限を設定せずに開始・再開できます。ページを閉じても受理済みの処理は続きます。停止すると次の段階を送信せず、失敗や結果不明時は元のタスクを保持します。

HTTP / JSON
POST /api/developer/v1/dramas/{drama_id}/run
{"action":"start"}

GET /api/developer/v1/dramas/{drama_id}/run

POST /api/developer/v1/dramas/{drama_id}/run
{"action":"stop"}

POST /api/developer/v1/dramas/{drama_id}/run
{"action":"resume","expected_run_id":"RUN_ID"}

GET /api/developer/v1/dramas/{drama_id}
→ data.production.review, data.result_url

PATCH /api/developer/v1/dramas/{drama_id}/review
{"expected_revision":12,"shot_id":42,"signature":"MEDIA_SIGNATURE","status":"approved"}
本番利用の前に
  • partial: true が返ったら、処理を止めてタスク ID を確認し、未処理の分だけ送信してください。
  • 応答が失われた場合は同じ Idempotency-Key と本文で再送します。本文を変更すると409になります。
  • 各段階は空いている同時実行枠だけを使用します。タスク完了後に新しいキーで次のバッチを送り、next_stage の進行を確認してください。partial は受理済みタスクを示します。
  • 400: モデル・参照・料金の検証、401: キー無効、402: Tokens不足、409: 前提条件または競合、422: パラメータ無効、429: 制限、503: サービスまたは脚本料金未設定。
  • 非公開リンクには期限があります。新しいリンクはタスクを再取得してください。
  • Pythonクライアントは同じ段階を自動実行します。固定 run ID で再開でき、結果不明の生成を自動再送しません。
  • DramaMaster と Ponys は同じ Tokens ウォレットを使用します。画像・動画は選択した設定で Ponys から見積もります。 Test keys use the same billing rules.
API リファレンスを見る

世代

以下のエンドTokensには GET /models の製品 ID を指定します。上の制作フローは /dramas と /generation を使用します。既存の /images と /videos も引き続き利用できます。

画像を生成

POST/api/developer/v1/images/generations

スタンドアロン画像生成タスク (テキストから画像への合成または参照画像の合成) を送信します。 task_id を返します。結果については、GET /api/developer/v1/tasks/task_id をポーリングします。

パラメータ

modelbody必須
string

GET /models の製品 ID。例: ponys-image。

promptbody必須
string

生成する画像のテキスト説明

aspect_ratiobody任意
string

アスペクト比: 16:9、9:16、4:3、または 3:4

image_resolutionbody任意
string

出力解像度: 1K または 2K

reference_urlsbody任意
string[]

参照画像の URL。最大 10 枚。選択したモデルの上限が適用されます。

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/images/generations" \
  -H "Authorization: Bearer dm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "ponys-generation-image",
  "prompt": "一只可爱的猫咪在草地上奔跑",
  "aspect_ratio": "16:9",
  "image_resolution": "2K",
  "reference_urls": [
    "https://example.com/ref1.jpg"
  ]
}'
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "task_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}
リクエスト本文の例
JSON
{
  "model": "ponys-generation-image",
  "prompt": "一只可爱的猫咪在草地上奔跑",
  "aspect_ratio": "16:9",
  "image_resolution": "2K",
  "reference_urls": [
    "https://example.com/ref1.jpg"
  ]
}

ビデオを生成

POST/api/developer/v1/videos/generations

動画生成タスクを送信します。入力、長さ、オプションは製品の対応能力によります。GET /tasks/task_id で結果を確認します。

パラメータ

modelbody必須
string

GET /models の製品 ID。例: ponys-turbo。

motion_instructionbody任意
string | null

[共通 / 条件付き必須] プロンプト / 動作指示。テキストからビデオへの変換、すべてのモーダル参照、編集、および拡張に必要です。画像 1 / ビデオ 1 / オーディオ 1 について言及できます

aspect_ratiobody任意
16:9 | 9:16 | 4:3 | 3:4 | null

【共通】アスペクト比:16:9、9:16、4:3、3:4

duration_secondsbody任意
integer | null

[共通] 秒単位で出力します。 GET /models からのduration_range / max_duration_secondsを参照してください

capabilitybody任意
first_frame | flf2v | image_reference | null

[共通] first_frame、flf2v、または image_reference;フィールドから推論するには省略または null (motion_instruction のみ = text-to-video)

image_urlbody任意
string | null

[共通 / モード固有] first_frame / flf2v の最初のフレーム画像の URL。 Reference_* フィールドを含めて送信しないでください

last_frame_urlbody任意
string | null

終了フレームの画像 URL。flf2v では image_url と併用し、製品の対応能力を確認してください。

reference_urlsbody任意
string[]

[共通 / 参照モード] image_reference の参照画像 URL

reference_video_urlsbody任意
string[]

参照動画 URL。GET /models の max_reference_videos と capabilities を確認してください。

reference_audio_urlsbody任意
string[]

参照音声 URL。GET /models の max_reference_audios と capabilities を確認してください。

resolutionbody任意
480P | 720P | 1080P | null

出力解像度。製品が対応する値を確認してください。

audiobody任意
boolean | null

音声を生成するかどうか。製品の対応が必要です。

seedbody任意
integer | null

結果再現用の乱数シード。製品の対応が必要です。

watermarkbody任意
boolean | null

透かしを追加するかどうか。対応製品で利用でき、初期値は false です。

prompt_extendbody任意
boolean | null

プロンプトを拡張するかどうか。製品の対応が必要です。

smart_durationbody任意
boolean

長さを自動で決定するかどうか。対応製品で利用でき、初期値は false です。

enable_thinkingbody任意
boolean | null

推論を有効にするかどうか。対応製品で利用でき、文書・ウェブ参照には必須です。

document_urlbody任意
string | null

参照文書 URL。製品の対応が必要です。

web_urlbody任意
string | null

参照する公開ウェブページの URL。製品の対応が必要です。

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/videos/generations" \
  -H "Authorization: Bearer dm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "ponys-turbo",
  "motion_instruction": "Video 1 sits on the chair in Image 2 and sings. Image 1 walks over, places Image 3 on the table, and says: the sunshine is so nice today.",
  "aspect_ratio": "9:16",
  "duration_seconds": 8,
  "capability": "image_reference",
  "reference_urls": [
    "https://example.com/character.jpg",
    "https://example.com/chair.jpg",
    "https://example.com/prop.jpg"
  ],
  "reference_video_urls": [
    "https://example.com/performance.mp4"
  ],
  "resolution": "720P",
  "audio": true,
  "prompt_extend": true,
  "smart_duration": false
}'
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "task_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}
リクエスト本文の例
JSON
{
  "model": "ponys-turbo",
  "motion_instruction": "Video 1 sits on the chair in Image 2 and sings. Image 1 walks over, places Image 3 on the table, and says: the sunshine is so nice today.",
  "aspect_ratio": "9:16",
  "duration_seconds": 8,
  "capability": "image_reference",
  "reference_urls": [
    "https://example.com/character.jpg",
    "https://example.com/chair.jpg",
    "https://example.com/prop.jpg"
  ],
  "reference_video_urls": [
    "https://example.com/performance.mp4"
  ],
  "resolution": "720P",
  "audio": true,
  "prompt_extend": true,
  "smart_duration": false
}

ビデオ内の文字を置換

POST/api/developer/v1/videos/replace-character

For photos use ponys-face, two reference images and empty video_urls. For video use ponys-animate, one reference and one source video. Estimate first and submit approved_quote_id.

パラメータ

video_urlsbody必須
string[]

Empty for photos; one source video URL for replacement

reference_urlsbody必須
string[]

Photos: [target,face]; video: [reference]

promptbody任意
string

希望するスワップを説明する置換プロンプト

approved_quote_idbody必須
string

quote_id returned by the estimate

resolutionbody任意
string

出力解像度;デフォルト 720P

aspect_ratiobody任意
string

アスペクト比;デフォルト 9:16

modelbody任意
string

ponys-face / ponys-animate

duration_secondsbody任意
number

請求額の見積もりのためのソースビデオの合計再生時間 (秒)。省略された場合は自動検出

seedbody任意
integer

再現可能な結果のためのランダムシード

watermarkbody任意
boolean

ウォーターマークを追加するかどうか。デフォルトは false

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/videos/replace-character" \
  -H "Authorization: Bearer dm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "video_urls": [
    "https://example.com/video1.mp4"
  ],
  "reference_urls": [
    "https://example.com/face1.jpg"
  ],
  "prompt": "将视频中的人物替换为参考图中的人物,保持表情和动作自然",
  "resolution": "720P",
  "aspect_ratio": "9:16",
  "model": "ponys-animate",
  "approved_quote_id": "QUOTE_ID_FROM_ESTIMATE",
  "duration_seconds": 10.5,
  "seed": 12345,
  "watermark": false
}'
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "task_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}
リクエスト本文の例
JSON
{
  "video_urls": [
    "https://example.com/video1.mp4"
  ],
  "reference_urls": [
    "https://example.com/face1.jpg"
  ],
  "prompt": "将视频中的人物替换为参考图中的人物,保持表情和动作自然",
  "resolution": "720P",
  "aspect_ratio": "9:16",
  "model": "ponys-animate",
  "approved_quote_id": "QUOTE_ID_FROM_ESTIMATE",
  "duration_seconds": 10.5,
  "seed": 12345,
  "watermark": false
}

Generate voice and audio

POST/api/developer/v1/audio/generations

Estimate the identical inputs, approve the Tokens, then submit its quote_id as approved_quote_id. Success consumes that quote; failure refunds it.

パラメータ

modelbody必須
string

ponys-audio

text_promptbody必須
string

Audio text, up to 3000 characters

approved_quote_idbody必須
string

quote_id returned by the estimate

referencesbody任意
object[]

Optional voice or audio references

audio_configbody任意
object

Format, sample rate and voice settings

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/audio/generations" \
  -H "Authorization: Bearer dm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "ponys-audio",
  "text_prompt": "欢迎来到我们的故事。",
  "approved_quote_id": "QUOTE_ID_FROM_ESTIMATE"
}'
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "task_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}
リクエスト本文の例
JSON
{
  "model": "ponys-audio",
  "text_prompt": "欢迎来到我们的故事。",
  "approved_quote_id": "QUOTE_ID_FROM_ESTIMATE"
}

Preview and lock Tokens

POST/api/developer/v1/usage/estimate

Use for audio, photo face swaps and video character replacement. options must match generation inputs; refresh and approve expired or changed specifications. Photo: model=ponys-face, feature_key=video_character_replace, options.urls=[target,face]. Video: model=ponys-animate, options.urls=[reference], video_urls=[source], resolution=480p or 720p.

パラメータ

feature_keybody必須
string

generate_standalone_audio / video_character_replace

modelbody必須
string

ponys-audio / ponys-face / ponys-animate

optionsbody必須
object

Identical generation inputs; financial amounts are server-owned

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/usage/estimate" \
  -H "Authorization: Bearer dm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "feature_key": "generate_standalone_audio",
  "model": "ponys-audio",
  "options": {
    "text_prompt": "欢迎来到我们的故事。"
  }
}'
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "feature_key": "generate_standalone_audio",
    "model": "ponys-audio",
    "points_cost": 9,
    "billing_unit": "ponys_token",
    "quote_id": "QUOTE_ID_FROM_ESTIMATE",
    "expires_at": "2026-10-22T12:00:00Z"
  }
}
リクエスト本文の例
JSON
{
  "feature_key": "generate_standalone_audio",
  "model": "ponys-audio",
  "options": {
    "text_prompt": "欢迎来到我们的故事。"
  }
}

タスクステータスの取得

GET/api/developer/v1/tasks/{task_id}

各タスクを10秒以上の間隔でcompletedまたはfailedまで確認します。アカウントの全リクエストは共通の制限(標準はGETを含め毎分10回)を使います。全体の間隔を調整し、429ではRetry-Afterに従ってください。ダウンロード版クライアントは対応済みです。

パラメータ

task_idpath必須
string

画像/ビデオ/置換エンドTokensによって返されたタスク ID

コードサンプル

cURL
curl -X GET "https://dramamaster.ai/api/developer/v1/tasks/{task_id}" \
  -H "Authorization: Bearer dm_live_xxx"
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "task_id": "550e8400-e29b-41d4-a716-446655440000",
    "task_type": "standalone_image_generate",
    "status": "completed",
    "progress": 100,
    "points_cost": 8,
    "billing_unit": "ponys_token",
    "billing_wallet": "ponys",
    "billing_state": "consumed",
    "result_url": "https://example.com/output/xxx.png",
    "error_message": null,
    "extra": {
      "model": "ponys-generation-image",
      "aspect_ratio": "16:9"
    }
  }
}

ファイルをアップロード

POST/api/developer/v1/files

ファイルをストレージにアップロードし、参照可能な URL を受け取ります。最初のフレーム画像、参照画像、参照ビデオ、または参照音声に使用します (Content-Type: multipart/form-data)。

パラメータ

fileformData必須
file

アップロードするファイル (画像、ビデオ、オーディオなど)

コードサンプル

cURL
curl -X POST "https://dramamaster.ai/api/developer/v1/files" \
  -H "Authorization: Bearer dm_live_xxx" \
  -F "file=@./reference.png"
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "url": "https://example.com/uploads/xxx.jpg",
    "storage_key": "uploads/2024/01/xxx.jpg",
    "original_filename": "my_image.jpg",
    "size_bytes": 204800,
    "content_type": "image/jpeg"
  }
}

モデルのリスト

GET/api/developer/v1/models

画像・動画製品の対応能力、入力上限、料金を取得します。返された name を model に指定してください。

パラメータ

なし

コードサンプル

cURL
curl -X GET "https://dramamaster.ai/api/developer/v1/models" \
  -H "Authorization: Bearer dm_live_xxx"
応答例
{
  "code": 200,
  "message": "ok",
  "data": {
    "image_models": [
      {
        "name": "ponys-generation-image",
        "display_name": "Ponys Image",
        "icon_url": "https://example.com/icon.png",
        "capabilities": [
          "text_to_image"
        ],
        "capability_labels": {
          "text_to_image": "文生图"
        },
        "image_resolutions": [
          "1K",
          "2K"
        ],
        "max_reference_images": 10,
        "billing_unit": "ponys_token",
        "quote_required": true
      }
    ],
    "video_models": [
      {
        "name": "ponys-generation-video",
        "display_name": "Video",
        "icon_url": "https://example.com/icon.png",
        "capabilities": [
          "text_to_video",
          "first_frame",
          "flf2v",
          "image_reference"
        ],
        "capability_labels": {
          "text_to_video": "文生视频",
          "first_frame": "首帧生视频",
          "flf2v": "首尾帧生视频",
          "image_reference": "全能参考"
        },
        "duration_range": {
          "min": 2,
          "max": 30
        },
        "max_duration_seconds": {
          "text_to_video": 15,
          "first_frame": 30,
          "flf2v": 30,
          "image_reference": 30
        },
        "max_reference_images": 10,
        "max_reference_videos": 5,
        "max_reference_audios": 5,
        "billing_unit": "ponys_token",
        "quote_required": true
      }
    ]
  }
}