Przejdź do głównej treści

Endpointy

MetodaEndpointOpis
POST/api/v1/generateTask/seedream-4-5Utwórz zadanie generowania
GET/api/v1/statusTask/seedream-4-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-image",
    "prompt": "...",
    "max_images": 4,
    "resolution": "2K",
    "aspect_ratio": "16:9",
    "sequential_image_generation": "disabled",
    "image_urls": ["..."]
  }
}

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-image — Generate from text description
  • image-to-image — Generate with reference images
Sequential Image Generation:
  • disabled — Generate independent images, no relation between them
  • auto — Model decides whether to generate sequential/related images based on max_images

Przykład

Text-to-Image
curl -X POST "https://api.apixo.ai/api/v1/generateTask/seedream-4-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "value",
    "input": {
      "mode": "text-to-image",
      "prompt": "a cozy cyberpunk cafe with neon lights, ultra detailed",
      "max_images": 4,
      "resolution": "2K",
      "aspect_ratio": "16:9",
      "sequential_image_generation": "disabled"
    }
  }'
Image-to-Image (Multiple References)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/seedream-4-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "official",
    "input": {
      "mode": "image-to-image",
      "prompt": "make this scene look like sunrise with warm colors",
      "max_images": 3,
      "resolution": "4K",
      "aspect_ratio": "3:4",
      "sequential_image_generation": "auto",
      "image_urls": [
        "https://example.com/ref1.jpg",
        "https://example.com/ref2.jpg"
      ]
    }
  }'

Odpowiedź

POST /api/v1/generateTask/seedream-4-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/seedream-4-5

Query task execution status and results via taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/seedream-4-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/img1.png\",\"https://r2.apixo.ai/img2.png\",\"https://r2.apixo.ai/img3.png\",\"https://r2.apixo.ai/img4.png\"]}",
    "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:
    • 2K resolution: ~25-35 seconds
    • 4K resolution: ~40-55 seconds
    • Submit task, wait 20 seconds, then poll every 3 seconds
  • Callback mode: For high-concurrency or high-resolution generation, use callback mode.
  • Image expiration: Result URLs are valid for 15 days. Download and store important outputs promptly.
  • Content moderation: Prompts must comply with content safety guidelines. Violations return CONTENT_VIOLATION.
  • High resolution: Supports up to 4K output, ideal for high-quality printing and professional use.
  • Batch generation: max_images supports 1-10, generate multiple candidates at once, billed per image.
  • Sequential images:
    • disabled: Generate independent images, no relation
    • auto: Intelligently generate sequential images with continuity and coherence
    • Sequential mode is ideal for storyboards, comic panels, etc.
  • Multiple reference fusion:
    • image-to-image mode supports up to 14 reference images
    • Model intelligently combines style, composition, and color
    • More references = richer fusion effects
  • Resolution selection:
    • 2K: Balanced quality and speed, for most scenarios
    • 4K: Highest quality, for professional creation and printing
  • Aspect ratio suggestions:
    • 16:9 / 21:9: Landscape, for banners and desktop wallpapers
    • 9:16: Portrait, for mobile wallpapers and short video covers
    • 1:1: Square, for social media
  • Image formats: image_urls supports JPG, PNG, WebP, max 10MB per image.

Result URLs expire after 15 days. Download and store important outputs promptly. For high-concurrency scenarios, use callback mode to avoid frequent polling.

Powiązane