Short drama production API
One API for short-drama production, with image and video generation ready when you need it.
https://dramamaster.ai/api/developer/v1Use the product IDs returned by GET /models. The model field accepts a stable product ID, such as ponys-generation-image.
OpenAPI specificationAuthentication
Use Authorization: Bearer dm_live_xxx or Bearer dm_test_xxx.
Response & billing
API requests use the same Ponys Tokens as the website, including generation with a test key.
- Outline, script, storyboard and episode export cost 4 Tokens per action.
- Image and video prices depend on the model and settings. Check the model catalog before submitting. List models
- Audio, photo face swap and video character replacement require an approved quote. Preview and lock Tokens
Short drama
Script → storyboard → asset images → shot videos → episode export. DramaMaster generates directly; image and video prices match Ponys.
Connect your account
Create a key in the developer center. Keep it on your server and send it in the Authorization header.
Submit your script
For a pasted script, 00:00–00:10 sets a 10-second capacity limit. Shorter content keeps its actual length. Set a creative target separately in production settings.
Track the result
Check progress at least 10 seconds apart. Submit the next stage after the previous stage completes.
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."}'Workflow endpoints
- POST
/dramas - Turn a script into a storyboard, generate assets and shots, then export an episode.
- POST
/dramas/ideas - Start from an idea
- PATCH
/dramas/{drama_id}/review - Approve first clip
- GET
/dramas/{drama_id} - Check drama
- POST
/dramas/{drama_id}/assets - Generate assets
- POST
/dramas/{drama_id}/images - Generate images
- POST
/dramas/{drama_id}/videos - Generate videos
- POST
/dramas/{drama_id}/export - Export episode
- POST
/dramas/{drama_id}/run - Background production
- GET
/dramas/{drama_id}/run - Read background production status
- POST
/generation/images - Generate images from text or reference images.
- POST
/generation/videos - Generate videos from text, first frames, or reference media.
- GET
/tasks/{task_id} - Check task
Start from an idea
Describe one short episode. DM starts the storyboard and pauses if it needs asset images or your review.
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}/runChoose 10, 15, 20 or 30 seconds, a vertical, horizontal or square frame, and realistic or animated style. Optional reference_image_urls uses up to five images uploaded to this workspace via /files.
Image & video examples
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}]}}The quickstart uses /generation/images and /generation/videos. The reference below covers separate compatibility routes with their own parameters.
Image options: 1K or 2K; up to 10 reference images; one output per task.
Video options: integer seconds; text-only 2–15s, image/reference mode 2–30s; 480P, 720P or 1080P (text-only: 720P or 1080P). Reference videos total at most 15s; input plus output at most 30s.
Set model to Video-Generation-2.0 or 2.0-flash. Omit it to use the default video model. Check GET /models for availability.
Background production
Start or resume production without configuring a spending cap. Closing the page does not cancel accepted work. Stop prevents later stages; failures or uncertain outcomes preserve original tasks for review.
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"}Before production
- If a response has partial: true, stop and check its task IDs. Submit only the work that still needs to run.
- Retry with the same Idempotency-Key and unchanged body after a lost response. A changed body with the same key returns 409.
- Each stage submits only the available task slots. Wait for the returned tasks, then submit the same stage with a new key until next_stage advances. A partial response lists tasks already accepted.
- 400: model, reference or pricing validation; 401: invalid key; 402: insufficient points; 409: prerequisites or idempotency conflict; 422: invalid options; 429: task or rate limit; 503: generation service or script pricing is not configured.
- Media and result URLs are temporary private links. Query the task again for a fresh link.
- Download the Python client to automatically drive these same stages. Use a stable run ID to resume safely. It does not retry uncertain generation submissions.
- DramaMaster and Ponys use the same Tokens wallet. Image and video prices come directly from Ponys for the selected settings. Test keys use the same billing rules.
Generation
These endpoints accept a product ID from GET /models. The short-drama workflow above uses /dramas and /generation; existing /images and /videos endpoints remain available.
Generate image
/api/developer/v1/images/generationsSubmit a standalone image generation task (text-to-image or reference-image composition). Returns task_id; poll GET /api/developer/v1/tasks/task_id for results.
Parameters
modelbodyRequiredstringProduct ID from GET /models; for example ponys-image.
promptbodyRequiredstringText description of the image to generate
aspect_ratiobodyOptionalstringAspect ratio: 16:9, 9:16, 4:3, or 3:4
image_resolutionbodyOptionalstringOutput resolution: 1K or 2K
reference_urlsbodyOptionalstring[]Reference image URLs. Up to 10, subject to the selected model’s limit.
Code Sample
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"
}
}Request Body Example
{
"model": "ponys-generation-image",
"prompt": "一只可爱的猫咪在草地上奔跑",
"aspect_ratio": "16:9",
"image_resolution": "2K",
"reference_urls": [
"https://example.com/ref1.jpg"
]
}Generate video
/api/developer/v1/videos/generationsSubmit a video generation task. Supported inputs, durations and options depend on the selected product. Poll GET /tasks/task_id for the result.
Parameters
modelbodyRequiredstringProduct ID from GET /models; for example ponys-turbo.
motion_instructionbodyOptionalstring | null[Common / conditionally required] Prompt / motion instruction. Required for text-to-video, all-modal reference, editing, and extension. You can mention Image 1 / Video 1 / Audio 1
aspect_ratiobodyOptional16:9 | 9:16 | 4:3 | 3:4 | null[Common] Aspect ratio: 16:9, 9:16, 4:3, or 3:4
duration_secondsbodyOptionalinteger | null[Common] Output duration in seconds. See duration_range / max_duration_seconds from GET /models
capabilitybodyOptionalfirst_frame | flf2v | image_reference | null[Common] first_frame, flf2v, or image_reference; omit or null to infer from fields (motion_instruction only = text-to-video)
image_urlbodyOptionalstring | null[Common / mode-specific] First-frame image URL for first_frame / flf2v. Do not send with reference_* fields
last_frame_urlbodyOptionalstring | nullLast-frame image URL. Use with image_url for flf2v; check the selected product’s capabilities.
reference_urlsbodyOptionalstring[][Common / reference mode] Reference image URLs for image_reference
reference_video_urlsbodyOptionalstring[]Reference video URLs; check max_reference_videos and capabilities in GET /models.
reference_audio_urlsbodyOptionalstring[]Reference audio URLs; check max_reference_audios and capabilities in GET /models.
resolutionbodyOptional480P | 720P | 1080P | nullOutput resolution; check supported values for the selected product.
audiobodyOptionalboolean | nullGenerate audio when supported by the selected product.
seedbodyOptionalinteger | nullRandom seed for reproducibility, when supported.
watermarkbodyOptionalboolean | nullAdd a watermark when supported; default false.
prompt_extendbodyOptionalboolean | nullEnable prompt expansion when supported.
smart_durationbodyOptionalbooleanUse automatic duration when supported; default false.
enable_thinkingbodyOptionalboolean | nullEnable reasoning when supported; required for document or web references.
document_urlbodyOptionalstring | nullDocument reference URL, when supported.
web_urlbodyOptionalstring | nullPublic webpage reference URL, when supported.
Code Sample
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"
}
}Request Body Example
{
"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
}Replace character in video
/api/developer/v1/videos/replace-characterFor 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.
Parameters
video_urlsbodyRequiredstring[]Empty for photos; one source video URL for replacement
reference_urlsbodyRequiredstring[]Photos: [target,face]; video: [reference]
promptbodyOptionalstringReplacement prompt describing the desired swap
approved_quote_idbodyRequiredstringquote_id returned by the estimate
resolutionbodyOptionalstringOutput resolution; default 720P
aspect_ratiobodyOptionalstringAspect ratio; default 9:16
modelbodyOptionalstringponys-face / ponys-animate
duration_secondsbodyOptionalnumberTotal source video duration (seconds) for billing estimate; auto-detected if omitted
seedbodyOptionalintegerRandom seed for reproducible results
watermarkbodyOptionalbooleanWhether to add watermark; default false
Code Sample
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"
}
}Request Body Example
{
"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
/api/developer/v1/audio/generationsEstimate the identical inputs, approve the Tokens, then submit its quote_id as approved_quote_id. Success consumes that quote; failure refunds it.
Parameters
modelbodyRequiredstringponys-audio
text_promptbodyRequiredstringAudio text, up to 3000 characters
approved_quote_idbodyRequiredstringquote_id returned by the estimate
referencesbodyOptionalobject[]Optional voice or audio references
audio_configbodyOptionalobjectFormat, sample rate and voice settings
Code Sample
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"
}
}Request Body Example
{
"model": "ponys-audio",
"text_prompt": "欢迎来到我们的故事。",
"approved_quote_id": "QUOTE_ID_FROM_ESTIMATE"
}Preview and lock Tokens
/api/developer/v1/usage/estimateUse 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.
Parameters
feature_keybodyRequiredstringgenerate_standalone_audio / video_character_replace
modelbodyRequiredstringponys-audio / ponys-face / ponys-animate
optionsbodyRequiredobjectIdentical generation inputs; financial amounts are server-owned
Code Sample
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"
}
}Request Body Example
{
"feature_key": "generate_standalone_audio",
"model": "ponys-audio",
"options": {
"text_prompt": "欢迎来到我们的故事。"
}
}Get task status
/api/developer/v1/tasks/{task_id}Poll task status until completed or failed, at least 10 seconds apart per task. All account requests share the RPM limit (default 10/minute, including GET). Pace all requests and respect Retry-After on 429; the downloadable client handles this.
Parameters
task_idpathRequiredstringTask ID returned by image/video/replace endpoints
Code Sample
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"
}
}
}Upload file
/api/developer/v1/filesUpload a file to storage and receive a referenceable URL. Use for first-frame images, reference images, reference videos, or reference audio (Content-Type: multipart/form-data).
Parameters
fileformDataRequiredfileFile to upload (image, video, audio, etc.)
Code Sample
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"
}
}List models
/api/developer/v1/modelsGet available image and video products, supported capabilities, input limits and pricing. Use the returned name as the model parameter.
Parameters
None
Code Sample
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
}
]
}
}