← 返回 Skills 市场
liuxiaolong98

AI Image & Video Generator | WIME

作者 liuxiaolong98 · GitHub ↗ · v1.0.5 · MIT-0
cross-platform ⚠ suspicious
241
总下载
11
收藏
0
当前安装
5
版本数
在 OpenClaw 中安装
/install ai-image-video-generator-wime
功能描述
WIME AI 电商创作平台 OpenAPI。提供两个核心能力:1)抠图 — 上传本地图片(或 URL)自动抠图,返回透明背景图 URL;2)商拍图 — 自动抠图后生成多张 AI 商拍图。触发场景:用户提到抠图、商拍图、商品图、WIME、电商图片处理时激活。
使用说明 (SKILL.md)

WIME OpenAPI

电商 AI 创作平台,提供两个核心 Skill。

认证

该 skill 仅支持 WIME_ACCESS_TOKEN

安全与权限说明:该 skill 需要 WIME 专用凭证,并且会把用户明确提供的本地图片上传到 WIME 服务;当输入是远程图片 URL,或 WIME 返回远程抠图结果 URL 时,可能会拉取对应图片做处理。为降低风险,远程下载应仅用于用户提供或 WIME 返回的公开图片地址,不应用于 localhost、内网或其他非公开地址。

统一使用 scripts/wime_auth.pyget_auth() 函数:

from wime_auth import get_auth

auth = get_auth(uri_path="/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() 返回:

  • base_url: API 根地址
  • headers: 完整请求 headers dict(含 access-token
  • body_str: JSON 序列化后的 body 字符串(用于 data= 发送),body_dict 为 None 时为 None

配置方式

export WIME_ACCESS_TOKEN='你的token'

# 可选,默认 https://wime-ai.com
export WIME_BASE_URL='https://wime-ai.com'

若未配置 WIME_ACCESS_TOKEN,调用前应直接报错并提示用户先完成配置。

获取凭证

访问 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

from wime_auth import get_auth

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。

URL 下载注意事项(仅本地路径场景需上传)

  • 如果用户直接给了 URL,优先直接用,不需要下载再上传
  • 只有本地文件才需要走上传流程
  • 上传完成后清理本地临时文件
  • 若必须下载远程图片进行处理,只允许公开 http/https 地址;拒绝 localhost.local、回环地址和内网 IP

Skill 1:抠图

触发词: 抠图、去背景、透明背景、matting

新版流程(access-token)

用户提供本地图片路径或 URL
  → [图片来源判断] → imageUrl
  → removeBg([{imageUrl}]) → taskItemIds
  → queryItemForSaas(taskItemId) 轮询 → 抠图结果 URL

接口: POST /waic/core/creationDesk/removeBg

⚠️ 新版抠图为异步接口,返回 taskItemIds,需轮询获取结果。

步骤:

  1. 获取图片 URL:本地路径 → 上传获取 url;URL → 直接使用
  2. 构建请求体:
    import json
    body = {
        "data": json.dumps([{"imageUrl": image_url}]),
        "skill": True
    }
    
    注意 data 字段是 JSON 字符串(不是 object),内部为 imageUrl 数组。
  3. 调用 removeBg,获取 taskItemIds
  4. taskItemIds[0] 轮询 queryItemForSaasitemStatus == 2url 有值时完成

输出给用户: 抠图结果 URL

Skill 2:商拍图

触发词: 商拍图、商品图、AI 商拍、产品摄影

新版流程(access-token)

用户提供本地图片路径或 URL
  → [图片来源判断] → imageUrl(原图 URL,记为 sourceImageUrl)
  → removeBg → taskItemIds → 轮询 → cutoutUrl
  → crop_alpha_bbox(cutoutUrl) → 本地裁剪图 (cropped.png)
  → upload(cropped.png) → croppedUrl
  → removeBg(croppedUrl) → 轮询 → croppedCutoutUrl(紧凑抠图)
  → draw(picList 使用 croppedCutoutUrl) → taskItemIds
  → queryItemForSaas 轮询 → 出一张返回一张

步骤:

  1. 获取原图 URL
    • URL 输入 → 直接用作 sourceImageUrl
    • 本地路径 → 上传获取 url,作为 sourceImageUrl
  2. 首次抠图:调用 removeBg 传入原图 URL → 轮询获取 cutoutUrl
  3. 裁剪非透明区域:使用 scripts/crop_alpha.pycrop_alpha_bbox(cutoutUrl) 裁剪最小外接矩形,去除多余透明边距
  4. 上传裁剪图:将裁剪后 PNG 通过 /waic/core/file/py/upload 上传 → 获取 croppedUrl 及裁剪后宽高
  5. 二次抠图:调用 removeBg 传入 croppedUrl → 轮询获取 croppedCutoutUrl
  6. 构建 draw 请求

接口: POST /waic/core/creationDesk/draw

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": cropped_cutout_url,
                "sourceImageUrl": source_image_url,
                "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

  1. 提交后获得 taskItemIds
  2. 轮询 queryItemForSaas(每个 taskItemId 单独查),每完成一张立即输出
  3. 清理:删除本地临时裁剪文件

picList 位置与缩放规则

根据商品图裁剪后的宽高比判断横竖版,分别计算缩放和位置:

canvas_w, canvas_h = 1024, 1024  # 画布尺寸
img_w, img_h = crop_w, crop_h  # 裁剪后的商品尺寸

if img_w >= img_h:
    # 横版/方图商品:商品宽度 = 画布宽度 × 60%
    scale = (canvas_w * 0.6) / img_w
else:
    # 竖版商品:商品高度 = 画布高度 × 80%
    scale = (canvas_h * 0.8) / img_h

# 安全 clamp:缩放后商品不能超出画布任意一边
scale = min(scale, canvas_w / img_w, canvas_h / img_h)

# 水平方向:居中
left = (canvas_w - img_w * scale) / 2

# 垂直方向:总空白区域中,上方占 65%,下方占 35%
total_v_blank = canvas_h - img_h * scale
top = total_v_blank * 0.65

裁剪脚本用法

import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'scripts'))
from crop_alpha import crop_alpha_bbox

