PixMiller PixMiller
首頁 / API / 線上去背 API
開發者 API

背景移除 API REST API · v1

把 PixMiller 的去背功能接入你的技術棧:一個 POST 請求約 5 秒移除背景並返回透明 PNG。邊緣精準,按張計費。

端點
POST api.pixmiller.com/v1/remove
curl -X POST \
  api.pixmiller.com/v1/remove \
  -H "X-Api-Key: YOUR_API_KEY" \
  -F "[email protected]"
線上去背 API
PixMiller REST API · v1
full = 1 點數 · 預覽免費

上傳圖片,AI 移除背景並返回透明 PNG。同步處理——通常幾秒完成。

POST https://api.pixmiller.com/v1/remove
1

認證與請求

在請求標頭的 X-Api-Key: YOUR_API_KEY 中傳送您的密鑰。在帳號頁面創建和管理密鑰。
參數 類型 必填 說明
image_file file 必填* 待處理圖片,multipart 上傳。JPG / PNG / WebP,最大 20MB
image_url string 必填* 或提供公開圖片 URL(二擇一:image_file / image_url)
size string 選填 preview(免費,含浮水印)/ full(高畫質,1 點數)/ auto。預設 preview
format string 選填 auto(透明用 PNG,否則 JPG — 預設)/ png / jpg
bg_color string 選填 結果背景:transparent(預設)/ white / 任意 #RRGGBB
* 請提供 image_file 或 image_url 其中之一。
2

程式碼範例

選一個語言並複製——直接就能跑。
1curl -X POST "https://api.pixmiller.com/v1/remove" \2  -H "X-Api-Key: YOUR_API_KEY" \3  -F "[email protected]" \4  -F "size=full"
3

回應

201 Created · JSON
1{2  "url": "https://cdn.pixmiller.com/result/8Kd2pQ.png"3}
url 處理後圖片的臨時 URL(原始圖片會在 3 天後自動刪除)。
4

錯誤

錯誤返回對應的狀態碼和以下格式的 JSON 主體 {"errors":{"code":"…","message":"…"}}.

400 validation error 缺少或無效的 image_file、檔案過大,或圖片來源衝突。
401 authentication_failed 缺少或無效的 X-Api-Key 標頭。
402 not_enough_credit 請求了 size=full,但帳戶已無高畫質點數。
422 invalid_image 無法處理此圖片 — 圖片過小、格式不支援或解碼失敗。
429 throttled 超出速率限制。請放慢速度,並在 Retry-After 標頭後重試。
5

Migrating from remove.bg

Change the base URL — your existing request keeps working.
remove.bg stops accepting self-serve API requests on 2026-12-01. PixMiller mirrors its main path at POST /v1.0/removebg — same X-Api-Key header, same parameter names, HTTP 200 with the image bytes in the body. A matching GET /v1.0/account returns your credit balance.
Before · remove.bg
1curl -H "X-Api-Key: REMOVEBG_KEY" \2  -F "[email protected]" \3  -F "size=auto" \4  -o out.png \5  https://api.remove.bg/v1.0/removebg
After · PixMiller
1curl -H "X-Api-Key: PIXMILLER_KEY" \2  -F "[email protected]" \3  -F "size=auto" \4  -o out.png \5  https://api.pixmiller.com/v1.0/removebg
size mapping
remove.bg value PixMiller tier 說明
preview / small / regular preview Watermarked preview, up to 640 px. Free — no credit charged. This is the default, as on remove.bg.
medium / hd / 4k / full / 50MP full Full-resolution, watermark-free result, downscaled to the tier's megapixel cap (1.5 / 4 / 25 / 25 / 50 MP; PNG output is capped at 10 MP). 1 credit per image.
auto auto Full resolution when credits are available, free watermarked preview otherwise.
Response headers
X-Credits-Charged Credits actually deducted by this call (0 for the free preview tier).
X-Width / X-Height Pixel dimensions of the returned image.
X-Type Detected foreground class: person, product, animal, car or other (omitted with type_level=none).
X-Foreground-Top / -Left / -Width / -Height Bounding box of the subject in the returned image.
X-RateLimit-Limit / -Remaining / -Reset Rate limit state for your key, counted per image — one call uses one unit; Retry-After is added on 429.
Parameters without effect

