Lisa Run API
商品图片处理纯 LLM 接入文档
Base URL:https://ai-img.centrdx.com。所有业务接口使用同一个 Lisa 场景 Token。
接口
| 方法 | 路径 | 用途 |
|---|---|---|
POST | /v1/agents/agent_product_photo_llm/runs | 创建 Run |
GET | /v1/runs/{run_id} | 查询状态和结果 |
GET | /v1/runs/{run_id}/events | 查询执行事件 |
POST | /v1/runs/{run_id}/cancel | 取消未完成 Run |
请求参数
external_user_id 是可选的顶层隐藏归因标识,适合三方平台共用一个 Token 时区分下游计费用户。它不会进入 input、模型 Prompt、生成结果或公开 Run 响应。
{
"mode": "async",
"external_user_id": "merchant-user-001",
"input": {
"image_url": "https://example.com/source-product.png",
"prompt": "保留包装和品牌标识,生成干净的白底商品图",
"options": {
"background": "white",
"usage": "store_product",
"style": "natural"
}
}
}Idempotency-Key 对异步图片 Run 必填。同一个键只能用于完全相同的请求。
cURL
set -euo pipefail
curl --fail-with-body -sS -X POST "https://ai-img.centrdx.com/v1/agents/agent_product_photo_llm/runs" \
-H "Authorization: Bearer $LISA_API_TOKEN" \
-H "Idempotency-Key: photo-demo-001" \
-H "Content-Type: application/json" \
--data-binary @- <<'LISA_JSON'
{
"mode": "async",
"external_user_id": "merchant-user-001",
"input": {
"image_url": "https://example.com/source-product.png",
"prompt": "保留包装和品牌标识,生成干净的白底商品图",
"options": {
"background": "white",
"usage": "store_product",
"style": "natural"
}
}
}
LISA_JSON
curl --fail-with-body -sS "https://ai-img.centrdx.com/v1/runs/{run_id}" \
-H "Authorization: Bearer $LISA_API_TOKEN"JavaScript
const token = process.env.LISA_API_TOKEN;
const response = await fetch("https://ai-img.centrdx.com/v1/agents/agent_product_photo_llm/runs", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Idempotency-Key": "photo-demo-001",
"Content-Type": "application/json",
},
body: JSON.stringify({"mode":"async","external_user_id":"merchant-user-001","input":{"image_url":"https://example.com/source-product.png","prompt":"保留包装和品牌标识,生成干净的白底商品图","options":{"background":"white","usage":"store_product","style":"natural"}}}),
});
if (!response.ok) throw new Error(await response.text());
const run = await response.json();
console.log(run);
const status = await fetch(`https://ai-img.centrdx.com/v1/runs/${run.id}`, {
headers: { Authorization: `Bearer ${token}` },
});
if (!status.ok) throw new Error(await status.text());
console.log(await status.json());Python
import os
import requests
response = requests.post("https://ai-img.centrdx.com/v1/agents/agent_product_photo_llm/runs",
headers={
"Authorization": f"Bearer {os.environ['LISA_API_TOKEN']}",
"Idempotency-Key": "photo-demo-001",
},
json={'mode': 'async', 'external_user_id': 'merchant-user-001', 'input': {'image_url': 'https://example.com/source-product.png', 'prompt': '保留包装和品牌标识,生成干净的白底商品图', 'options': {'background': 'white', 'usage': 'store_product', 'style': 'natural'}}},
timeout=60,
)
response.raise_for_status()
run = response.json()
print(run)
result = requests.get(f"https://ai-img.centrdx.com/v1/runs/{run['id']}",
headers={"Authorization": f"Bearer {os.environ['LISA_API_TOKEN']}"},
timeout=30,
)
result.raise_for_status()
print(result.json())安全要求
仅通过 HTTPS 调用。不要把 Token 放进浏览器公开代码、查询参数或提交到代码仓库。Runtime Registration Token、Enrollment Token、模型密钥与短期 Execution Ticket 都不是客户 API 凭据,任何文档和示例都不应展示。