认证
authorization string 必需
所有 API 均使用 Bearer Token 鉴权
获取 API Key:
访问 API Key 管理页面 获取 API Key
用法:
将以下 Header 添加到请求中:
Authorization: Bearer YOUR_API_KEY
参数
model string 必需
请求使用的模型 ID
值: spark_img_effects
image_input1 string 必需
参考图片的 URL
template_id string 必需
风格模板 ID
可选值:
felt_3d_polaroid: 毛毡3d拍立得风格
my_world: 像素世界风
my_world_universal: 像素世界-万物通用版
plastic_bubble_figure: 塑料泡罩人偶
plastic_bubble_figure_cartoon_text: 塑料泡罩人偶-文字卡头版
furry_dream_doll: 毛茸茸梦幻娃娃
micro_landscape_mini_world: 迷你世界玩偶风
micro_landscape_mini_world_professional: 微型景观小世界-职业版
acrylic_ornaments: 亚克力挂饰
felt_keychain: 毛毡钥匙扣
lofi_pixel_character_mini_card: Lofi 像素人物小卡
angel_figurine: 天使形象手办
lying_in_fluffy_belly: 躺在毛茸茸肚皮里
glass_ball: 玻璃球
earphone_case_style: 耳机盒
electronic_pet_egg_style: 电子宠物蛋
patchwork_collage_style: 拼贴缝布
claw_machine_style: 抓娃娃机
car_miniature_ornaments: 车内微缩摆件
Mid-Autumn_Festival_new_chinese_style: 中秋节-新中式
Mid-Autumn_Festival_individual: 中秋单人
Christmas_green_background: 圣诞节绿背景
Christmas_tree: 圣诞节圣诞树
Spring_Festival_traditional_Chinese_architecture: 春节红墙
birthday_photo_gorgeous: 生日照华丽
birthday_photo_red: 生日照红色
birthday_photo_party: 生日照派对
graduation_photo: 毕业照
spring_festival_traditional_architecture: 春节古建筑
spring_festival_gradient_colors: 春节渐变
width integer
输出图片的宽
范围: 512-2048
默认值: 1328
height integer
输出图片的高
范围: 512-2048
默认值: 1328
轮询
由于图像生成需要时间, 您需要在创建任务后轮询任务状态
初始响应返回任务 ID 和初始状态. 实际的生成结果必须通过轮询任务状态端点来获取
响应格式
error object
错误信息. 仅在状态为 failed 时出现
code
string错误码
error_message
string详细错误信息
output array
生成结果. 仅在状态为 completed 时出现
content
array生成内容列表
type
string资源类型
值:
imageurl
string图像 URL
size
integer图像大小(字节)
jobId
string远程任务 ID
usage object
使用统计. 仅在状态为 completed 时出现
cost
string总费用(美元)
discount
number折扣金额
metadata object
元数据信息
错误码
| 错误码 | 描述 |
|---|---|
| 3009001 | 缺少 image_input1 |
| 3009002 | 缺少 template_id |
| 3009003 | template_id 无效 |
| 3009004 | 尺寸参数无效 |
| 3009095 | 内部生成错误 |
| 3009096 | 结果解析异常 |
| 3009097 | HTTP 错误响应 |
| 3009098 | 状态检查异常 |
| 3009099 | 服务不可用 |