Skip to main content
Generate high-quality AI images and videos with a single HTTP request. This API uses the same generation engine as SeedHorse Studio and is available for developers to call programmatically.

Capability Overview

Image Generation (Imagen Nano Banana Pro/2)
  • Text-to-Image — Generate images by inputting text prompts
  • Image-Text-to-Image — Generate images with reference images + text prompts
Video Generation (Seedance 2.0)
  • Image-Text-to-Video — Generate videos with reference images + text prompts
  • Image-Video-Text-to-Video — Generate videos with reference images + reference videos + text prompts
  • Image-Audio-Text-to-Video — Generate videos with reference images + reference audio + text prompts
  • Full-Modality-to-Video — Generate videos with reference images + reference videos + reference audio + text prompts

Available Models

ModelTypeSupported Generation Methods (type)
Imagen Nano Banana 2Imagetxt, img_txt
Seedance 2.0Videoimg_txt, img_vid_txt, img_aud_txt, img_vid_aud_txt

Base URL

All requests are sent to:
https://api.seedhorse.ai
The API path prefix is /api/v1.

Authentication

Each request must carry a Bearer Token in the Authorization request header:
Authorization: Bearer sh-xxxxxxxxxxxxxxxxxx

API Documentation

Submit Generation Task

POST /api/v1/task/generate
Submit a generation task and return a task ID immediately; the generation process runs asynchronously.

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer sh-xxxxx
Content-TypeYesapplication/json
X-Idempotency-KeyNoIdempotency key to prevent duplicate submissions

Request Body Parameters

FieldTypeRequiredDescription
modelstringYesModel name (Seedance 2.0 or Imagen Nano Banana 2)
taskNamestringYesTask name
typestringYesGeneration method (see Available Models)
promptstringYesText prompt describing the content to be generated
resolutionstringNoVideo resolution: 720p (video only)
durationSecondsintegerNoVideo duration (seconds), 4–15 (video only)
aspectRatiostringNoAspect ratio: 16:9, 9:16 (image only)
imageCountintegerNoNumber of images to generate, max 4 (image only)
sizestringNoImage size: 1K, 2K, 4K (image only)
qualityintegerNoGeneration quality, 50–100
seedlongNoRandom seed; -1 means random
generateAudiobooleanNoWhether to auto-generate audio (video only, default true)
refImageUrlsstring[]NoList of reference image URLs (max 5)
refVideoUrlsstring[]NoList of reference video URLs (max 5, video only)
refAudioUrlsstring[]NoList of reference audio URLs (max 5, video only)

Successful Response

{
    "code": 0,
    "data": {
        "estimatedCredits": 5,
        "taskId": 9034,
        "taskNo": "3b248921b9be429b8303838118f3cd7f"
    },
    "msg": "success",
    "ok": true
}
FieldTypeDescription
data.taskIdlongTask ID for polling progress
data.taskNostringBusiness task number, globally unique
data.estimatedCreditslongPre-deducted credits for this task

Query Task Status

GET /api/v1/query/{taskId}
Query the current status and generation results of a specified task.

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer sh-xxxxx

Successful Response

{
    "code": 0,
    "data": {
        "aspectRatio": "",
        "createTime": "2026-04-22T11:01:32",
        "durationSeconds": 0,
        "failReason": "",
        "genMethod": "img_txt",
        "generateAudio": true,
        "imageCount": 1,
        "modelId": 4,
        "negativePrompt": null,
        "progress": 100,
        "prompt": "A grey kitten",
        "quality": 80,
        "refAudioUrls": [],
        "refImageUrls": [],
        "refVideoUrls": [],
        "resolution": "720p",
        "results": [
            {
                "durationSeconds": 5,
                "failReason": "",
                "fileUrl": "https://tk-hub.oss-ap-northeast-1.aliyuncs.com/tasks/files/.../task_xxx.mp4?...",
                "height": 0,
                "subStatus": 0,
                "thumbnailUrl": null,
                "width": 0
            }
        ],
        "seed": -1,
        "size": "",
        "subTaskDone": 0,
        "subTaskTotal": 0,
        "taskId": 9055,
        "taskName": "Image-Text Video Generation",
        "taskStatus": 2,
        "taskType": 1
    },
    "msg": "success",
    "ok": true
}

Response Field Description