cropped_path, (crop_w, crop_h) = crop_alpha_bbox(cutout_url, "/tmp/wime_cropped.png")

结果轮询

接口: POST /waic/core/task/queryItemForSaas

body = {"taskItemId": task_item_id}  # 单个 taskItemId(Long)
auth = get_auth(uri_path="/waic/core/task/queryItemForSaas", body_dict=body)
resp = requests.post(
    f"{auth['base_url']}/waic/core/task/queryItemForSaas",
    headers=auth["headers"],
    data=auth["body_str"].encode("utf-8")
)
# data.itemStatus == 2 且 data.url 有值 → 完成

轮询状态码(实测)

itemStatus 含义
0 需区分:调度延迟 vs 真正失败(见下方判定逻辑)
1 执行中(未出图)
2 完成url 字段有值)
3 执行中
4 排队中

判断完成的条件: itemStatus == 2url 非空。

⚠️ itemStatus=0 的判定逻辑:

实测发现:任务在较长一段时间内持续返回 status=0 仍可能最终成功不要因为连续几次 0 就判定失败

推荐轮询策略:

  • 完成条件:itemStatus == 2url 非空
  • 轮询间隔:5~10
  • 默认最长等待:3~10 分钟
  • 在超时前,不要仅因 status=0 就判失败
  • 超时后仍无结果,标记为 "超时/未完成"

输出给用户: 每张图完成时立即返回结果 URL


API 路径对照

功能 路径
图片上传 POST /waic/core/file/py/upload
抠图 POST /waic/core/creationDesk/removeBg
商拍图 POST /waic/core/creationDesk/draw
结果轮询 POST /waic/core/task/queryItemForSaas

环境

环境 Base URL 说明
生产 https://wime-ai.com 线上环境

默认使用生产环境。WIME_BASE_URL 可覆盖。

接口参考

文件 说明
references/upload-image.md 图片上传
references/cutout.md 抠图
references/photo-shoot.md 商拍图
references/asset-query.md 结果轮询 + 资产查询
references/error-codes.md 全局错误码

注意事项

  • 新版上传图片直接得到 URL,不再有 mediaId 概念
  • 抠图为异步接口,需轮询获取结果
  • 商拍图始终为异步接口,轮询时出一张返回一张
  • body 中含 skill: true 的接口必须传此字段
  • QPS 限制,超限返回 errcode=1000007
  • 该 skill 依赖 WIME_ACCESS_TOKEN;发布到注册表时应显式声明该环境变量与主凭证需求
