curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "Omni-Flash-Ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
Omni-Flash-Ext
Omni-Flash-Ext 视频生成
- Omni-Flash-Ext 统一视频生成模型
- 支持文生视频、单图生视频、参考视频和 3 张参考图融合
- 支持 720p/1080p/4k 分辨率,4/6/8/10 秒时长
- 异步任务接口,提交后通过任务 ID 查询生成结果
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "Omni-Flash-Ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "Omni-Flash-Ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "Omni-Flash-Ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
认证
string
必填
所有接口均需要使用 Bearer Token 进行认证。获取 API Key:访问 API Key 管理页面 获取您的 API Key。使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求参数
string
必填
视频生成模型名称,固定为
Omni-Flash-Ext。string
必填
视频内容描述。建议详细描述场景、人物、动作、环境、镜头运动、画面风格和音频提示。示例:
"a girl is dancing happily in a sunny garden"integer
默认值:"6"
视频时长,单位为秒。仅支持:
4、6、8、10。传入
5、7 等其他时长会返回 invalid_duration 错误。上传参考视频时不需要传入
duration。duration 与 video_urls 不可以同时传入。string
默认值:"720p"
视频分辨率,不区分大小写。可选值:
720p1080p4k
传入其他分辨率会返回
invalid_resolution 错误。string
默认值:"16:9"
视频宽高比,用于控制横屏或竖屏。常用值:
16:9- 横屏9:16- 竖屏
16:9string
兼容字段,含义与
aspect_ratio 相同。若同时传入,建议保持与 aspect_ratio 一致。string
生成类型,用于指定图片的使用方式。可选值:
frame- 首帧模式。image_urls只可以上传 1 张图片,作为视频首帧。reference- 参考模式。image_urls可以上传 1 张或 3 张图片,作为参考图。
当
generation_type 为 frame 时,image_urls 仅支持 1 张图片;传入其他数量会返回 unsupported_image_count 错误。array<url>
参考图片 URL 数组。可不传、传 1 张或传 3 张,具体数量取决于
generation_type:- 不传或空数组:文生视频
- 1 张图片:单图生视频
- 3 张图片:参考图融合(仅在
generation_type为reference时支持)
generation_type 的关系:generation_type为frame:只可以上传 1 张图片。generation_type为reference:可以上传 1 张或 3 张图片。
不支持 2 张图的首尾帧模式。传入 2 张图片会返回
unsupported_image_count 错误。4 张及以上未实测验证,不建议使用。array<url>
参考视频 URL 数组。可不传或传 1 个参考视频。只支持公网可访问的 HTTP/HTTPS 视频 URL。可与
image_urls 同时传入,图片作为身份或构图参考,视频作为动态参考。Omni-Flash-Ext 仅支持 0 或 1 个参考视频。传入 2 个及以上视频会返回 unsupported_video_count 错误。传入
video_urls 时不需要传入 duration。video_urls 与 duration 不可以同时传入。响应
integer
响应状态码,成功时为
200。查询任务结果
视频生成为异步任务。提交后会返回task_id,使用 获取任务状态 接口查询生成进度和结果。
cURL
curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
--header 'Authorization: Bearer <token>'
成功结果示例
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "completed",
"progress": 100,
"created": 1779246294,
"completed": 1779246534,
"actual_time": 240,
"estimated_time": 600,
"cost": 0.4,
"credits_cost": 4,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/videos/abc.mp4"],
"expires_at": 1779332760
}
]
}
}
}
失败结果示例
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "failed",
"progress": 100,
"created": 1779246294,
"completed": 1779246534,
"actual_time": 240,
"estimated_time": 600,
"cost": 0,
"credits_cost": 0,
"error": {
"message": "invalid duration 7, must be one of 4/6/8/10",
"code": "task_failed"
}
}
}
使用场景
场景 1:文生视频
{
"model": "Omni-Flash-Ext",
"prompt": "a beautiful sunset over the ocean with seagulls flying",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}
场景 2:单图生视频
{
"model": "Omni-Flash-Ext",
"prompt": "make the character smile and slowly turn around, cinematic camera motion",
"duration": 6,
"resolution": "1080p",
"aspect_ratio": "9:16",
"image_urls": ["https://example.com/character.jpg"]
}
场景 3:3 张参考图融合
{
"model": "Omni-Flash-Ext",
"prompt": "a creative scene combining these elements with smooth camera motion",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
"image_urls": [
"https://example.com/scene.jpg",
"https://example.com/character.jpg",
"https://example.com/product.jpg"
]
}
场景 4:4K 短视频
{
"model": "Omni-Flash-Ext",
"prompt": "close-up of a hummingbird hovering in front of a red flower",
"duration": 4,
"resolution": "4k",
"aspect_ratio": "16:9"
}
场景 5:参考视频生成
{
"model": "Omni-Flash-Ext",
"prompt": "the same scene but at night with neon lights",
"resolution": "720p",
"aspect_ratio": "16:9",
"video_urls": ["https://example.com/reference.mp4"]
}
错误码
| HTTP | 错误类型 | 含义 | 处理建议 |
|---|---|---|---|
| 400 | invalid_request_error | model 不是 Omni-Flash-Ext、prompt 为空或 JSON 格式错误 | 检查请求体 |
| 400 | invalid_duration | duration 不是 4、6、8 或 10 | 改成支持的时长 |
| 400 | invalid_resolution | resolution 不是 720p、1080p 或 4k | 改成支持的分辨率 |
| 400 | unsupported_image_count | image_urls 数量不受支持,常见于传入 2 张图 | 改成 0、1 或 3 张图片 |
| 400 | unsupported_video_count | video_urls 数量不受支持,常见于传入 2 个及以上视频 | 改成 0 或 1 个参考视频 |
| 401 | authentication_error | Token 无效 | 检查 Bearer Token |
| 402 | payment_required | 账户余额不足 | 充值后重试 |
| 429 | rate_limit_error | 触发限流 | 降低并发或稍后重试 |
data.error 中返回失败原因。常见原因包括上游配额暂时耗尽、内容审核未通过或上游超时。⌘I