快速开始

1. 注册并获取 API Key
curl -X POST https://api.pixseo.ai/api/keys/register \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your_password"}'

# 返回:
# { "api_key": "pixseo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ... }
2. 创建沙箱 Key(测试用,不消耗配额)
curl -X POST https://api.pixseo.ai/api/keys/me/create-sandbox \
  -H "X-API-Key: pixseo_xxxxxxxxxxxx"

# 返回:
# { "api_key": "pixseo_xxxxxxxxxxxx", "usage_limit": 10, ... }

图片处理

上传商品图片,一键完成去背景、压缩、Alt 文本生成。

POST /api/v1/process

请求头

参数必填说明
X-API-Key你的 API Key

请求体 (multipart/form-data)

参数类型必填说明
imageFile商品图片文件 (≤10MB, JPG/PNG/WebP/AVIF/TIFF)
titleString商品标题,用于 Alt 文本生成
product_typeString商品品类
remove_bgBoolean是否去除背景,默认 true
compressBoolean是否压缩为 WebP,默认 true
generate_altBoolean是否生成 Alt 文本,默认 true
return_imageBoolean是否返回 base64 图片数据,默认 true。设为 false 只返回元数据,大幅减小响应体积

示例请求

cURL
curl -X POST https://api.pixseo.ai/api/v1/process \
  -H "X-API-Key: pixseo_xxxxxxxxxxxx" \
  -F "image=@product.jpg" \
  -F "title=Wireless Bluetooth Earbuds" \
  -F "product_type=Electronics"
Python
import requests

url = "https://api.pixseo.ai/api/v1/process"
headers = {"X-API-Key": "pixseo_xxxxxxxxxxxx"}

with open("product.jpg", "rb") as f:
    files = {"image": f}
    data = {
        "title": "Wireless Bluetooth Earbuds",
        "product_type": "Electronics",
    }
    resp = requests.post(url, headers=headers, files=files, data=data)

result = resp.json()
# result["processed_image_base64"] - 处理后的图片 (base64)
# result["alt_texts"] - 多语言 Alt 文本
# result["seo_filename"] - SEO 文件名
JavaScript
const formData = new FormData();
formData.append("image", fileInput.files[0]);
formData.append("title", "Wireless Bluetooth Earbuds");
formData.append("product_type", "Electronics");

const resp = await fetch("https://api.pixseo.ai/api/v1/process", {
    method: "POST",
    headers: { "X-API-Key": "pixseo_xxxxxxxxxxxx" },
    body: formData,
});

const result = await resp.json();
// result.processed_image_base64 - 处理后的图片
// result.alt_texts - 多语言 Alt 文本

返回格式

{
  "request_id": "a3f2b1c9d4e5",       // 请求追踪 ID
  "original_size": 245760,
  "original_size_kb": 240.0,
  "original_name": "product.jpg",
  "processed_size": 48200,
  "processed_size_kb": 47.1,
  "processed_image_base64": "...",     // 仅当 return_image=true 时返回
  "reduction_percent": 80.4,
  "alt_texts": {
    "zh": "无线蓝牙耳机 - 高品质电子产品",
    "en": "Wireless Bluetooth Earbuds - premium electronics",
    "ja": "ワイヤレスBluetoothイヤホン - 高品質電子製品",
    "de": "Kabellose Bluetooth-Ohrhörer - Premium-Elektronik",
    "fr": "Écouteurs Bluetooth sans fil - électronique premium"
  },
  "seo_filename": "wireless-bluetooth-earbuds-1.webp",
  "seo_schema": "{...}",              // JSON-LD Product Schema (Google Shopping)
  "steps": {                          // 各处理步骤状态
    "background_removal": "success",  // success | skipped | failed
    "compression": "success",
    "alt_text": "success"
  },
  "elapsed_ms": 1234                  // 处理耗时(毫秒)
}

L3 语义层 SEO — Schema 生成

