REST API Reference

Unlimited-SVG 开发者 API

通过单一 REST 接口,将 PNG、JPG、WebP 图片程序化转换为经过 XML 校验与安全净化的纯净 SVG 矢量文件。

管理 API 密钥

接口地址与鉴权方式

POSThttps://unlimited-svg.run/api/v1/image-to-svg

所有请求需在请求头携带 Authorization: Bearer <API_KEY> 或 X-API-Key: <API_KEY>。可在控制台随时创建或吊销密钥。每次成功转换扣除 1 积分,失败自动退还。

API access requires an active paid subscription or purchased credit pack (free accounts receive HTTP 403; accounts with zero remaining credits receive HTTP 402).

请求参数说明

FieldTypeDefaultDescription
filebinarymultipartPNG, JPG, or WebP upload up to 10 MB when sending multipart/form-data.
image_base64 / image_urlstringjsonProvide exactly one of image_base64 or public HTTP(S) image_url for JSON requests.
presetenumlogoOne of logo, diagram, illustration, or photo. Automatically tunes sampling temperature.
detail_levelenumultraOne of standard (single-pass), detailed (Best-of-4 512px Edge F1 scorer), or ultra (Best-of-4 plus 32x32 Masked-Clip ROI detail repair).
response_formatenumjsonUse json for metadata plus SVG text, or svg to stream raw image/svg+xml directly.

快速接入示例

curl -X POST "https://unlimited-svg.run/api/v1/image-to-svg" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -F "file=@logo.png" \
  -F "preset=logo" \
  -F "detail_level=standard" \
  -F "response_format=svg" \
  -o logo.svg

JSON 返回示例

{
  "id": "f4c9a1d2-...",
  "model": "baidu/Unlimited-SVG",
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 1024\">...</svg>",
  "valid_xml": true,
  "path_count": 63,
  "svg_bytes": 10035,
  "ssim": 0.8861,
  "edge_f1": 0.9629,
  "local_score": 0.9643,
  "visual_score": 0.9376,
  "roi_accepted": 1,
  "elapsed_seconds": 13.55,
  "completion_tokens": 1766,
  "credits_charged": 1
}