FieldTypeDescription
data.taskIdlongTask ID
data.taskNamestringTask name
data.taskStatusintTask status (0=Queuing 1=Generating 2=Completed 3=Failed 4=Under safety review 5=Cancelled)
data.taskTypeintTask type (1=Video 2=Image)
data.progressintProgress percentage (0–100)
data.modelIdlongID of the used model
data.genMethodstringGeneration method (e.g. img_txt, txt)
data.promptstringPositive prompt
data.negativePromptstringNegative prompt (nullable)
data.resolutionstringResolution (video task)
data.durationSecondsintVideo duration (seconds)
data.aspectRatiostringAspect ratio
data.imageCountintNumber of generated images
data.sizestringImage size
data.qualityintGeneration quality (50–100)
data.seedlongRandom seed (-1=Not specified)
data.generateAudiobooleanWhether to auto-generate audio
data.refImageUrlsstring[]List of reference image URLs
data.refVideoUrlsstring[]List of reference video URLs
data.refAudioUrlsstring[]List of reference audio URLs
data.failReasonstringFailure reason (populated on failure)
data.subTaskTotalintTotal subtasks (valid for multi-image tasks)
data.subTaskDoneintCompleted subtasks
data.createTimestringCreation time
data.resultsarrayGeneration result list (populated when completed)
data.results[].fileUrlstringResult file URL
data.results[].thumbnailUrlstringThumbnail URL
data.results[].durationSecondsintVideo duration (seconds)
data.results[].widthintWidth (pixels)
data.results[].heightintHeight (pixels)
data.results[].subStatusintSubtask status (0=Pending 1=Success 2=Failed)
data.results[].failReasonstringSubtask failure reason
It is recommended to poll every 5–10 seconds until taskStatus becomes 2 (Completed) or 3 (Failed).

Quick Start

1. Submit Task

curl -X POST https://api.seedhorse.ai/api/v1/task/generate \
  -H "Authorization: Bearer sh-xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Seedance 2.0",
    "taskName": "My First Video",
    "type": "img_txt",
    "prompt": "A cinematic tracking shot through a neon-lit rainy street at night",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspectRatio": "16:9",
    "generateAudio": true
  }'

2. Poll Status

curl https://api.seedhorse.ai/api/v1/query/9034 \
  -H "Authorization: Bearer sh-xxxxx"

3. Get Results

When taskStatus is 2, the results array contains the URLs of the generated files. Please download and save them to your own storage as soon as possible.

Request Examples

Image Generation

Text-to-Image (txt)

{
    "model": "Imagen Nano Banana 2",
    "taskName": "Image Generation Test",
    "type": "txt",
    "prompt": "a cute orange cat sitting on a windowsill, warm sunlight, studio ghibli style",
    "aspectRatio": "9:16",
    "imageCount": 1,
    "size": "4k"
}

Image-Text-to-Image (img_txt)

{
    "model": "Imagen Nano Banana 2",
    "taskName": "Image-Text Generation Test",
    "type": "img_txt",
    "prompt": "Generate a blue kitten",
    "aspectRatio": "9:16",
    "refImageUrls": ["https://example.com/reference.jpg"],
    "imageCount": 1,
    "size": "4k"
}

Video Generation

Image-Text-to-Video (img_txt)

{
    "model": "Seedance 2.0",
    "taskName": "Image-Text Video Generation",
    "type": "img_txt",
    "prompt": "A grey kitten playing in the garden",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspectRatio": "16:9",
    "generateAudio": true,
    "refImageUrls": ["https://example.com/cat.jpg"]
}

Image-Video-Text-to-Video (img_vid_txt)

{
    "model": "Seedance 2.0",
    "taskName": "Image-Video-Text Video Generation",
    "type": "img_vid_txt",
    "prompt": "A grey kitten",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspectRatio": "16:9",
    "generateAudio": true,
    "refImageUrls": ["https://example.com/cat.jpg"],
    "refVideoUrls": ["https://example.com/reference.mp4"]
}

Image-Audio-Text-to-Video (img_aud_txt)

{
    "model": "Seedance 2.0",
    "taskName": "Image-Audio-Text Video Generation",
    "type": "img_aud_txt",
    "prompt": "A grey kitten",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspectRatio": "16:9",
    "generateAudio": true,
    "refImageUrls": ["https://example.com/cat.jpg"],
    "refAudioUrls": ["https://example.com/music.mp3"]
}

Full-Modality-to-Video (img_vid_aud_txt)

{
    "model": "Seedance 2.0",
    "taskName": "Full-Modality Video Generation",
    "type": "img_vid_aud_txt",
    "prompt": "A grey kitten",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspectRatio": "16:9",
    "generateAudio": true,
    "refImageUrls": ["https://example.com/cat.jpg"],
    "refVideoUrls": ["https://example.com/reference.mp4"],
    "refAudioUrls": ["https://example.com/music.mp3"]
}

Error Codes

Unified response format:
{
    "code": 40003,
    "msg": "Seedance 2.0 model does not exist",
    "ok": false,
    "data": null
}

System Errors (1xxxx)

Error CodeDescription
10001System busy
10006Failed to acquire lock

Authentication/Authorization (2xxxx)

Error CodeDescription
20001Not logged in or login expired
20002No access permission
20003No permission to operate this task
20008Invalid API Key

Parameter Validation (3xxxx)

Error CodeDescription
30001Invalid parameters (missing required fields or wrong parameter format)

Resource Not Found (4xxxx)

Error CodeDescription
40002Task does not exist
40003Model does not exist or has been offline

Business Rules (5xxxx)

Error CodeDescription
50001Model disabled
50002Channel unavailable
50003Generation method not supported
50006Resolution not supported
50007Duration not supported
50008Image size not supported
50009Aspect ratio not supported
50010Invalid image count
50011Reference image required
50014Reference content failed safety review
50015Reference content blocked

Credit Billing (6xxxx)

Error CodeDescription
60001Insufficient credits
60002Billing lock busy, please retry