跳转到内容
EN

创建视频

POST/model/v1/videos● 支持

请求体

  • modelstring可选◐ 部分支持

    Video model id, for example wan2.7-t2v; list candidates with listModels?type=video. Router support (partial): Select a registered video model explicitly, for example wan2.7-t2v (size=1280x720, seconds=4). Capability preflight errors are reported before creation.

    请显式选择已注册的视频模型,例如 wan2.7-t2v(size=1280x720,seconds=4)。能力预检失败会在创建前报错。

  • promptstring必填

    Text description of the video, at least 1 character. Router support (supported): Controls video content; missing or empty values return 400.

    控制视频内容;缺失或空值返回 400。

  • secondsstring | integer可选

    同时提供时优先于 duration。

    已验证 wan2.7-t2v 的时长生效;不合法或超出模型能力的值在预检阶段返回 400。

  • durationinteger可选

    Length of the video in whole seconds. seconds takes precedence when both are given.

  • sizestring可选◐ 部分支持

    Output resolution as WIDTHxHEIGHT, for example 1280x720. Router support (partial): Subject to model capability preflight. Earlier wan2.7-t2v samples always produced 1280x720; accepted sizes are not guaranteed pixel-for-pixel.

    受模型能力预检限制;早期 wan2.7-t2v 样本始终输出 1280x720,不保证所有接受的尺寸都会按像素兑现。

  • input_referencestring | object可选

    Reference image for image-to-video: a URL or base64 data URL, an object with image_url, or an uploaded image file (multipart, at most 20 MiB).

    展开子字段 (1)
    • image_urlstring | object必填

      URL or base64 data URL of the reference image, as a string or an object with url.

  • input_referencesarray可选

    Several reference images; each entry is a URL or base64 data URL, or an object with image_url.

    展开子字段 (1)
    • image_urlstring | object必填

      URL or base64 data URL of the reference image, as a string or an object with url.

  • input_videosarray可选

    Platform extension (the OpenAI videos API has no input video): reference videos as HTTP(S) URLs, or objects with video_url.url. Only models that declare it take them (Doubao Seedance 2.5: up to 10 clips totalling 30 s; 2.0: up to 3 totalling 15 s; mp4 or mov, each 2 s or longer and at most 200 MB); any other model answers 400 input_videos is not supported by this model. They combine with input_references but not with frame_images or input_reference. In the prompt, name them @video1, @video2… and the pictures @image1, @image2… in request order. A clip showing a real human face is refused by the model.

    展开子字段 (1)
    • video_urlobject必填

      The reference video, as an object with url.

  • video_taskany可选

    Platform extension, only with input_videos: reference (default) makes a new video that follows the inputs; edit keeps the first video and changes what the prompt names, with the source's ratio and length (send no seconds or size; source 4 to 30 s).

    取值 referenceedit
  • frame_imagesarray可选

    Images that pin the first and last frame; at most 2 entries.

    展开子字段 (3)
    • typeany可选

      Always image_url. Discriminator of the type-tagged union this object belongs to.

    • frame_typeany必填

      Frame to constrain with the supplied image: first_frame or last_frame. Each frame type may occur at most once.

      取值 first_framelast_frame
    • image_urlobject必填

      The image to pin.

  • 更多参数 (6)
    • resolutionstring可选

      Output resolution label such as 720p, for models that take a label instead of size.

    • aspect_ratiostring可选

      Aspect ratio of the video such as 16:9.

    • generate_audioboolean可选

      Whether the video carries a generated audio track. Router support (supported): false produces no audio track on wan2.7-t2v; the default output includes audio.

      wan2.7-t2v 的 false 输出无音轨,默认输出含音轨。

    • seedinteger可选

      Seed for reproducible generation, on models that support it.

    • callback_urlstring可选

      HTTP or HTTPS callback URL, forwarded to models that support completion callbacks.

    • qualitystring可选

      Provider-specific quality setting.

返回

200

按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。

鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码

请求示例