安全使用建议
Key things to check before installing: - Expect to provide a WIME_ACCESS_TOKEN environment variable (and optionally WIME_BASE_URL); the registry metadata did not declare this — set it only if you trust the WIME service and token scope. - The bundled scripts require Python packages (requests, Pillow/PIL, numpy). Either ensure your environment has these or request the publisher add an install spec or requirements.txt. - The skill uploads user images to the WIME service as part of normal operation. Do not use it with images you cannot or do not want to send to an external service. - The crop tool includes protections against private/localhost URLs (good), but still performs DNS resolution and HTTP(S) downloads of user-supplied URLs — avoid passing internal URLs. - Source and homepage are unknown; if possible, ask the publisher for a repo or official documentation and request that required env vars and dependency installation steps be added to the registry metadata. If you cannot verify the publisher or provide the necessary token and dependency setup, treat this skill as untrusted and do not install it in sensitive environments.
功能分析
Type: OpenClaw Skill Name: ai-image-video-generator-wime Version: 1.0.5 The skill bundle provides AI-powered image background removal and product photography generation via the WIME platform. It includes well-structured Python scripts for authentication (scripts/wime_auth.py) and image processing (scripts/crop_alpha.py). Notably, the crop_alpha.py script implements robust SSRF protection by validating remote URLs and blocking access to private, loopback, or local network addresses. The instructions in SKILL.md are transparent, align with the stated purpose, and include explicit security warnings regarding data handling and network access.
能力评估
Purpose & Capability
The name/description (WIME image/cutout and product-shot generation) align with the included code and SKILL.md: functions upload images, call WIME endpoints, crop transparent regions, and assemble draw requests. However the registry metadata claims no required env vars or binaries while the runtime requires WIME_ACCESS_TOKEN (and optionally WIME_BASE_URL) and the scripts depend on external Python packages (requests, Pillow, numpy). The missing declarations are disproportionate to the stated purpose (they should list the token and dependencies).
Instruction Scope
SKILL.md confines actions to getting an image (local or public URL), uploading local files to WIME, calling WIME APIs (removeBg/draw/queryItemForSaas) and running a local crop utility. It documents that user images will be uploaded to WIME and warns against downloading private/internal URLs. The instructions are specific and do not request unrelated system files or unrelated credentials.
Install Mechanism
There is no install spec even though the included Python scripts import third‑party libraries (requests, Pillow/PIL, numpy). Without an install step or dependency manifest, the runtime may fail or an integrator might need to install packages manually. Lack of an install spec also means no controlled acquisition of dependencies is specified.
Credentials
The runtime requires WIME_ACCESS_TOKEN (and optionally WIME_BASE_URL) per SKILL.md and wime_auth.py, but the registry metadata lists no required env vars. That mismatch is a red flag: the skill will error unless an access token is present, and the token is the sole credential used (which is proportionate), but it must be declared. No other secrets or unrelated credentials are requested.
Persistence & Privilege
The skill does not request permanent/always-on presence and does not modify other skills or system-wide settings. It runs as invoked and uses local temp files for cropping, cleaning them up. Autonomous invocation is allowed (platform default) but not combined with other high-risk factors.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ai-image-video-generator-wime
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ai-image-video-generator-wime 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.5
- Removed the README.md file. - No functional or interface changes to the skill itself.
v1.0.4
Version 1.0.4 - 移除 AK/SK 认证,仅支持 WIME_ACCESS_TOKEN,提升安全性。 - 明确安全注意,远程图片下载仅允许公开 http/https 地址,禁止 localhost、内网等非公开地址。 - 删除旧版 API 调用与兼容说明,文档精简为新版流程。 - 默认 Base URL 变更为 https://wime-ai.com。 - 明确 skill 环境配置需显式声明 WIME_ACCESS_TOKEN,未配置时直接报错。 - 优化说明,强调所有图片处理均需显式、授权输入。
v1.0.3
ai-image-video-generator-wime v1.0.3 - Added .gitignore and README.md files for improved project documentation and management. - SKILL.md: Updated for latest WIME API changes—now supports both access-token (recommended) and AK/SK authentication. - SKILL.md: Describes new API endpoints and request/response workflows for image upload, matting, and AI product photography, including switch to async endpoints and using image URLs directly. - Clearly separates new (access-token) and legacy (AK/SK) usage patterns and body structures. - Details new image upload method (returns URL instead of mediaId) and updated polling/response patterns for asynchronous tasks. - Provides integration guidance for both modes and outlines key behavioral differences from the previous version.
v1.0.1
- Added metadata (homepage, emoji, environment variable requirements) for improved integration and discoverability. - Added homepage field to SKILL.md. - Removed the README.md file.
v1.0.0
Initial release of wime-creator skill for WIME AI 电商创作平台 OpenAPI. - Provides automatic image background removal (抠图) via URL or local image upload, returning a transparent background image and description. - Supports AI 商拍图 (AI-generated product photography) with automatic background removal, object cropping, and generation of multiple e-commerce photos per request. - Guides input as either local file paths or image URLs, handling both cases seamlessly. - Includes robust polling logic for receiving 商拍图 results, returning images as they complete. - Offers clear instructions for AK/SK API key configuration and environment setup. - Refuses API calls and prompts users to configure credentials if required keys are missing.
元数据
Slug ai-image-video-generator-wime
版本 1.0.5
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 5
常见问题

AI Image & Video Generator | WIME 是什么?

WIME AI 电商创作平台 OpenAPI。提供两个核心能力:1)抠图 — 上传本地图片(或 URL)自动抠图,返回透明背景图 URL;2)商拍图 — 自动抠图后生成多张 AI 商拍图。触发场景:用户提到抠图、商拍图、商品图、WIME、电商图片处理时激活。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 241 次。

如何安装 AI Image & Video Generator | WIME?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ai-image-video-generator-wime」即可一键安装,无需额外配置。

AI Image & Video Generator | WIME 是免费的吗?

是的,AI Image & Video Generator | WIME 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

AI Image & Video Generator | WIME 支持哪些平台?

AI Image & Video Generator | WIME 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 AI Image & Video Generator | WIME?

由 liuxiaolong98(@liuxiaolong98)开发并维护,当前版本 v1.0.5。

💬 留言讨论