外观
快速开始
完整接口、字段约束和在线调试可直接打开 API 服务的 /docs;机器可读规范位于 /openapi.json。
1. 获取 API Key
登录控制台,在「API Keys」页面创建 Key。
完整 Key 只在创建时显示一次,请妥善保存,并且只在服务端使用。
2. 创建任务
创建任务时传入 webhook_url 用于接收结果,并在请求头 Idempotency-Key 中带上你的业务 ID(如订单号):
bash
curl -X POST https://api.modelgo.moneygo.ai/v1/images/pose \
-H "Authorization: Bearer sk-你的Key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_10086" \
-d '{
"template_id": "pose_office",
"image": "https://example.com/face.jpg",
"webhook_url": "https://your-server.com/webhook"
}'接口立即返回任务,此时状态为 queued:
json
{
"id": "task_3kP9xQ2mZ7aB1cD4eF6gH8jK",
"status": "queued",
"output": null
}Idempotency-Key 在同一功能内不能重复。请求超时时,原样重发即可,不会重复生成。
3. 接收 Webhook
任务结束后,我们会向 webhook_url 发送 POST 请求:
json
{
"timestamp": 1789632021,
"task": {
"id": "task_3kP9xQ2mZ7aB1cD4eF6gH8jK",
"idempotency_key": "order_10086",
"status": "succeeded",
"output": { "images": ["https://cdn.example.com/outputs/abc.png"] }
}
}- 通过
task.idempotency_key找到对应的业务记录,处理后返回2xx状态码即可。 - 请用控制台「Webhook」页面的密钥校验请求头
X-Webhook-Signature,校验方法见「Webhook 回调」。
