Videos API

AI動画生成

Videos APIでテキストや画像から動画を生成し、進捗確認とMP4取得を行います。

ドキュメント概要へ

接続と認証

Base URL: https://thapi.cloud/v1

Authorization: Bearer $API_KEY

環境変数API_KEYを設定します。GET /v1/modelsで動画を生成せずに認証を確認できます。

read -r -s -p "API_KEY: " API_KEY
export API_KEY
printf '\n'
curl -fsS https://thapi.cloud/v1/models -H "Authorization: Bearer ${API_KEY:?API_KEY}"

cURL例はBash用です。WindowsではPowerShellでキーを設定し、サンプルURLを配信元からアクセスできる自分のファイルに置き換えてください。

動画生成には料金が発生します。成功応答のidを保存し、同じジョブを追跡してください。

id発行後の失敗に対する返金は、配信元の結果と照合処理に依存します。failedだけで即時返金を確認できません。

進捗確認・ダウンロード・取消は新しい生成を行いません。取消成功によって計上済み料金が自動返金されるわけではありません。

モデルと機能

モデルVendor長さ(秒)料金 / 動画参照画像の上限アスペクト比解像度
st1/veo-3.1Google4 / 6 / 84,600 ST / 4,600 ST / 4,600 ST0–39:16, 16:9720p / 1080p
st1/seedance-2.0-noface-ecoByteDance4–15 seconds (1s steps)Default 10s = 3,700 ST0–1021:9, 16:9, 4:3, 1:1, 3:4, 9:16original
st1/seedance-2.0-nofaceByteDance4–15 seconds (1s steps)Default 10s = 12,600 ST0–1021:9, 16:9, 4:3, 1:1, 3:4, 9:16original
st1/seedance-2.0-miniByteDance4–15 seconds (1s steps)Default 5s = 13,400 ST0–921:9, 16:9, 4:3, 1:1, 3:4, 9:16720p / 1080p
st1/seedance-2.0-fastByteDance4–15 seconds (1s steps, Fast 720p)Default 5s = 21,300 ST0–921:9, 16:9, 4:3, 1:1, 3:4, 9:16720p / 1080p
st1/seedance-2.5-flashByteDance4–30 seconds (1s steps)Default 5s = 18,100 ST0–1021:9, 16:9, 4:3, 1:1, 3:4, 9:16480p
st1/seedance-2.5ByteDance4–30 seconds (1s steps)Default 5s = 40,700 ST0–1021:9, 16:9, 4:3, 1:1, 3:4, 9:16720p / 1080p
st1/wan-3.0Alibaba4–15 seconds (1s steps)63,300 ST0–1016:9, 9:16720p
st2/veo-3.1Google4 / 6 / 84,600 ST / 4,600 ST / 4,600 ST1–316:9, 9:16720p
st2/google-omni-flashGoogle5 / 1011,200 ST / 11,200 ST1–316:9, 9:16720p
st2/grok-imagine-video-1.5xAI6 / 10 / 1513,200 ST / 22,000 ST / 33,000 ST1–316:9, 9:16, 1:1, 4:3, 3:4720p
st2/seedance-2.0-mini-480pByteDance4–15 seconds (1s steps)Default 5s = 6,300 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16480p
st2/seedance-2.0-mini-720pByteDance4–15 seconds (1s steps)Default 5s = 13,400 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16720p
st2/seedance-2.0-fast-480pByteDance4–15 seconds (1s steps, Fast 720p)Default 5s = 9,900 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16480p
st2/seedance-2.0-fast-720pByteDance4–15 seconds (1s steps, Fast 720p)Default 5s = 21,300 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16720p
st2/seedance-2.0-480pByteDance4–15 seconds (1s steps)Default 5s = 12,400 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16480p
st2/seedance-2.0-720pByteDance4–15 seconds (1s steps)Default 5s = 26,700 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16720p
st2/seedance-2.0-1080pByteDance4–15 seconds (1s steps)Default 5s = 65,800 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:161080p
st2/seedance-2.5-480pByteDance4–30 seconds (1s steps)Default 5s = 18,100 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16480p
st2/seedance-2.5-720pByteDance4–30 seconds (1s steps)Default 5s = 40,700 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:16720p
st2/seedance-2.5-1080pByteDance4–30 seconds (1s steps)Default 5s = 99,800 ST0–10auto / 21:9, 16:9, 4:3, 1:1, 3:4, 9:161080p

veo-3.1 accepts 4/6/8 seconds; google-omni-flash accepts 5/10; grok-imagine-video-1.5 accepts 6/10/15.

