Anywear CLI 與 REST API
透過終端機、指令碼或程式開發代理建立試穿連結。在瀏覽器中登入一次後,傳入服裝圖片網址,即可用一個指令開啟試衣間。
正在使用 Claude 或 ChatGPT 等聊天應用程式?請改為透過 MCP 連線。 MCP 設定
安裝
從 npm 安裝官方 anywear 套件,或透過 npx 免安裝執行。需要在 macOS 或 Linux 上安裝 Node.js 22 或更新版本。
全域安裝
npm i -g anywear免安裝執行
npx anywear login指令
anywear login- 開啟瀏覽器登入 Anywear 並授權 CLI。登入狀態會儲存在這台電腦上。
anywear try-on IMAGE_URL --open --wait- 為服裝圖片建立試穿連結。--open 會在瀏覽器中開啟連結,--wait 會等待試穿場次結束,並輸出所用的秒數和點數。
anywear status LINK_ID- 顯示連結的狀態,以及透過該連結開啟的試穿場次。
anywear list- 列出您最近的試穿連結。
anywear whoami- 顯示目前登入的帳戶及其點數餘額。
anywear logout- 登出,並從這台電腦中移除已儲存的登入資訊。
將 IMAGE_URL 替換為 JPEG、PNG 或 WebP 圖片的直接連結,將 LINK_ID 替換為 CLI 輸出的 ID。
在程式開發代理中使用
Claude Code、Codex 等可執行終端機指令的程式開發代理可以直接使用 CLI。請將以下指示貼給代理:
Read https://anywear.studio/mcp-guide.txt and set up the Anywear CLI on this computer. Let me sign in in my browser, then create a try-on link for the garment I choose.價格
- 每個試穿場次最長 30 秒,按秒計費:每秒 1 點數,最低以 10 秒計費。
- 試穿場次開始時將凍結 30 點數,場次結束後,未使用的部分將退還至您的餘額。
- 建立連結免費,未開始的試穿場次不產生任何費用。
- 在試穿場次內切換服裝不另外收費。
- 連結在 24 小時後失效。每個帳戶每小時最多可建立 20 個連結。
隱私與控制
- AI 應用程式無法開啟您的攝影機、啟動試穿場次或購買任何商品。只有您本人可以在自己的瀏覽器中啟動試穿場次。
- 該應用程式可以查看您的電子郵件地址、點數餘額以及為您的帳戶建立的試穿連結,但絕不會接收您的攝影機影像。
- 您可以隨時在帳戶頁面斷開應用程式的連線,其存取權限將立即終止。
REST API
CLI 建構於一個精簡的 REST API 之上,您也可以在自己的程式碼中呼叫該 API。每個要求都需在 Authorization 標頭中附帶 OAuth 2.1 存取權杖。以下技術參考文件為英文。
curl https://anywear.studio/api/v1/tryon/links \
-H "Authorization: Bearer $ANYWEAR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"image_url": "https://shop.example/images/jacket.jpg"}'GET /api/v1/account- The connected account: email, credits, rooms_available, pricing and top_up_url.
POST /api/v1/tryon/links- Create a try-on link. JSON body: {"image_url": "https://…/garment.jpg", "title": "optional"}. Returns 201 with the link, including its url and expires_at.
GET /api/v1/tryon/links?limit=10- The account's most recent try-on links (limit 1–50).
GET /api/v1/tryon/links/{id}- One link: status (waiting_for_user, in_progress, finished or expired), its latest five rooms with seconds_used, seconds_billed (minimum included) and credits_charged, and credits_charged / rooms_total across every room.
{"error": {"code": "not_found", "message": "Try-on link not found"}}OAuth 端點
Anywear 是支援動態用戶端註冊和 PKCE 的 OAuth 2.1 授權伺服器。用戶端皆為公開用戶端,因此不會核發用戶端密鑰。
GET /.well-known/oauth-authorization-server- Authorization server metadata (RFC 8414).
GET /.well-known/oauth-protected-resource- Protected resource metadata (RFC 9728).
POST /api/oauth/register- Dynamic client registration (RFC 7591). Send redirect_uris; returns a client_id.
GET /oauth/authorize- Authorization code flow with PKCE (S256). The user signs in and chooses Allow.
POST /api/oauth/token- grant_type authorization_code or refresh_token. Access tokens last 1 hour; refresh tokens 60 days.
POST /api/oauth/revoke- Token revocation (RFC 7009). A refresh token ends the whole connection; an access token ends only itself.