WIME AI 电商创作平台 OpenAPI。提供两个核心能力:1)抠图 — 上传本地图片(或 URL)自动抠图,返回透明背景图 URL;2)商拍图 — 自动抠图后生成多张 AI 商拍图。触发场景:用户提到抠图、商拍图、商品图、WIME、电商图片处理时激活。
电商 AI 创作平台,提供两个核心 Skill。
该 skill 仅支持 WIMEACCESSTOKEN。
安全与权限说明:该 skill 需要 WIME 专用凭证,并且会把用户明确提供的本地图片上传到 WIME 服务;当输入是远程图片 URL,或 WIME 返回远程抠图结果 URL 时,可能会拉取对应图片做处理。为降低风险,远程下载应仅用于用户提供或 WIME 返回的公开图片地址,不应用于 localhost、内网或其他非公开地址。
统一使用 scripts/wimeauth.py 的 getauth() 函数:
python
from wimeauth import getauth
auth = getauth(uripath=/waic/core/creationDesk/draw, body_dict=body)
resp = requests.post(
f{auth[base_url]}/waic/core/creationDesk/draw,
headers=auth[headers],
data=auth[body_str].encode(utf-8)
)
get_auth() 返回:
bash
export WIMEACCESSTOKEN=你的token
若未配置 WIMEACCESSTOKEN,调用前应直接报错并提示用户先完成配置。
访问 wime-ai.com,页面右下角有 API 对接的联系方式,通过该入口申请获取 access-token。
如果当前环境未配置凭证,应直接告知用户先去官网联系获取,而不是盲目调用接口。
用户输入可能是 本地路径 或 URL,统一处理为可访问的图片 URL:
判断用户输入:
├─ 本地路径 (如 /Users/.../image.jpg)
│ → upload → imageUrl
│
└─ URL (以 http:// 或 https:// 开头)
→ 直接使用该 URL 作为 imageUrl
→ (若后续接口不接受外部 URL,则下载 → upload → imageUrl)
POST /waic/core/file/py/upload(multipart/form-data)
直接返回 data.url(可访问的图片 URL),不再返回 mediaId。
python
from wimeauth import getauth
auth = get_auth()
with open(image.png, rb) as f:
resp = requests.post(
f{auth[base_url]}/waic/core/file/py/upload,
headers={access-token: auth[headers][access-token]},
files={file: (image.png, f, image/png)}
)
image_url = resp.json()[data][url]
注意: 上传接口需要 access-token header。
触发词: 抠图、去背景、透明背景、matting
用户提供本地图片路径或 URL
→ [图片来源判断] → imageUrl
→ removeBg([{imageUrl}]) → taskItemIds
→ queryItemForSaas(taskItemId) 轮询 → 抠图结果 URL
接口: POST /waic/core/creationDesk/removeBg
⚠️ 新版抠图为异步接口,返回 taskItemIds,需轮询获取结果。
步骤:
注意 data 字段是 JSON 字符串(不是 object),内部为 imageUrl 数组。
输出给用户: 抠图结果 URL
触发词: 商拍图、商品图、AI 商拍、产品摄影
用户提供本地图片路径或 URL
→ [图片来源判断] → imageUrl(原图 URL,记为 sourceImageUrl)
→ removeBg → taskItemIds → 轮询 → cutoutUrl
→ cropalphabbox(cutoutUrl) → 本地裁剪图 (cropped.png)
→ upload(cropped.png) → croppedUrl
→ removeBg(croppedUrl) → 轮询 → croppedCutoutUrl(紧凑抠图)
→ draw(picList 使用 croppedCutoutUrl) → taskItemIds
→ queryItemForSaas 轮询 → 出一张返回一张
步骤:
接口: POST /waic/core/creationDesk/draw
python
body = {
ips: False,
needRank: True,
num: 4,
type: 1002,
data: {
aiStyle: True,
bgColor: ,
height: 1024,
width: 1024,
industry: 其他,
negPrompt: ,
prompt: ,
promptAi: ,
randomStyle: True,
referenceUrl: ,
seed: 0,
styleCode: A0072,
skill: True,
picList: [
{
imageUrl: croppedcutouturl,
sourceImageUrl: sourceimageurl,
imageCaption: ,
width: crop_w,
height: crop_h,
left: calculated_left,
top: calculated_top,
scaleX: calculated_scale,
scaleY: calculated_scale,
type: 1,
parentId:
}
]
}
}
注意新版 body 结构: 外层有 ips/needRank/type,画布参数在 data 内,data.skill 必须为 True。
根据商品图裁剪后的宽高比判断横竖版,分别计算缩放和位置:
python
canvasw, canvash = 1024, 1024 # 画布尺寸
imgw, imgh = cropw, croph # 裁剪后的商品尺寸
if imgw >= imgh:
# 横版/方图商品:商品宽度 = 画布宽度 × 60%
scale = (canvasw * 0.6) / imgw
else:
# 竖版商品:商品高度 = 画布高度 × 80%
scale = (canvash * 0.8) / imgh
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 ai-image-video-generator-wime-1776015075 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 ai-image-video-generator-wime-1776015075 技能
skillhub install ai-image-video-generator-wime-1776015075
文件大小: 13.41 KB | 发布时间: 2026-4-13 09:14