Tài liệu API · API tương thích Volcano Ark V3
API tương thích Volcano Ark
Mã viết cho Volcano Ark chỉ cần đổi địa chỉ và Key: tác vụ video, thư viện tài nguyên, xác minh người thật.
If your code or platform is already written for Volcano Ark, you can switch to this platform by changing only the URL and key: requests and responses have the same shape as Ark, and routing and billing behind them are the same as the /v1 API. For new integrations we recommend /v1.
Endpoints and authentication
| Use | This platform | Authentication |
|---|---|---|
| Video tasks (data plane) | https://api.aitoken.tools/api/v3 | Authorization: Bearer <API Key> |
| Asset library, real-person verification (control plane) | https://api.aitoken.tools/?Action=…&Version=2024-01-01 (in an SDK set host api.aitoken.tools, region ap-southeast-1, service ark) | AccessKey with Volcano V4 signing: the AccessKeyId (AKAT…) is shown on the console API Keys page and the SecretAccessKey is the API key itself; a Bearer API key also works |
Migrating from the official service takes three changes: base URL / host, credentials, and re-importing existing assets once (asset IDs from the asset library of your own Volcano account cannot be used here).
Video tasks
| Ark endpoint | Notes |
|---|---|
POST /api/v3/contents/generations/tasks | Create; returns { "id": "task_…" } |
GET /api/v3/contents/generations/tasks/{id} | Get; returns the Ark task shape plus an aitoken field (amount charged, model used) |
GET /api/v3/contents/generations/tasks | List: page_num, page_size (≤ 500, default 10), filter.status, filter.task_ids, filter.model |
DELETE /api/v3/contents/generations/tasks/{id} | Cancelling or deleting is not supported yet |
model: a model name from this platform or an official model ID (e.g. dreamina-seedance-2-0-260128); inference endpoints (ep-…) are not supported.content: image, video and audio url can be an http(s) link (imported on the spot, reused for the same link, filed in an auto-import group), data:…;base64,… (images ≤ 30 MB, audio ≤ 15 MB, video ≤ 10 MB; whole request body ≤ 64 MiB), or asset://asset_… (an asset on this platform). Images without a role: one image is the first frame, two are first + last frame; with more, set role on each.- Defaults match Ark: resolution 720p, duration 5; ratio is adaptive with image input, otherwise 16:9. Model parameters such as watermark, seed and generate_audio pass through; unsupported ones return 400.
- Ark has no idempotency key: send an Idempotency-Key header to deduplicate; after a network timeout, query first instead of resending. callback_url receives the Ark task shape.
Asset library
Supported actions (parameters and result fields follow the Ark asset library; IDs use this platform's format):
CreateAssetGroup GetAssetGroup ListAssetGroups UpdateAssetGroup DeleteAssetGroup CreateAsset GetAsset ListAssets UpdateAsset DeleteAsset
GroupType follows Ark: ordinary groups are AIGC and real-person groups are LivenessFace (previously returned as RealPerson; update any code that checks for that value). CreateAssetGroup only accepts GroupType=AIGC (optional); other values return 400, and real-person groups are created with CreateVisualValidateSession. ListAssetGroups supports Filter.GroupType (AIGC / LivenessFace; other values return 400) and Filter.GroupIds.
Using assets
CreateAssetcreates an asset from a URL. The returnedResult.Id(asset_…) is the asset ID used for queries and references; Name is only a label, not an ID. Import is asynchronous, but the Id is returned as soon as creation is accepted.POST /?Action=CreateAsset&Version=2024-01-01 { "GroupId": "grp_xxx", "URL": "https://example.com/role-a.png", "AssetType": "Image", "Name": "role-a" }{ "ResponseMetadata": { "RequestId": "req_xxx", "Action": "CreateAsset", … }, "Result": { "Id": "asset_xxx" } }- Poll
GetAsset: the asset is usable onceStatusis Active; keep polling while Processing (usually a few seconds); on Failed see FailReason.POST /?Action=GetAsset&Version=2024-01-01 { "Id": "asset_xxx" }{ "ResponseMetadata": { … }, "Result": { "Id": "asset_xxx", "Name": "role-a", "Status": "Active", "AssetType": "Image", "GroupId": "grp_xxx", "URL": "https://…" } } - Reference it in content[] as
asset://<Result.Id>(set role to first_frame / last_frame / reference_image as needed):{ "type": "image_url", "image_url": { "url": "asset://asset_xxx" }, "role": "reference_image" }
If you don't want to manage the asset library, you can also pass an http(s) image link directly in content[]; it is imported on the spot (see above).
Real-person verification
CreateVisualValidateSession: returns H5Link, BytedToken (this platform's verification ID, auth_…) and GroupId (a new real-person group for this verification). Optional Model picks the model; otherwise one of your enabled models is chosen. Optional CallbackURL (an absolute http or https URL without credentials, at most 2048 characters) is the page to return to when the check is done.- Send H5Link to the person for the face check (valid for 30 minutes). Afterwards the browser is redirected to your CallbackURL with two query parameters: bytedToken (this platform's verification ID auth_…, the same value CreateVisualValidateSession returned as BytedToken) and resultCode (the upstream result code, 10000 means passed; may be absent). On that redirect, call GetVisualValidateResult with this bytedToken to confirm the result rather than trusting resultCode alone; the result may not be ready when the redirect arrives, so while it returns Processing keep polling at intervals of 5 seconds or more until Success or Failed (some routes take a few minutes). A few routes do not return to the CallbackURL after the face check, so keep polling as a fallback even when you pass one. Without a CallbackURL the page stays on this site's notice page; poll GetVisualValidateResult.
GetVisualValidateResult: Status Success returns the GroupId; Processing means not finished yet.- Add the person's photos to that GroupId with CreateAsset: they are treated as real-person assets and usable in tasks once active. Adding assets before verification passes is rejected.
Differences from the official service
- Task, asset, group and verification IDs use this platform's format (task_…, asset_…, grp_…, auth_…); don't rely on Volcano ID prefixes.
- Error codes are this platform's (see Error codes), inside the Ark error shape; parameter errors return 400.
- Only models listed on this platform and enabled for you are available. Other Ark APIs (chat, images) are not included; for chat use /v1/chat/completions.
- Economy models are not offered on the Ark-compatible API (they are treated as unknown models); use /v1/videos/generations.
# Tạo tác vụ video: thân yêu cầu giống Volcano Ark, chỉ đổi địa chỉ và Key
curl https://api.aitoken.tools/api/v3/contents/generations/tasks \
-H "Authorization: Bearer $AITOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-260128",
"content": [
{ "type": "text", "text": "Máy quay từ từ tiến vào thị trấn núi trong sương sớm" },
{ "type": "image_url", "image_url": { "url": "https://example.com/first.png" }, "role": "first_frame" }
],
"ratio": "adaptive",
"duration": 5
}'
# Truy vấn tác vụ (cấu trúc tác vụ Ark)
curl https://api.aitoken.tools/api/v3/contents/generations/tasks/task_xxx \
-H "Authorization: Bearer $AITOKEN_API_KEY"
# Thư viện tài nguyên: tạo tài nguyên từ URL. Cũng có thể ký bằng AccessKey (Volcano V4)
curl "https://api.aitoken.tools/?Action=CreateAsset&Version=2024-01-01" \
-H "Authorization: Bearer $AITOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"GroupId":"grp_xxx","URL":"https://example.com/role-a.png","AssetType":"Image","Name":"role-a"}'
# Phản hồi: ID tài nguyên nằm ở Result.Id (Name chỉ là tên, không phải ID)
# {"ResponseMetadata":{"RequestId":"req_xxx","Action":"CreateAsset",…},"Result":{"Id":"asset_xxx"}}
# Kiểm tra trạng thái: dùng được khi Status là Active (Processing thì chờ tiếp, Failed xem FailReason)
curl "https://api.aitoken.tools/?Action=GetAsset&Version=2024-01-01" \
-H "Authorization: Bearer $AITOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"Id":"asset_xxx"}'
# {"ResponseMetadata":{…},"Result":{"Id":"asset_xxx","Name":"role-a","Status":"Active","AssetType":"Image","GroupId":"grp_xxx",…}}
# Khi tạo video, tham chiếu tài nguyên bằng asset://<Result.Id>
curl https://api.aitoken.tools/api/v3/contents/generations/tasks \
-H "Authorization: Bearer $AITOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-260128",
"content": [
{ "type": "text", "text": "Máy quay từ từ tiến vào thị trấn núi trong sương sớm" },
{ "type": "image_url", "image_url": { "url": "asset://asset_xxx" }, "role": "reference_image" }
]
}'