Call text-to-video, image-to-video, reference-to-video, and video-editing models through HappyHorse's native asynchronous task interface, and select the precise model ID for the task.
https://api.tokensmarket.aiPOST /api/v1/services/aigc/video-generation/video-synthesisThe endpoint remains fixed. Use the parameter documentation on this page to replace the model ID and request data.
${base_url}/api/v1/services/aigc/video-generation/video-synthesis${base_url}/api/v1/tasks/{task_id}All media generation requests are authenticated through the Token Market gateway. JSON requests use application/json; multipart requests are automatically generated by the client Content-Type boundary.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
Authorization | string | Yes | — | Append the current workspace API Key after Bearer. Options / constraints: Bearer <API_KEY>. |
Content-Type | string | Yes | application/json | Send the request body as JSON. |
HappyHorse uses a native asynchronous task API. Put source content in input and generation settings in parameters. Check the current model details page for required media fields and limits for each of the four task types.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | The exact model ID to call in this family. Options / constraints: Use only a model ID currently available in Model Market. |
input | object | Yes | — | Task input object. Text, image, reference or edit video fields are passed in as per the current capabilities of the selected model. |
input.prompt | string | No | — | Text generation or editing instructions. |
input.negative_prompt | string | No | — | Visual content or elements that the request must avoid. |
input.audio_url | string | No | — | Audio input URL when supported by the selected model. |
input.media[] | array | No | — | Supplementary media array for reference-image or video-editing tasks. Options / constraints: Use a media object supported by the current model for each item. |
input.media[].type | string | No | — | Type of media item. |
input.media[].url | string | No | — | Accessible URL for the media item. |
input.media[].reference_voice | string | No | — | Reference voice when supported by the selected model. |
parameters | object | No | — | Task parameter object, such as the duration, aspect ratio, or other generation settings supported by the current model. Options / constraints: Do not copy unconfirmed fields from one task schema to another schema. |
parameters.resolution | string | No | — | Output resolution when supported by the current model. |
parameters.ratio | string | No | — | Aspect ratio when supported by the current model. |
parameters.duration | integer | No | — | Target duration when supported by the current model. |
parameters.watermark | boolean | No | — | Watermark setting when supported by the current model. |
parameters.seed | integer | No | — | Random seed when supported by the current model. |
parameters.audio_setting | object | No | — | Audio settings when supported by the current model. |
parameters.prompt_extend | boolean | No | — | Whether to extend the prompt when supported by the current model. |
extra_body.provider | object | No | — | Limit or sort candidate provider channels. Options / constraints: Use fields such as only, ignore, order, and sort according to the unified routing rules. |
The create endpoint first returns task information. Use the task ID to query status until the task reaches a terminal state.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
output.task_id | string | No | — | The video generation task ID, used as task_id in the query path. |
output.task_status | string | No | — | Task final state, identification is not case-sensitive. Options / constraints: succeeded, failed, canceled, or unknown. The docs do not list unconfirmed in-progress states. |
output | object | No | — | The result object returned after the task succeeds. |
output.video_url / output.output_video_url | string | No | — | A temporary URL for the generated video. Options / constraints: Download and copy the asset to your own storage within the validity period shown in the response. |
code | string | No | — | Top-level error code. |
message | string | No | — | Top-level error message. |
metadata | object | No | — | Top-level error metadata. |
output.code | string | No | — | Error code inside output. |
output.message | string | No | — | Error message inside output. |
output.metadata | object | No | — | Error metadata inside output. |
request_id | string | No | — | Request tracing ID. |
submit_time | string | No | — | Task submission time. |
scheduled_time | string | No | — | Task scheduling time. |
end_time | string | No | — | Task end time. |
orig_prompt | string | No | — | Original prompt used for the task. |
usage.duration | number | No | — | Generated duration usage. |
usage.input_video_duration | number | No | — | Input video duration usage. |
usage.output_video_duration | number | No | — | Output video duration usage. |
usage.SR | string | No | — | Output sample rate. |
usage.ratio | string | No | — | Output aspect ratio. |
The following fields are HTTP response headers, not JSON or SSE response body fields.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
X-Client-Request-Id | string | No | — | Echoed when supplied by the caller; not generated automatically when omitted. |
X-Upstream-Request-Id | string | No | — | Usually used for gateway request tracing; it is not the provider's original request ID. |
Choose the request structure required by the selected model; changing only the prompt is not sufficient.
Required fields for image or video input, URL/Base64 forms, file-size limits, resolution, and aspect-ratio limits follow the current Model Market details for the corresponding model. input structures differ by task type and are not interchangeable.
Available durations, resolutions, and audio capabilities vary across HappyHorse versions and provider channels. Submit only combinations currently supported on the model details page, and validate them with real media before launch.
Save output.task_id from the create response, then poll GET /api/v1/tasks/{task_id} with backoff. Terminal task status; comparisons are case-insensitive. Read output.task_status to identify succeeded, failed, canceled, or unknown. On success, read output.video_url or output.output_video_url; error details may appear at the top level or inside output.
The examples use placeholders. Replace them with a currently available model ID from the model details page, and keep your API Key in a server-side environment variable.
curl -X POST "https://api.tokensmarket.ai/api/v1/services/aigc/video-generation/video-synthesis" \
-H "Authorization: Bearer $TOKEN_MARKET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse-1.1-t2v",
"input": {"prompt": "A paper boat crosses a rain-soaked neon street"},
"parameters": {},
"extra_body": {"provider": {"sort": ["latency"]}}
}'
curl -X GET "https://api.tokensmarket.ai/api/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $TOKEN_MARKET_API_KEY"