PixSEO API
将 AI 图片处理能力集成到你的应用中
快速开始
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)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
image | File | 是 | 商品图片文件 (≤10MB, JPG/PNG/WebP/AVIF/TIFF) |
title | String | 否 | 商品标题,用于 Alt 文本生成 |
product_type | String | 否 | 商品品类 |
remove_bg | Boolean | 否 | 是否去除背景,默认 true |
compress | Boolean | 否 | 是否压缩为 WebP,默认 true |
generate_alt | Boolean | 否 | 是否生成 Alt 文本,默认 true |
return_image | Boolean | 否 | 是否返回 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)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
title | String | 是 | 商品标题 |
product_type | String | 否 | 商品品类 |
description | String | 否 | 商品描述 |
image_url | String | 否 | 图片 CDN URL |
price | Number | 否 | 商品价格 |
currency | String | 否 | 货币代码,默认 USD |
brand | String | 否 | 品牌名 |
sku | String | 否 | SKU 编码 |
availability | String | 否 | 库存状态,默认 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)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
title | String | 是 | 商品标题 |
product_type | String | 否 | 商品品类 |
features | String | 否 | 产品卖点/特性 |
target_market | String | 否 | 目标市场,默认 US |
language | String | 否 | 输出语言,默认 en |
tone | String | 否 | 语气风格,默认 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 | 请求参数错误(图片格式不支持、文件过大、无效图片) |
401 | API Key 无效或缺失 |
429 | 配额已用完 或 请求过于频繁(速率限制) |
响应头
| 响应头 | 说明 |
|---|---|
X-Request-ID | 请求追踪 ID,用于排查问题 |
Retry-After | 速率限制触发时,建议等待秒数 |
Access-Control-Allow-Origin | CORS 跨域支持 |