图像与视频
多模态模型的参数可能不同。先在模型广场确认模型能力、计费方式与支持的尺寸。
图像生成
bash
curl https://api.noflex.work/v1/images/generations \
-H "Authorization: Bearer sk-your-flex247-key" \
-H "Content-Type: application/json" \
-d '{
"model": "your-image-model-id",
"prompt": "A clean product hero image, soft studio lighting",
"size": "1024x1024",
"n": 1
}'常见返回方式包括图片 URL 或 Base64 数据。请按响应字段保存文件,不要假设所有模型返回格式完全相同。
视频生成
视频通常是异步任务:提交请求后取得任务 ID,再轮询状态,完成后下载结果。
bash
curl https://api.noflex.work/v1/videos \
-H "Authorization: Bearer sk-your-flex247-key" \
-H "Content-Type: application/json" \
-d '{
"model": "your-video-model-id",
"prompt": "A cinematic product reveal with slow camera movement"
}'模型差异
视频模型的路径、时长、比例、首尾帧与任务查询字段可能不同。如果模型详情页提供专用参数,以该模型要求为准。
生产建议
- 为图片与视频设置独立 API 密钥和额度。
- 保存任务 ID,避免网络中断后重复提交并重复计费。
- 对用户输入做长度和内容检查。
- 下载完成后转存到自己的对象存储,不要长期依赖临时 URL。