Async Inference (V2)

Submit inference requests asynchronously and poll for results. Ideal for long-running models like video generation, image upscaling, and LLMs.

The V2 async API lets you submit a request, get a request_id immediately, and poll for the result when it's ready. No long-lived HTTP connections needed.

Quick Start

1. Submit a request

curl -X POST "https://api.segmind.com/v2/seedream-4.5" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a red rose on a wooden table, studio lighting",
    "aspect_ratio": "1:1",
    "seed": 123
  }'

Response:

{
  "request_id": "2c7f59ea-13f1-402c-9353-915a2b5a2124",
  "status": "QUEUED",
  "poll_url": "https://api.segmind.com/v1/requests/2c7f59ea-...",
  "status_url": "https://api.segmind.com/v2/requests/2c7f59ea-.../status",
  "response_url": "https://api.segmind.com/v2/requests/2c7f59ea-..."
}
Field
Description

request_id

Unique identifier for this request

status

Always QUEUED on submit

poll_url

V1 poll endpoint (backward compatible)

status_url

Lightweight status check (no output payload)

response_url

Full result endpoint (output + metadata)

2. Check status (lightweight)

Use status_url for efficient polling — it returns only status and metrics, no output payload.

While processing:

When done:

3. Fetch the result

Once status is COMPLETED, fetch the full result from response_url.

Image result:

Response Formats by Modality

The result shape depends on what the model produces.

Image models

Video models

LLM / text models

The output field is always present across all modalities for backward compatibility.

Status Values

Status
Description

QUEUED

Request accepted, waiting for a worker

PROCESSING

A worker has picked up the request

COMPLETED

Inference finished, result available

FAILED

Inference failed (see error field)

Result Expiry

Request status and results are stored for 1 hour after submission. After that, the status key expires and polling any endpoint will return HTTP 404. Make sure to fetch your results within this window.

Error Handling

Failed requests return HTTP 422 on V2 endpoints:

Not found returns HTTP 404:

Endpoints Summary

Endpoint
Method
Description

/v2/{model}

POST

Submit async request

/v2/requests/{id}/status

GET

Lightweight status + metrics

/v2/requests/{id}

GET

Full result (when COMPLETED)

/v1/requests/{id}

GET

Legacy poll (status + output combined)

Python Example

Last updated