Tools API
Video cleanup, storyboard prompts, and text to speech using your API key.
Use https://aihub-admin.aimix.pro/api-platform/v1 with Authorization: Bearer YOUR_API_KEY. Video tools require the key's video permission; TTS requires audio permission. Existing unrestricted keys work without an extra permission setting. Website credits and API credits are separate.
| Tool | Create | Query | Usage unit |
|---|---|---|---|
| Subtitle / watermark removal | POST /video/remove-subtitles or /video/remove-watermark | Returned statusUrl | 30 seconds, rounded up |
| Video to prompts | POST /video-to-prompt | GET /tasks/{taskId} | 30 seconds, rounded up |
| Speech synthesis | POST /tts/synthesize | Synchronous result | 100 characters, rounded up |
GET /tools returns tool limits, cleanupAvailability, and ttsAvailability. Choose an available engine or provider. Availability reflects server configuration rather than live provider health; unconfigured services return 503.
The JSON envelope is {code:1000,message,data} on success. Check both HTTP status and code. Common errors are 400 (input), 401 (key), 402 (API balance), 403 (permissions), 409 (idempotency conflict), 429 (limit), and 503 (missing service configuration).
For cleanup and TTS, send an optional Idempotency-Key (1–128 printable characters). The same owner, endpoint, key and parameters return the completed response for 24 hours. Different parameters or an incomplete/uncertain attempt return 409. Do not automatically retry a paid POST with a new key after a lost response. Video-to-prompt retains its existing submission behavior and does not support this new deduplication header.
For local video files, use temporary media uploads, PUT the file to the returned upload URL, and use fileUrl as videoUrl. Cleanup binds the source to the task; the existing media cleanup job handles terminal tasks and expired unused uploads.
Poll the returned path every 5–10 seconds until ready or failed. Cleanup task IDs are public avatar task IDs, mapped to the common task internally. They are scoped to the API key's user, application and tenant. Polling does not submit or bill a second job. Stop polling locally without cancelling the server task; resume using the same task ID.
// After checking the create response, poll the exact statusUrl on this origin.
const origin = "https://aihub-admin.aimix.pro";
const url = new URL(created.data.statusUrl, origin);
if (url.origin !== origin) throw new Error("Invalid status URL");
for (let attempt = 0; attempt < 1440; attempt++) {
const response = await fetch(url, {headers: {Authorization: `Bearer ${process.env.PIXMIND_API_KEY}`}});
const result = await response.json();
if (!response.ok || result.code !== 1000) throw new Error(result.message);
if (result.data.status === "failed") throw new Error(result.data.error?.message);
if (result.data.status === "ready") { console.log(result.data); break; }
if (attempt === 1439) throw new Error("Polling timed out; retain the original task ID");
await new Promise(resolve => setTimeout(resolve, 5000));
}import os, time, requests
headers = {"Authorization": "Bearer " + os.environ["PIXMIND_API_KEY"]}
url = "https://aihub-admin.aimix.pro/api-platform/v1/video/cleanup/tasks/123"
for _ in range(1440):
response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
result = response.json()
if result["code"] != 1000: raise RuntimeError(result["message"])
task = result["data"]
if task["status"] == "failed": raise RuntimeError(task["error"]["message"])
if task["status"] == "ready":
print(task)
break
time.sleep(5)
else:
raise TimeoutError("Polling timed out; retain the original task ID")