Use the unified asynchronous video API to call HappyHorse text-to-video, image-to-video, reference-to-video, and video-editing models, selecting the exact model ID for the task.
https://api.tokensmarket.ai/v1POST /videosThe endpoint remains fixed. Use the parameter documentation on this page to replace the model ID and request data.
${base_url}/videos${base_url}/videos/{task_id}All media generation requests are authenticated through the Token Market unified gateway and use a JSON request body.
| 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. |
Submit a text prompt and basic video specifications. For model-specific media input fields, use the current request structure shown on the Model Market details page.
| 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. |
prompt | string | Yes | — | A prompt describing the target shot, subject, action, environment, camera movement, and style. |
aspect_ratio | string | No | — | The target frame aspect ratio. Options / constraints: For example, 16:9; see the selected model’s details page for supported values. |
seconds | integer | No | — | The target video duration in seconds. Options / constraints: The available range depends on the selected model and current provider channel. |
extra_body.provider | object | No | — | Restricts or ranks 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 |
|---|---|---|---|---|
id | string | No | — | The video generation task ID, used as task_id in the query path. |
status | string | No | — | The current task status. Options / constraints: For processing, success, failure, cancellation, and other states, use the value returned by the gateway. |
output | object | No | — | The result object returned after the task succeeds. |
output.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. |
error | object | No | — | Error information returned when the task fails. |
provider | string | No | — | Information about the provider channel that handled the task. |
request_id | string | No | — | A request identifier for log lookup and troubleshooting. Options / constraints: The field name may change with the current gateway response version. |
HappyHorse uses the model ID to distinguish generation modes. Do not change only the prompt while ignoring the required input modality.
For required image or video fields, URL/Base64 forms, file size, resolution, and aspect-ratio limits, use the current details for the corresponding Model Market model. Media structures for different task types 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 the task ID and query GET /videos/{task_id} with backoff, then copy the result to your own storage immediately after success. On failure or timeout, record model, provider, request_id, and sanitized input metadata.
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 https://api.tokensmarket.ai/v1/videos \
-H "Authorization: Bearer $TOKEN_MARKET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse-1.1-t2v",
"prompt": "A paper boat crosses a rain-soaked neon street",
"aspect_ratio": "16:9",
"seconds": 5
}'
curl https://api.tokensmarket.ai/v1/videos/$TASK_ID \
-H "Authorization: Bearer $TOKEN_MARKET_API_KEY"