{"openapi":"3.1.0","info":{"title":"TokTesk Video API","version":"1.0.0","description":"TokTesk 统一视频生成 API。支持 2.0 与 2.5 模型，所有模型每条固定消耗 10 积分。"},"servers":[{"url":"https://toktesk.com"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/catalog":{"get":{"summary":"获取模型目录","security":[],"responses":{"200":{"description":"模型能力列表"}}}},"/v1/pricing":{"get":{"summary":"获取统一计费","security":[],"responses":{"200":{"description":"固定积分价格"}}}},"/v1/balance":{"get":{"summary":"查询积分余额与流水","responses":{"200":{"description":"账户积分"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/files":{"post":{"summary":"上传参考图片","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["image_b64"],"properties":{"image_b64":{"type":"string","description":"PNG、JPEG 或 WebP 的 base64 或 data URL"}},"additionalProperties":false}}},"responses":{"201":{"description":"返回 image_id"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/videos":{"post":{"summary":"创建视频生成任务","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":128},"description":"同一业务请求重试时保持不变"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVideo"}}}},"responses":{"202":{"description":"任务已创建","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoTask"}}}},"200":{"description":"命中幂等请求，返回已存在任务"},"409":{"description":"相同幂等键使用了不同参数"},"429":{"description":"达到每日额度或并发上限"}}}},"/v1/videos/{id}":{"get":{"summary":"查询并刷新任务状态","parameters":[{"$ref":"#/components/parameters/TaskId"}],"responses":{"200":{"description":"任务状态","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoTask"}}}},"404":{"description":"任务不存在"}}}},"/v1/videos/{id}/signed_url":{"get":{"summary":"获取 10 分钟有效的原片下载地址","parameters":[{"$ref":"#/components/parameters/TaskId"}],"responses":{"200":{"description":"限时签名地址"},"409":{"description":"任务尚未完成"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"TokTesk API Key"}},"parameters":{"TaskId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}},"schemas":{"CreateVideo":{"type":"object","required":["prompt","model","duration"],"properties":{"prompt":{"type":"string","maxLength":6000},"model":{"type":"string","enum":["seedance2.0fast","seedance2.0","seedance2.0mini","seedance2.5"]},"duration":{"type":"integer","enum":[5,10,15,30]},"ratio":{"type":"string","enum":["1:1","3:4","4:3","9:16","16:9","21:9"],"default":"9:16"},"resolution":{"type":"string","enum":["720p"],"default":"720p"},"camera_movement":{"type":"string","enum":["auto","fixed"]},"image_ids":{"type":"array","maxItems":30,"items":{"type":"string"}}},"additionalProperties":false},"VideoTask":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"model":{"type":"string"},"model_name":{"type":"string"},"cost_credits":{"type":"integer","const":10},"error":{"type":["object","null"]}}}},"responses":{"Unauthorized":{"description":"API Key 无效或已停用"}}}}}