画像・サイズ・解像度の対応は配信経路にも依存します。すべてのパラメータがすべてのモデルで使えるわけではありません。

veo-3.1 accepts only 4, 6 or 8. google-omni-flash accepts only 5 or 10. grok-imagine-video-1.5 accepts only 6, 10 or 15. Check seconds in the response.

エンドポイントとパラメータ

POST /v1/videos — ジョブ作成

application/jsonを送信します。multipart/form-dataは受け付けません。モデルが対応するURLまたは画像JSONを使ってください。

パラメータ必須条件使い方
model必須公開中の動画モデルIDを明示してください。既定モデルには依存しないでください。
prompt必須被写体、背景、動き、カメラワークを記述します。
seconds任意Follow the model table. veo-3.1 defaults to 8s; google-omni-flash to 10s; grok-imagine-video-1.5 to 6s.
aspect_ratio任意For example 16:9 or 9:16 depending on the model. Keep it consistent with size.
size任意1280x720や720x1280など。対応サイズはモデルによります。
images / input_reference任意開始・参照画像をURL/JSONで指定します。本文全体は2047 MBまでで、配信元の画像制限も適用されます。
reference_image_urls任意reference_image_urls: reference images (reference mode; not locked as the first frame).
omni_reference_task_type任意omni_reference_task_type: set "reference" when using reference images with a fixed aspect_ratio.
last_frame任意End frame for veo-3.1 or grok-imagine-video-1.5, with the same input_reference.
input_video任意google-omni-flashの動画変換用MP4 URL。
resolution任意Some models support 720p or 1080p (default 720p). Others may ignore it or derive from size.
generate_audio任意Some video models may ignore generate_audio / reference_audios.

GET /v1/videos/{id} — 進捗確認

作成時と同じ ?model= を指定します。推奨ポーリング間隔:10秒(429 応答時は間隔を広げてください)。

  • queued:受付済み、待機中。
  • in_progress:配信元が処理中。
  • completed:結果をダウンロード可能。
  • failed:errorを確認し、問い合わせ用にidを保存します。
{
  "id": "video_abc123",
  "object": "video",
  "model": "st2/seedance-2.0-720p",
  "status": "completed",
  "progress": 100,
  "seconds": "10",
  "size": "1280x720",
  "error": null
}

GET /v1/videos/{id}/content — MP4取得

completed後に同じAPIキーと?model=で取得し、バイナリ応答を.mp4として保存します。

DELETE /v1/videos/{id} — 取消要求

キャンセルはエンドポイントとタスクの状態に依存します。一部のエンドポイントは現在 DELETE に対応していません。キャンセルは返金の保証とはみなしません。

長さ別料金

表示料金はこのサイトの現行設定と価格調整を反映しています。生成前に確認してください。

Seedance duration pricing. Unit: VND per successful video. 4–15s or 4–30s is the supported duration range, not a flat package price. Choose seconds within the supported range; exact prices are listed below. Any fixed generation fee is already included.

st1/seedance-2.0-noface-eco

If seconds is omitted: 10s = 3,700 ST.

Duration / Seconds料金 / 動画
10s3,700 ST
15s5,000 ST

st1/seedance-2.0-noface

If seconds is omitted: 10s = 12,600 ST.

Duration / Seconds料金 / 動画
10s12,600 ST
15s16,400 ST

st1/seedance-2.0-mini

If seconds is omitted: 5s = 13,400 ST.

Duration / Seconds料金 / 動画
5s13,400 ST
10s26,700 ST
15s40,000 ST

st1/seedance-2.0-fast

If seconds is omitted: 5s = 21,300 ST.

Duration / Seconds料金 / 動画
5s21,300 ST
10s42,500 ST
15s63,800 ST

st1/seedance-2.5-flash

If seconds is omitted: 5s = 18,100 ST.

Duration / Seconds料金 / 動画
5s18,100 ST
10s36,200 ST
15s54,200 ST
30s108,400 ST

st1/seedance-2.5

If seconds is omitted: 5s = 40,700 ST.

Duration / Seconds料金 / 動画
5s40,700 ST
10s81,300 ST
15s121,800 ST
30s243,500 ST

st2/seedance-2.0-mini-480p

If seconds is omitted: 5s = 6,300 ST.

Duration / Seconds料金 / 動画
4s5,100 ST
5s6,300 ST
6s7,600 ST
7s8,800 ST
8s10,000 ST
9s11,200 ST
10s12,500 ST
11s13,700 ST
12s14,900 ST
13s16,100 ST
14s17,400 ST
15s18,600 ST

