InkRoom API 与 MCP 文档

批量 API 与 MCP 协议速查

异步批量图片:先报价,再确认

以下为字段示例,不是真实报价或任务回执。使用具有相应模型权限的 API Key,以 Bearer 鉴权。先检查预览返回的 quoteId、expiresAt 和 estimatedChargeMillis,再提交 confirmed 与稳定的 requestId;报价过期后重新预览,不盲目重复创建。

curl -X POST 'https://api.inkroom.ai/api/async/image-batches/preview' \
  -H 'Authorization: Bearer $INKROOM_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Autumn product scenes",
    "mode": "immediate",
    "items": [
      {"model": "YOUR_IMAGE_MODEL", "prompt": "A skincare bottle by a sunlit window"},
      {"model": "YOUR_IMAGE_MODEL", "prompt": "A skincare bottle in a quiet botanical studio"}
    ]
  }'

示例成功响应(部分字段)

{"code":0,"data":{"quoteId":"QUOTE_ID","estimatedChargeMillis":0,"expiresAt":"EXAMPLE_EXPIRY"},"msg":"ok"}
curl -X POST 'https://api.inkroom.ai/api/async/image-batches' \
  -H 'Authorization: Bearer $INKROOM_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"quoteId":"QUOTE_ID","requestId":"YOUR_STABLE_REQUEST_ID","confirmed":true}'
curl 'https://api.inkroom.ai/api/async/image-batches/JOB_ID' \
  -H 'Authorization: Bearer $INKROOM_API_KEY'

通过任务 ID 查询最终状态;继续任务先调用 continue/preview,再确认 continue。不要把 HTTP 200 当作图片完成。原结果、权限和费用以任务回执为准。

错误返回 code、data、msg;401 为身份无效,403 为无权访问,410 为报价或结果已过期。先处理原因,再决定是否重试。

示例错误响应

{"code":410,"data":null,"msg":"费用预估已过期,请重新预览"}
打开完整动态参考

MCP:Streamable HTTP

MCP 使用 MCP Token;标准模型 API 与异步批量 API 使用 API Key,不能混用。连接后先发现工具、检查权限与费用,按回执 nextAction 恢复;不要重复提交已受理的付费请求。

{
  "mcpServers": {
    "inkroom": {
      "type": "http",
      "url": "https://mcp.inkroom.ai",
      "headers": {
        "Authorization": "Bearer <MCP_TOKEN_REQUIRED>",
        "Accept-Language": "zh-CN",
        "X-InkRoom-Continuation": "receipt-v1"
      }
    }
  }
}
打开完整动态参考