APIMODELSAPIMODELS
Docs/SparkPix API

SparkPix API

SparkPix 出品的超快图片模型,两个独立端点。SparkPix Image 文生图不到 1 秒,支持 LoRA 自定义风格。SparkPix Image Edit 支持多图参考编辑。均为同步 API,直接返回结果,无需轮询。

认证

Authorization: Bearer YOUR_API_KEY

模型与价格

模型端点价格说明
SparkPix ImagePOST /api/v1/images/generations-sync$0.0080/张文生图,同步,<1 秒,支持 LoRA
SparkPix Image EditPOST /api/v1/images/edit$0.0130/张多图编辑,同步,<1 秒

代码示例

# SparkPix Image: Text-to-image (sync, sub-1-second)
curl -X POST https://api.apimodels.app/v1/images/generations-sync \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cute cat wearing a space helmet, digital art",
    "aspect_ratio": "16:9",
    "seed": 42
  }'

# SparkPix Image Edit: Multi-image editing (sync)
curl -X POST https://api.apimodels.app/v1/images/edit \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Make the background a sunset beach",
    "images": ["https://example.com/photo.jpg"],
    "aspect_ratio": "16:9"
  }'

SparkPix Image — 请求参数

POST /api/v1/images/generations-sync
字段必填类型说明
prompt是string图片描述
aspect_ratio否string"custom"(默认,自动尺寸)、"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"3:2"、"2:3"
width否integer仅 aspect_ratio="custom" 时生效,256-1440,须为 16 的倍数
height否integer仅 aspect_ratio="custom" 时生效,256-1440,须为 16 的倍数
prompt_upsampling否boolean用 LLM 自动扩写优化提示词(默认 false)
seed否integer随机种子,用于复现生成结果
lora_weights否stringHuggingFace LoRA 权重 URL,格式: huggingface.co/<owner>/<model>[/<file.safetensors>]
lora_scale否numberLoRA 强度,-1 到 3,默认 0.5
callBackUrl否string任务完成后的回调 URL

SparkPix Image Edit — 请求参数

POST /api/v1/images/edit
字段必填类型说明
prompt是string编辑指令,可用 "image 1"、"image 2" 引用输入图片
images否string[]参考图片 URL 数组,第一张为主图
aspect_ratio否string"match_input_image"(默认,匹配第一张图)、"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"3:2"、"2:3"
turbo否boolean加速模式(默认 true),复杂任务建议关闭
seed否integer随机种子,用于复现生成结果
callBackUrl否string任务完成后的回调 URL

说明

  • 两个模型使用不同的 API 端点,不是同一个接口
  • 两个接口都是同步 API,直接返回图片 URL,无需轮询
  • 响应格式: { code: 200, data: { url, model, credits, duration } }
  • SparkPix Image 的 aspect_ratio 默认 "custom"(自动),SparkPix Image Edit 默认 "match_input_image"(匹配输入图尺寸)

试一试:Playground

常见问题

SparkPix 有多快?

SparkPix Image 文生图不到 1 秒,两个接口都是同步 API,图片 URL 直接随响应返回,无需轮询。

生成和编辑分别用哪个端点?

文生图:POST /api/v1/images/generations-sync;编辑:POST /api/v1/images/edit,用 images[] 传参考图(第一张为主图)。两条是不同端点。