st2/seedance-2.0-mini-720p

If seconds is omitted: 5s = 13,400 ST.

Duration / Seconds料金 / 動画
4s10,800 ST
5s13,400 ST
6s16,100 ST
7s18,700 ST
8s21,400 ST
9s24,100 ST
10s26,700 ST
11s29,400 ST
12s32,100 ST
13s34,700 ST
14s37,400 ST
15s40,000 ST

st2/seedance-2.0-fast-480p

If seconds is omitted: 5s = 9,900 ST.

Duration / Seconds料金 / 動画
4s7,900 ST
5s9,900 ST
6s11,800 ST
7s13,800 ST
8s15,800 ST
9s17,700 ST
10s19,700 ST
11s21,700 ST
12s23,600 ST
13s25,600 ST
14s27,600 ST
15s29,500 ST

st2/seedance-2.0-fast-720p

If seconds is omitted: 5s = 21,300 ST.

Duration / Seconds料金 / 動画
4s17,000 ST
5s21,300 ST
6s25,500 ST
7s29,800 ST
8s34,000 ST
9s38,300 ST
10s42,500 ST
11s46,800 ST
12s51,000 ST
13s55,300 ST
14s59,500 ST
15s63,800 ST

st2/seedance-2.0-480p

If seconds is omitted: 5s = 12,400 ST.

Duration / Seconds料金 / 動画
4s9,900 ST
5s12,400 ST
6s14,900 ST
7s17,300 ST
8s19,800 ST
9s22,300 ST
10s24,800 ST
11s27,200 ST
12s29,700 ST
13s32,200 ST
14s34,600 ST
15s37,100 ST

st2/seedance-2.0-720p

If seconds is omitted: 5s = 26,700 ST.

Duration / Seconds料金 / 動画
4s21,400 ST
5s26,700 ST
6s32,000 ST
7s37,300 ST
8s42,600 ST
9s47,900 ST
10s53,200 ST
11s58,600 ST
12s63,900 ST
13s69,200 ST
14s74,500 ST
15s79,800 ST

st2/seedance-2.0-1080p

If seconds is omitted: 5s = 65,800 ST.

Duration / Seconds料金 / 動画
4s52,600 ST
5s65,800 ST
6s78,900 ST
7s92,000 ST
8s105,200 ST
9s118,300 ST
10s131,500 ST
11s144,600 ST
12s157,700 ST
13s170,900 ST
14s184,000 ST
15s197,200 ST

st2/seedance-2.5-480p

If seconds is omitted: 5s = 18,100 ST.

Duration / Seconds料金 / 動画
4s14,500 ST
5s18,100 ST
6s21,700 ST
7s25,300 ST
8s29,000 ST
9s32,600 ST
10s36,200 ST
11s39,800 ST
12s43,400 ST
13s47,000 ST
14s50,600 ST
15s54,200 ST
16s57,900 ST
17s61,500 ST
18s65,100 ST
19s68,700 ST
20s72,300 ST
21s75,900 ST
22s79,500 ST
23s83,100 ST
24s86,800 ST
25s90,400 ST
26s94,000 ST
27s97,600 ST
28s101,200 ST
29s104,800 ST
30s108,400 ST

st2/seedance-2.5-720p

If seconds is omitted: 5s = 40,700 ST.

Duration / Seconds料金 / 動画
4s32,600 ST
5s40,700 ST
6s48,800 ST
7s57,000 ST
8s65,100 ST
9s73,200 ST
10s81,300 ST
11s89,400 ST
12s97,500 ST
13s105,600 ST
14s113,700 ST
15s121,800 ST
16s130,000 ST
17s138,100 ST
18s146,200 ST
19s154,300 ST
20s162,400 ST
21s170,500 ST
22s178,600 ST
23s186,700 ST
24s194,800 ST
25s202,900 ST
26s211,100 ST
27s219,200 ST
28s227,300 ST
29s235,400 ST
30s243,500 ST

st2/seedance-2.5-1080p

If seconds is omitted: 5s = 99,800 ST.

Duration / Seconds料金 / 動画
4s79,900 ST
5s99,800 ST
6s119,800 ST
7s139,700 ST
8s159,700 ST
9s179,600 ST
10s199,600 ST
11s219,600 ST
12s239,500 ST
13s259,500 ST
14s279,400 ST
15s299,400 ST
16s319,300 ST
17s339,300 ST
18s359,200 ST
19s379,200 ST
20s399,200 ST
21s419,100 ST
22s439,100 ST
23s459,000 ST
24s479,000 ST
25s498,900 ST
26s518,900 ST
27s538,800 ST
28s558,800 ST
29s578,800 ST
30s598,700 ST