生成完整的 JSON-LD 结构化数据(Product + ImageObject + Offer + BreadcrumbList),兼容 Google Shopping 和 Google 图片搜索。

POST /api/v1/schema/generate

请求体 (JSON)

参数类型必填说明
titleString商品标题
product_typeString商品品类
descriptionString商品描述
image_urlString图片 CDN URL
priceNumber商品价格
currencyString货币代码,默认 USD
brandString品牌名
skuStringSKU 编码
availabilityString库存状态,默认 InStock

示例请求

curl -X POST https://api.pixseo.ai/api/v1/schema/generate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: pixseo_xxxxxxxxxxxx" \
  -d '{
    "title": "Wireless Bluetooth Earbuds",
    "product_type": "Electronics",
    "description": "Premium wireless earbuds with noise cancellation",
    "image_url": "https://cdn.example.com/earbuds.webp",
    "price": 79.99,
    "brand": "SoundMax",
    "sku": "SM-EB-001"
  }'

返回格式

{
  "request_id": "a3f2b1c9d4e5",
  "schema_jsonld": "{\n  \"@context\": \"https://schema.org\",\n  \"@graph\": [...]\n}",
  "schema_plain": "{\"@context\":\"https://schema.org\",\"@graph\":[...]}",
  "google_structured_data_test_url": "https://search.google.com/test/rich-results"
}

Phase 2: GenAI Listing 生成

自动生成 SEO 优化的商品标题、描述、五点卖点、SEO 元数据。复用 AI 图片处理管线,技术栈复用率 ~80%。

POST /api/v1/listing/generate

请求体 (JSON)

参数类型必填说明
titleString商品标题
product_typeString商品品类
featuresString产品卖点/特性
target_marketString目标市场,默认 US
languageString输出语言,默认 en
toneString语气风格,默认 professional

示例请求

curl -X POST https://api.pixseo.ai/api/v1/listing/generate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: pixseo_xxxxxxxxxxxx" \
  -d '{
    "title": "Wireless Bluetooth Earbuds",
    "product_type": "Electronics",
    "features": "Noise cancellation, 30hr battery, IPX5 waterproof, Bluetooth 5.3",
    "target_market": "US",
    "language": "en",
    "tone": "professional"
  }'

返回格式

{
  "request_id": "b4g3c2d0e5f6",
  "title_optimized": "Wireless Bluetooth Earbuds with Noise Cancellation - 30hr Battery",
  "description": "Experience premium sound with...",
  "bullet_points": [
    "Advanced noise cancellation technology",
    "30-hour battery life",
    "IPX5 waterproof rating",
    "Bluetooth 5.3 connectivity",
    "Ergonomic design for all-day comfort"
  ],
  "seo_meta": {
    "meta_title": "Wireless Bluetooth Earbuds | Noise Cancelling | PixSEO",
    "meta_description": "Premium wireless earbuds with...",
    "url_slug": "wireless-bluetooth-earbuds-noise-cancellation"
  },
  "target_keywords": ["wireless earbuds", "bluetooth earphones", ...],
  "elapsed_ms": 1234
}

用量查询

GET /api/v1/usage
curl https://api.pixseo.ai/api/v1/usage \
  -H "X-API-Key: pixseo_xxxxxxxxxxxx"

# 返回:
# { "plan": "free", "used": 25, "limit": 50, "remaining": 25, "is_sandbox": false }

定价方案

GET /api/v1/plans

无需认证,返回七档定价方案(Sandbox + Free + Starter + Growth + Scale + Business + Enterprise)。

错误码

状态码说明
200成功
400请求参数错误(图片格式不支持、文件过大、无效图片)
401API Key 无效或缺失
429配额已用完 或 请求过于频繁(速率限制)

响应头

响应头说明
X-Request-ID请求追踪 ID,用于排查问题
Retry-After速率限制触发时,建议等待秒数
Access-Control-Allow-OriginCORS 跨域支持