{"openapi":"3.1.0","info":{"title":"avideoai API","version":"1.0.0","description":"Turn a product photo into a short video ad, paid from your prepaid avideoai credits. Pricing: `hailuo` (Hailuo 2.3): 2 credits, 6s clip; `veo` (Veo 3.1): 4 credits, 8s clip. Credits are refunded automatically if a video fails. Typical render time 1–3 minutes. Docs: https://www.avideoai.com/docs"},"servers":[{"url":"https://www.avideoai.com"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/videos":{"post":{"operationId":"createVideo","summary":"Create a video from a product photo","description":"Downloads image_url, charges credits, and queues the render. Returns immediately with status \"queued\"; poll GET /v1/videos/{id} until status is \"completed\" or \"failed\". At most 3 unfinished videos per key.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Any unique string. Retrying with the same key returns the original video (200, Idempotent-Replayed: true) instead of charging again."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVideoRequest"},"example":{"image_url":"https://cdn.example.com/products/bottle.jpg","prompt":"Slow orbit around the bottle on a marble counter, soft morning light","model":"hailuo"}}}},"responses":{"200":{"description":"Idempotent replay of an earlier request with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedVideo"}}}},"201":{"description":"Queued and charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedVideo"}}}},"400":{"description":"The body or parameters failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"The body or parameters failed validation."}}}}},"401":{"description":"Missing, malformed, unknown or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Missing, malformed, unknown or revoked API key."}}}}},"402":{"description":"Your balance is below the cost of this video. Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"insufficient_credits","message":"Your balance is below the cost of this video. Nothing was charged."}}}}},"422":{"description":"image_url could not be downloaded, or is not a JPEG/PNG under 10MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"image_unreachable","message":"image_url could not be downloaded, or is not a JPEG/PNG under 10MB."}}}}},"429":{"description":"More than 30 requests in a minute on this key. See the Retry-After header. On POST /v1/videos also: This key already has 3 videos queued or processing. Wait for one to finish.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait (rate_limited only)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Something failed on our side. Safe to retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Safe to retry with the same Idempotency-Key."}}}}}}}},"/v1/videos/{id}":{"get":{"operationId":"getVideo","summary":"Get a video’s status","description":"Poll every 5–10 seconds. When status is \"completed\", video_url is a signed MP4 link valid for one hour — call again for a fresh one.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The video.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Video"}}}},"401":{"description":"Missing, malformed, unknown or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Missing, malformed, unknown or revoked API key."}}}}},"404":{"description":"No such video on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"No such video on your account."}}}}},"429":{"description":"More than 30 requests in a minute on this key. See the Retry-After header. On POST /v1/videos also: This key already has 3 videos queued or processing. Wait for one to finish.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait (rate_limited only)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Something failed on our side. Safe to retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Safe to retry with the same Idempotency-Key."}}}}}}}},"/v1/credits":{"get":{"operationId":"getCredits","summary":"Get your credit balance","responses":{"200":{"description":"Current prepaid balance.","content":{"application/json":{"schema":{"type":"object","required":["balance"],"properties":{"balance":{"type":"integer","minimum":0}}}}}},"401":{"description":"Missing, malformed, unknown or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Missing, malformed, unknown or revoked API key."}}}}},"429":{"description":"More than 30 requests in a minute on this key. See the Retry-After header. On POST /v1/videos also: This key already has 3 videos queued or processing. Wait for one to finish.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait (rate_limited only)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Something failed on our side. Safe to retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Safe to retry with the same Idempotency-Key."}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key from /account, e.g. \"avk_live_…\". 30 requests/minute per key."}},"schemas":{"CreateVideoRequest":{"type":"object","required":["image_url","prompt"],"properties":{"image_url":{"type":"string","format":"uri","description":"Public https URL of a JPEG or PNG product photo, at most 10MB."},"prompt":{"type":"string","maxLength":1000,"description":"The motion and scene you want."},"model":{"type":"string","enum":["hailuo","veo"],"default":"hailuo","description":"`hailuo` (Hailuo 2.3): 2 credits, 6s clip; `veo` (Veo 3.1): 4 credits, 8s clip"},"duration":{"type":"integer","description":"Optional. Each model renders one fixed length (hailuo: 6, veo: 8); any other value is rejected with 400."}}},"CreatedVideo":{"type":"object","required":["id","status","credits_charged"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"$ref":"#/components/schemas/VideoStatus"},"credits_charged":{"type":"integer"}}},"Video":{"type":"object","required":["id","status","model","credits_charged","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"$ref":"#/components/schemas/VideoStatus"},"model":{"type":["string","null"],"enum":["hailuo","veo",null]},"credits_charged":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"video_url":{"type":"string","format":"uri","description":"Present when completed. Expires in one hour."},"video_url_expires_at":{"type":"string","format":"date-time"},"error":{"type":"string","description":"Present when failed or expired."},"refunded":{"type":"boolean","description":"Present when failed: whether the credits are back on your balance."}}},"VideoStatus":{"type":"string","enum":["queued","processing","completed","failed","expired"]},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthorized","invalid_request","insufficient_credits","not_found","image_unreachable","rate_limited","concurrency_limit","internal_error"]},"message":{"type":"string"}}}}}}}}