Skip to main content
POST
/
replicate
/
v1
/
predictions
cURL
curl https://api.deerapi.com/replicate/v1/predictions \
  -H "Authorization: Bearer <DEERAPI_KEY>" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=5" \
  -d '{
    "version": "black-forest-labs/flux-1.1-pro",
    "input": {
      "prompt": "A minimalist tea cup on white background",
      "aspect_ratio": "1:1",
      "output_format": "jpg"
    }
  }'
{
  "id": "e6je4zpgdxrmw0cww2xsb0515g",
  "model": "black-forest-labs/flux-1.1-pro",
  "version": "hidden",
  "input": {
    "aspect_ratio": "1:1",
    "output_format": "jpg",
    "prompt": "A minimalist tea cup on white background"
  },
  "logs": "",
  "output": null,
  "data_removed": false,
  "error": null,
  "source": "api",
  "status": "starting",
  "created_at": "2026-03-12T06:28:50.927Z",
  "urls": {
    "cancel": "https://api.replicate.com/v1/predictions/e6je4zpgdxrmw0cww2xsb0515g/cancel",
    "get": "https://api.replicate.com/v1/predictions/e6je4zpgdxrmw0cww2xsb0515g",
    "stream": "https://stream.replicate.com/v1/files/example-stream",
    "web": "https://replicate.com/p/e6je4zpgdxrmw0cww2xsb0515g"
  }
}

概述

这是一个 兼容旧代码的 legacy 入口。如果你的应用历史上就是按 Replicate 的 POST /v1/predictions 写的,并且短期内不方便改 URL 结构,可以继续使用这页;如果你是第一次接 DeerAPI,不建议把它当成首选入口。

第一次接入 DeerAPI 时的建议

  1. 新项目优先使用 api/image/flux/create-task-replicate.mdxapi/image/replicate/create-task.mdx
  2. 只有在你必须兼容旧版 Replicate 客户端时,再使用这一页。
  3. 创建任务后,使用 api/image/replicate/query-task.mdx 查询状态与结果。

DeerAPI 与官方文档的差异

  • Replicate 官方 POST /v1/predictions 的关键字段是 version,不是 model。这点很重要,很多旧迁移文档会把它写错。
  • DeerAPI 在这个兼容页上遵循 Replicate 官方的 version + input 结构,但鉴权和域名改为 DeerAPI 的 Bearer Token + https://api.deerapi.com
  • DeerAPI 只支持当前已经接入的部分 Replicate 风格模型,不等于 Replicate 官网全部官方模型都能直接跑。

这个端点适合什么场景

  • 你已经有一个只能调用 POST /replicate/v1/predictions 的旧客户端。
  • 你想尽量少改代码,只把 Base URL 和 API Key 切到 DeerAPI。

这个端点不适合什么场景

  • 第一次接 DeerAPI。
  • 希望把模型 ID 放在 URL 里、便于做路由和日志分析。
  • 想明确区分 FLUX 专用路径和通用 Replicate 路径。

最容易踩的坑

  • 请求体请使用 version,不要使用 model
  • Prefer: wait 只是可选等待头,不代表一定同步拿到最终图片;超时后仍然需要查询任务。
  • 创建任务时 output 很可能是 null,要等任务完成后再取结果。

参考文档

Authorizations

Authorization
string
header
required

使用 DeerAPI Key 进行 Bearer Token 鉴权。

Headers

Prefer
string

可选等待头。使用 wait=n 时,服务端会尽量等待最多 n 秒后再返回。即便设置了该头,也不能保证一定同步拿到最终图片。

Example:

"wait=5"

Cancel-After
string

可选的自动取消时间,例如 5m30s

Body

application/json
version
enum<string>
required

要运行的官方模型或具体版本 ID。对于 DeerAPI 当前接入的官方图片模型,通常可直接填写完整模型 ID。

Available options:
black-forest-labs/flux-1.1-pro,
black-forest-labs/flux-1.1-pro-ultra,
black-forest-labs/flux-2-dev,
black-forest-labs/flux-2-flex,
black-forest-labs/flux-2-max,
black-forest-labs/flux-2-pro,
black-forest-labs/flux-dev,
black-forest-labs/flux-kontext-pro,
black-forest-labs/flux-kontext-max,
black-forest-labs/flux-pro,
black-forest-labs/flux-schnell
input
object
required

模型输入对象。具体字段由所选模型决定。

webhook
string<uri>

异步通知地址。

webhook_events_filter
enum<string>[]
Available options:
start,
output,
logs,
completed

Response

200 - application/json

任务已创建

id
string
required
input
object
required
status
enum<string>
required
Available options:
starting,
processing,
succeeded,
failed,
canceled
created_at
string<date-time>
required
urls
object
required
data_removed
boolean
required
model
string
version
string
logs
string | null
output
error
source
enum<string>
Available options:
api,
web
metrics
object
started_at
string<date-time> | null
completed_at
string<date-time> | null