Przejdź do głównej treści

Endpointy

MetodaEndpointOpis
POST/api/v1/generateTask/wan-2-5Utwórz zadanie generowania
GET/api/v1/statusTask/wan-2-5Sprawdź status zadania

Uwierzytelnianie

Wszystkie żądania wymagają klucza API w nagłówku:
Authorization: Bearer YOUR_API_KEY

Treść żądania

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-video",
    "prompt": "...",
    "resolution": "1080p",
    "duration": 10,
    "aspect_ratio": "16:9",
    "image_urls": ["..."],
    "negative_prompt": "...",
    "seed": 12345,
    "enable_prompt_expansion": true
  }
}

Parametry

request_type
string
domyślnie:"async"
async (polling) or callback (webhook)
callback_url
string
Callback URL, required when request_type=callback (conditional)
provider
string
domyślnie:"auto"
Routing strategy: auto, value, or official
input
object
wymagane
Model input parameters
Mode Options:
  • text-to-video — Generate video from text
  • image-to-video — Generate video from image

Przykład

Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "value",
    "input": {
      "mode": "text-to-video",
      "prompt": "a serene mountain landscape with moving clouds and gentle breeze",
      "resolution": "1080p",
      "duration": 10,
      "aspect_ratio": "16:9",
      "negative_prompt": "low quality, blurry",
      "enable_prompt_expansion": true
    }
  }'
Image-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "provider": "official",
    "input": {
      "mode": "image-to-video",
      "prompt": "make this picture into a smooth cinematic shot with camera slowly zooming in",
      "resolution": "720p",
      "duration": 5,
      "image_urls": ["https://example.com/ref.jpg"],
      "enable_prompt_expansion": false,
      "seed": 42
    }
  }'

Odpowiedź

POST /api/v1/generateTask/wan-2-5

Returns taskId on success for subsequent status queries. Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Error:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/wan-2-5

Query task execution status and results via taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/wan-2-5?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
Failed:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

Pola odpowiedzi statusu

taskId
string
Unique task identifier.
state
string
Current task state: pending, processing, success, or failed.
resultJson
string
JSON string containing resultUrls array. Only present on success. Parse with JSON.parse().
failCode
string
Error code. Only present when state is failed. See Kody błędów.
failMsg
string
Human-readable error message. Only present when state is failed.
createTime
integer
Task creation timestamp (Unix milliseconds).
completeTime
integer
Task completion timestamp (Unix milliseconds).
costTime
integer
Processing duration in milliseconds.

Kody błędów

CodeDescription
400Invalid parameters or request error
401Invalid or missing API Key
429Rate limit exceeded
Fail CodeDescription
CONTENT_VIOLATIONContent violates safety guidelines
INVALID_IMAGE_URLCannot access provided image URL

Limity rate

LimitValue
Requests10000 / minute
Concurrent tasks1000
Exceeding limits returns 429 error. Wait and retry.

Wskazówki

  • Generation time:
    • 720p resolution: ~50-70 seconds
    • 1080p resolution: ~70-90 seconds
    • Submit task, wait 50 seconds, then poll every 5 seconds
  • Callback mode: Recommend using callback mode to avoid frequent polling.
  • Video expiration: Result URLs are valid for 15 days. Download promptly.
  • Content moderation: Prompts must comply with content safety guidelines.
  • High resolution support:
    • 720p: Fast generation, for previews and social media
    • 1080p: HD output, for professional publishing and high-quality content
  • Prompt expansion:
    • enable_prompt_expansion: true (default): System auto-optimizes and expands prompt with more details
    • enable_prompt_expansion: false: Strictly uses original prompt, for precise control
    • Short prompts benefit from expansion; detailed prompts can disable it
  • Aspect ratio selection:
    • 16:9: Landscape (default), for traditional video platforms
    • 9:16: Portrait, for short video platforms and mobile viewing
    • 1:1: Square, for social media
  • Negative prompt:
    • Use negative_prompt to avoid blur, low quality, jitter, and other unwanted effects
    • Example: “low quality, blurry, shaky, distorted”
    • Helps improve video stability and clarity
  • Seed reproduction:
    • Same seed + prompt + parameters reproduces identical results
    • Ideal for consistent batch generation or iterative refinement
  • Image-to-video:
    • Reference image becomes video start frame
    • Describe desired animation effects and camera movement in prompt
    • Ideal for bringing still images to life, character animation, scene expansion
  • Prompt tips:
    • Describe specific scenes and actions (e.g., “clouds drifting over mountains”, “slow dolly in”)
    • Describe dynamic elements (e.g., “swaying leaves”, “flowing water”, “flying birds”)
    • Describe camera movement (e.g., “slow push in”, “orbiting shot”, “wide to close”)
    • Be specific; concrete descriptions work better than abstract ones
  • Duration selection:
    • 5 seconds: Quick previews, short clips, loop animations
    • 10 seconds: More narrative space, complete scene showcases
  • Image formats: image_urls supports JPG, PNG, WebP, max 10MB per image.
  • Best practices:
    • Use clear, specific prompts
    • Enable prompt expansion for richer details
    • Use negative prompt to avoid common issues
    • 720p for quick iteration, 1080p for final output

Video generation takes longer than images — use callback mode for production workloads. Result URLs expire after 15 days; download important outputs promptly.

Powiązane