curl
curl https://api.deepraxis.com/model/v1/videos \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"wan2.7-t2v","prompt":"A cat stretching in the morning sun","seconds":"4","size":"1280x720"}'
Python
import requests

opts = dict(
    base_url="https://api.deepraxis.com/model/v1",
    api_key="$PRAXIS_API_KEY",
)

response = requests.request("POST", f"{opts['base_url']}/videos",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
    json={"model":"wan2.7-t2v","prompt":"A cat stretching in the morning sun","seconds":"4","size":"1280x720"}
)
response.raise_for_status()
print(response.json())
TypeScript
const opts = {
  baseURL: "https://api.deepraxis.com/model/v1",
  apiKey: "$PRAXIS_API_KEY",
};

const response = await fetch(`${opts.baseURL}/videos`, {
  method: "POST",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({"model":"wan2.7-t2v","prompt":"A cat stretching in the morning sun","seconds":"4","size":"1280x720"}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

响应

HTTP 200

Success

application/json

名称 类型 说明
id string Id of the video job; pass it as video_id to retrieve, download or delete it.
object string Object type; always video.
model string Model that generates the video.
status string Lifecycle of the job. Poll until it is completed or failed.
progress integer Progress from 0 to 100. It is 0 until the job completes and 100 once it has.
created_at integer Unix time in seconds at which the job was created.
completed_at integer | null Unix time in seconds at which the job completed; null until then.
expires_at integer | null Unix time in seconds after which the output expires; null because outputs currently have no expiry.
seconds string Length of the video in seconds, as a string; for a completed job it is the delivered length.
size string Resolution of the video as WIDTHxHEIGHT; null when the provider did not report one.
prompt string | null Prompt the job was created with.
remixed_from_video_id null Always null; remix is not supported.
error object | null Why the job failed; null unless status is failed.
error.code string Machine-readable failure code.
error.message string Human-readable failure message.
polling_url string Relative URL to poll for the job state; same as retrieveVideo for this job.
unsigned_urls array<string> Relative URLs of the finished output; empty until the video is ready. Download them with the same API key.
usage object Cost of the job; present once a price applies.
usage.cost number Cost of the job in USD: billed seconds times the per-second price once completed, 0 while running. Billed seconds are the delivered seconds, except for a job with input_videos (see billed_seconds).
usage.billed_seconds integer Only on a completed job with input_videos: the seconds it is billed for. The model meters input plus output seconds at a lower rate, converted here to seconds of the delivered resolution, so it can exceed seconds.

创建、轮询与下载

先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。

典型耗时为 10–15 分钟;以下示例最多轮询 30 分钟,超时后可用同一个任务 ID 继续查询。

终端窗口
# Requires curl and jq. Set PRAXIS_API_KEY and API_BASE (your API origin).
job=$(curl --fail-with-body -sS "$API_BASE/model/v1/videos" \
-H "Authorization: Bearer $PRAXIS_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"wan2.7-t2v","prompt":"A cat stretching in the morning sun","seconds":"4","size":"1280x720"}') || exit 1
VIDEO_ID=$(printf '%s' "$job" | jq -er '.id') || exit 1
for attempt in $(seq 1 360); do
job=$(curl --fail-with-body -sS "$API_BASE/model/v1/videos/$VIDEO_ID" \
-H "Authorization: Bearer $PRAXIS_API_KEY") || exit 1
status=$(printf '%s' "$job" | jq -er '.status') || exit 1
case "$status" in
completed) break ;;
failed) printf '%s\n' "$job"; exit 1 ;;
queued|in_progress) sleep 5 ;;
*) printf 'Unexpected status: %s\n' "$status"; exit 1 ;;
esac
done
[ "$status" = completed ] || { printf 'Still processing; resume polling %s\n' "$VIDEO_ID"; exit 1; }
curl --fail-with-body -sS "$API_BASE/model/v1/videos/$VIDEO_ID/content" \
-H "Authorization: Bearer $PRAXIS_API_KEY" -o video.mp4