Poomi
快速开始

首次 API 调用

向 Poomi 平台发起你的首次 API 调用

本指南演示如何发起首次 API 调用。你可以使用任何 HTTP 客户端或编程语言。

请求格式

所有 Poomi API 请求遵循此模式:

curl https://www.poomi.pet/api/v1/{endpoint-slug} \
  -H "Authorization: Bearer pk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

示例

此示例向端点发送一张图片。将 {endpoint-slug} 替换为端点页面中的实际端点。

curl https://www.poomi.pet/api/v1/{endpoint-slug} \
  -H "Authorization: Bearer pk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "base64_encoded_image_data"
  }'

Python 示例

import requests
import base64

# 读取并编码图片
with open("pet_photo.jpg", "rb") as f:
    image_data = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://www.poomi.pet/api/v1/{endpoint-slug}",
    headers={
        "Authorization": "Bearer pk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={"image": image_data},
)

result = response.json()
print(result)

成功响应

{
  "success": true,
  "request_id": "req_abc123def456",
  "data": {
    ...
  }
}

错误响应

{
  "success": false,
  "error": {
    "code": "INVALID_KEY",
    "message": "Invalid API key"
  }
}

请求字段

字段类型描述
imagestringBase64 编码的图片数据。支持格式:JPG、PNG、WEBP,最大 4MB
textstring文本输入(文本端点)

具体字段取决于端点的输入类型(imagetextimage_text)。详见端点了解各端点详情。

图片要求

  • 支持格式:JPG、PNG、WEBP
  • 最大文件大小:4MB
  • 建议分辨率:至少 640x480 以获得最佳效果
  • 确保光线充足,避免模糊图片
  • 将拍摄主体(宠物)置于画面中心

响应字段

字段类型描述
successboolean请求是否成功
request_idstring唯一请求 ID(req_ 前缀)
dataobjectAI 模型输出(格式因端点而异)

On this page