Other video models

モデル長さ(秒)料金 / 動画
st1/veo-3.144,600 ST
st1/veo-3.164,600 ST
st1/veo-3.184,600 ST
st1/wan-3.0563,300 ST
st2/veo-3.144,600 ST
st2/veo-3.164,600 ST
st2/veo-3.184,600 ST
st2/google-omni-flash511,200 ST
st2/google-omni-flash1011,200 ST
st2/grok-imagine-video-1.5613,200 ST
st2/grok-imagine-video-1.51022,000 ST
st2/grok-imagine-video-1.51533,000 ST

Per-second pricing applies only to duration-priced models (for example grok-imagine-video-1.5). Fixed-price video models use a flat request price.

料金一覧へ

実装例

POSTごとに課金対象動画が作成されます。例を一つ選び、実行前にexample.comのURLを置き換えてください。

import os
import time
from getpass import getpass
from urllib.parse import quote
import requests
from requests.adapters import HTTPAdapter

api_key = os.getenv("STALI_API_KEY") or getpass("STALI_API_KEY: ")
headers = {"Authorization": f"Bearer {api_key}"}
model = "st2/seedance-2.0-720p"
http = requests.Session()
http.mount("https://", HTTPAdapter(max_retries=0))
created = http.post("https://thapi.cloud/v1/videos", headers=headers, json={
    "model": model, "prompt": "Cinematic sunset over ocean waves",
    "seconds": 5, "aspect_ratio": "16:9",
}, timeout=(10, 120))
print("Request ID:", created.headers.get("x-request-id") or created.headers.get("x-stali-request-id", ""), flush=True)
created.raise_for_status()
video = created.json()
video_id = video["id"]
with open("video-job.txt", "w") as f:
    f.write(f"{video_id}\t{model}\n")
print(video_id, video.get("status"), "(da luu vao video-job.txt)", flush=True)

job_url = "https://thapi.cloud/v1/videos/" + quote(video_id, safe="")
han_chot = time.monotonic() + 1800
cho = 5
while video.get("status") not in ("completed", "failed"):
    if time.monotonic() > han_chot:
        raise SystemExit(
            f"Het thoi gian cho phia client. Tac vu CO THE VAN DANG CHAY.\n"
            f"Tiep tuc bang: python resume.py {video_id} {model}\n"
            f"Dung tao video moi — lenh POST da tinh phi roi."
        )
    time.sleep(cho)
    progress = http.get(job_url, headers=headers, params={"model": model}, timeout=(10, 60))
    if progress.status_code in (429, 500, 502, 503, 504):
        cho = min(cho * 2, 60)
        sau = progress.headers.get("retry-after")
        if sau and sau.isdigit():
            cho = max(cho, int(sau))
        print(video_id, f"upstream {progress.status_code}, cho {cho}s roi thu lai", flush=True)
        continue
    progress.raise_for_status()
    cho = 5
    video = progress.json()
    print(video_id, video.get("status"), flush=True)

if video.get("status") != "completed":
    raise RuntimeError(str(video))

content = http.get(job_url + "/content", headers=headers, params={"model": model}, stream=True, timeout=(10, 120))
content.raise_for_status()
tam = f"{video_id}.mp4.part"
with open(tam, "wb") as output:
    for chunk in content.iter_content(chunk_size=65536):
        if chunk:
            output.write(chunk)
os.replace(tam, f"{video_id}.mp4")
print("da luu", f"{video_id}.mp4", flush=True)

エラー対応

HTTP原因対処
400パラメータ不正または取消非対応。JSON・seconds・画像とモデル対応を確認。
401キー未指定または無効。認証ヘッダーと有効なキーを確認。
402HTTP 402:error.type、残りクレジット、キーの上限、または前回までの未精算額を確認してください。error.type を確認します。insufficient_balance → 残りクレジットを確認。api_key_monthly_limit → Dashboard → Keys で上限を確認・調整。outstanding_undercharge → 過去のリクエストの未精算額を照合。詳しくは /docs/reference/errors を参照してください。
403要求が許可されていません。キー権限・モデル・コンテンツ規約を確認。
404経路上にモデルまたはジョブがありません。作成時のid・キー・?model=を使用。
409この操作を行う準備が未完了です。確認を継続しcompleted後に取得。
413要求本文が上限を超えています。本文を縮小し大きい埋込データをURLに置換。
429頻度または同時実行数の上限超過。待機を延ばし同時ジョブ数を削減。
502配信経路の応答エラー。リクエストIDを保管しPOSTを自動再送しない。

