Avatar X
整合
模型 id
mirage-api/avatar-x/text-to-video
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/mirage-api/avatar-x/text-to-video?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/mirage-api/avatar-x/text-to-video?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/mirage-api/avatar-x/text-to-video", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/zh-TW/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.ru/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "mirage-api/avatar-x/text-to-video",
"input": {
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
}
透過 Doitong API 呼叫 Avatar X 模型(mirage-api/avatar-x/text-to-video)。代理程式文件:https://doitong.com/zh-TW/developers/models/mirage-api/avatar-x/text-to-video.md
POST https://api.doitong.ru/v1/run/mirage-api/avatar-x/text-to-video?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
如果回應狀態為 "queued" 或 "running",請輪詢 GET https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20,直到狀態變為 "succeeded";檔案位於 outputs[].url。使用相同主體傳送 POST https://api.doitong.ru/v1/quote/mirage-api/avatar-x/text-to-video,可在執行前取得確切價格。
此請求: ≈$54.00 54,000 API 點數 · ≈ ₽5,794.91 在此頁面執行
您的新 API 金鑰。 僅會在此時顯示,且已填入下方的程式碼與 API 金鑰欄位。請妥善保密:切勿將其放入在瀏覽器中執行的程式碼。
建立請求
控制項是根據模型結構描述生成的。變更設定時,程式碼和價格會同步更新。
POST
/run/mirage-api/avatar-x/text-to-video?wait=20
報價 → $54.00
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/mirage-api/avatar-x/text-to-video?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/mirage-api/avatar-x/text-to-video?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/mirage-api/avatar-x/text-to-video", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "mirage-api/avatar-x/text-to-video",
"input": {
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"wait_seconds": 20
}
}
}
關於 Avatar X
將 50 到 1,500 個字元的 `script` 轉換為口說頭像影片,產生的語音上限為 180 秒。可選擇 Jasmine、Luke 或 Maya 等素材 `avatar`,包括 16:9 版本。也可同時提供 `video_reference_url` 與 `audio_reference_url`,使用自己的影片與語音參考;此時會忽略素材頭像。
參數
名稱類型
預設值允許值
說明
script必填
類型string
≤ 1,500 個字元≥ 50 個字元
同時受字元數和生成時長限制的腳本:即使語速使較短的腳本超過限制,語音也不得超過 180 秒。請提供 50 到 1,500 個字元;50 字元的最小值通常會產生約 4 秒的語音。
avatar選填
類型enum
預設值Jasmine
NoneAyeshaAyesha (16:9)FarhanFarhan (16:9)GiuliaGiulia (16:9)JasmineJasmine (16:9)LukeLuke (16:9)MayaMaya (16:9)MichaelMichael (16:9)Neha
另有 5 個
Neha (16:9)TariqTariq (16:9)ValerieValerie (16:9)素材外觀與聲音選項;提供 video_reference_url 和 audio_reference_url 時不需要此選項,因為這些參考會完全取代它。使用 None 維持未設定頭像,或在 [avatar catalog](https://captions.ai/help/docs/api/actor-catalog) 中預覽所有選項後複製完全相同的 Avatar 值。
video_reference_url選填
類型string | null
取代所選頭像且需要 audio_reference_url 的參考影片 URL;影片中嵌入的任何音訊都會被忽略。媒體長度必須為 1 到 120 秒、大小不超過 1 GiB,顯示長寬比須在 9:16 或 16:9 的 5% 範圍內;支援的編解碼器/容器組合為 .mp4、.mov 或 .m4v 中的 H.264、H.265/HEVC 或 ProRes,以及 .webm 中的 VP8 或 VP9。必須透過 HTTPS 公開取得,且無需 Cookie 或授權標頭。
audio_reference_url選填
類型string | null
需要搭配 video_reference_url,且會使所選頭像失效的語音參考 HTTPS URL;必須公開取得,且無需授權標頭或 Cookie。處理時只使用前 60 秒,但檔案長度必須為 10 到 180 秒、大小不超過 64 MiB,並包含 8 到 48 kHz 的單一單聲道或立體聲串流。接受的格式包括 FLAC、MP3、PCM WAV 或 AIFF、AAC 或 ALAC,以及 Opus 或 Vorbis。
必填
輸出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "mirage-api/avatar-x/text-to-video",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 54000,
"usd": "54.00",
"charged": 54000,
"refunded": 0
},
"input": {
"script": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"output": {
"video": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp4",
"content_type": "video/mp4",
"file_name": "0-output.mp4",
"file_size": 1843200
}
},
"outputs": [
{
"type": "video",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp4",
"content_type": "video/mp4",
"file_size": 1843200,
"width": 1280,
"height": 720,
"duration": 5,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
您的檔案,由您選擇每個 outputs[].url 都是儲存空間中的副本:可永久保留(按 GB-月計費),或免費保留 7 天;可透過帳戶設定或 ?storage= 設定。
所有模型使用相同結構圖片、影片和音訊皆包含 type、url、content_type、width、height 和 duration。output 是模型自己的結果物件。
輸出欄位
- video
- object {url, content_type, file_name, file_size}
其他 Mirage Avatar X 變體
更多模型:唇形同步與虛擬角色
給 AI 代理程式:此頁面的 Markdown 位於 https://doitong.com/zh-TW/developers/models/mirage-api/avatar-x/text-to-video.md. 所有模型與指南: https://doitong.com/developers/llms.txt