Every remove.bg parameter is accepted and validated — size, type, type_level, format, roi, crop, crop_margin, scale, position, channels, bg_color, bg_image_url and bg_image_file behave as documented by remove.bg. These are accepted but never change the output, as on remove.bg for non-car subjects: shadow_type, shadow_opacity, add_shadow, semitransparency

Known differences
  • size=preview (and its aliases small / regular — the default, as on remove.bg) returns our free, watermarked preview at up to 640 px and costs no credit; remove.bg returns a 0.25-megapixel image without watermark for 0.25 credits.
  • medium, hd, 4k, full and 50MP all cost 1 credit, as on remove.bg. There is no free monthly preview quota, so /v1.0/account always reports free_calls = 0.
  • X-Type is a coarse class (person / product / animal / car / other) derived from the segmentation model that was used; type_level = 2 and latest return the same coarse classes.
  • Shadows (shadow_type / shadow_opacity / add_shadow) and car-window semitransparency are accepted but never rendered — as on remove.bg for non-car subjects.
  • Input files are limited to 20 MB (remove.bg: 22 MB).

Errors on this endpoint use the remove.bg JSON:API envelope {"errors":[{"title":"…","code":"…"}]} with 400 invalid_parameter / 402 insufficient_credits / 403 auth_failed / 429 rate_limit_exceeded.

This is a compatibility layer for the main HTTP path, not a certified drop-in for the official SDKs or CLI.

為什麼選擇線上去背 API

PNG/JPG 輸出
~5s 每張圖片
40/min 批次處理量
3d 自動刪除
髮絲級邊緣 毛髮、毛皮和半透明邊緣透過乾淨的 alpha 通道自動處理——無光暈、無硬切割。
5 秒內回應 單張圖片通常在 5 秒內同步返回結果 URL。
專為批次設計 高流量穩定處理量;搭配並發和重試,無縫接入你的流水線。
幾分鐘即可串接 純 REST 加可複製範例;新帳號免費獲得一個高畫質點數用於測試。

開發者在哪裡使用線上去背 API

電商大量上架

把賣家上傳的商品照變成符合平台規範的白色或透明主圖,無需手動編輯。

應用內去背景

把一鍵去背景嵌入你的設計、圖庫或建站產品——調用 API,拿到結果。

自動化工作流程

接入 ERP / DAM / 腳本,新圖入庫時自動摳圖歸檔。

1 建立 API 金鑰 在 API 密鑰頁面創建密鑰。新帳號免費獲得一個高畫質點數用於測試。
2 發送請求 複製上面的範例,換上你的密鑰和圖片,執行第一次調用。
3 進入正式環境 調整並發和重試次數,然後上線——按張計費,量大可議價。

開發者常見問題

支援哪些圖片?

JPG / PNG / WebP / BMP 最大 20MB,低於 50 百萬像素(最長邊 32–10000px)。輸出為原始解析度的透明 PNG,最大 4096×4096。

如何計費?

每張成功處理的圖片——full 尺寸 = 1 點數;preview 尺寸(帶浮水印)免費測試。新帳號免費獲得一個高畫質點數。

size 參數有什麼作用?

preview 和 auto 返回帶浮水印的預覽;full 返回 Full HD 結果並使用 1 點數。

速率限制是多少?

預設每個密鑰每分鐘最多 40 張圖片;聯繫我們以提高限制。

其他工具 API

互動式參考

完整的 OpenAPI 規格——在下方對你的帳號進行即時測試。

使用 PixMiller API 開發 取得您的 API 金鑰