タイムアウトや通信エラー後にPOSTを自動再送しないでください。既に受理された可能性があります。idがあれば照会し、なければリクエストIDを保管して利用履歴やサポートで確認してください。

プロンプト設計

以下は制作の指針であり、全詳細の再現を保証しません。各モデルのコンテンツポリシーが適用されます。

明確なプロンプト

  1. 効果より先に被写体・背景・主要動作を決めます。
  2. 長さは文章だけでなくsecondsで設定します。
  3. ショット間で左右位置と衣装を統一します。
  4. 各ショットで明確なカメラ動作を一つ優先します。
  5. 光源・色・素材を具体的に記述します。
  6. 小さな文字・ロゴ・正確な数字の指定は避けます。
  7. 短い一場面から始め、結果を見て一要素ずつ調整します。

参照画像の整理

  • 送信順にImage 1、Image 2…と指定します。
  • 人物・衣装・背景のどれに使う画像か明示します。
  • 使用権があり、鮮明で方向性の揃った画像を使います。
  • 自然な動きのため開始・終了画像の人物と構図を合わせます。
  • 画像上限を守ってください。参照画像は完全再現を保証しません。

プロンプト例

Generate immediately in 16:9 widescreen as one continuous three-shot sequence.
The reference images are colored-pencil character design sketches: use them only for design and outfits. Render the video as a photoreal 3D CG game cinematic with dramatic lighting.
Image 1 = PROTAGONIST: [character design].
Image 2 = ANTAGONIST: [opponent design].
Image 3 = ENVIRONMENT: [setting].
FIXED LAYOUT: altar in the background CENTER; protagonist on the LEFT; antagonist on the RIGHT. Nobody disappears, teleports or swaps sides.
LIGHTING: torchlight from the left wall, cool moonlight from the ceiling.
Action: well-choreographed, orbiting camera. Sparks and dark smoke on impact only; no blood, no wounds, no gore.
Sound: heavy impacts, wind, no dialogue.
Shot 1: camera pushes in, protagonist draws a weapon, antagonist raises claws.
Shot 2: fast exchange, camera orbits smoothly around both fighters.
Shot 3: climax, both stay on their sides, protagonist lands in a ready stance.
Keep faces and outfits consistent. No text, no numbers, no subtitles, no watermark.

動作が抜ける場合は短くし、APIパラメータを文章で代用しないでください。

生々しくないアクションの表現

生々しい表現を避ける安全な視覚表現
blood, wound, gore, corpsesparks, black smoke, torn fabric only
血だまりmurky grey mist, dark viscous puddle
負傷を伴う攻撃glowing wisps of spirit-light, shadowy aura
皮膚の切り傷tearing only the fabric of the sleeve, no blood

複数シーンの制作

  1. 開始と終了が明確な場面に分けます。
  2. 人物説明・照明・参照画像を揃えます。
  3. 次を生成する前に各場面を取得・確認します。
  4. 編集ツールで結合します。POSTごとに別途課金されます。

結果が意図と異なる場合

  • 動作不足:一場面の出来事を減らします。
  • 位置が逆転:左右と構図を明示します。
  • 一貫性不足:参照画像と特徴説明を再利用します。
  • 長さ違い:secondsと固定長モデルを確認します。
  • 拒否:errorとコンテンツ規約を確認し、同じ要求を繰り返さないでください。

フレーム一覧で動きを確認

ffmpeg -i clip.mp4 -vf "fps=1,scale=320:-1,tile=6x5" -frames:v 1 frame_grid.png

ffmpegコマンドはローカルclip.mp4を読み込み一覧画像を作成します。APIは呼びません。事前にffmpegを導入してください。

実行前チェック

  • 正しいモデルIDと対応する長さを選びます。
  • 生成前に料金とクレジット残高を確認します。
  • キーをサーバー側に保管し公開ブラウザーコードに含めません。
  • JSONと配信元がアクセス可能なメディアURLを使います。
  • id・model・リクエストIDを保存します。
  • 同じidを?model=付きで確認し、制限時は間隔を延ばします。
  • completed後に取得しMP4を確認します。
  • 受理状況が不明なときは自動で再生成しません。
  • 利用履歴でエラーと料金を照合し、必要ならサポートにidを伝えます。