Developer documentation

SVG AI API & MCP Server

Use SVG AI from your own code or from AI agents. Two capabilities: generate designs a new SVG from a text brief, an image, or both; vectorize traces an existing image into a pixel-faithful SVG.

Quick facts

  • Base URL: https://www.svgai.org
  • MCP endpoint: https://www.svgai.org/api/mcp (streamable HTTP)
  • Auth: API key from the API & MCP console, sent as Authorization: Bearer sk_svgai_…
  • Credits are shared with your SVG AI account — the same balance the dashboard uses. Get credits
  • Try it without writing code: the console has one-click agent setup snippets and a live playground.

Generate vs. vectorize

Rule of thumb: if the output should look exactly like the input, use vectorize. If the output should be redesigned, cleaned up, or created from scratch, use generate.

GenerateVectorize
What it doesComposes a clean, flat, vector-native design and returns final SVG paths. An input image is used as the subject or reference and redrawn as clean vector artwork.Traces the input image into SVG paths exactly — shapes and colors preserved, nothing redrawn or reinterpreted.
Best forNew logos, icons, illustrations; turning photos, sketches, or rough rasters into polished SVGs; restyling.Logos, icons, and flat artwork that are already clean and just need to become real vectors.
CostClassic: 2 credits · Ultra: 4 credits (per variation)1 credit
Typical time25–90 seconds3–10 seconds

Classic is fast and great for icons and simpler designs. Ultra renders more detail and handles text-heavy logos and complex briefs better. Generations made through the API also appear in your SVG AI dashboard.

Authentication

Create a key in the API & MCP console (Dashboard → API & MCP). The full key is shown once at creation. Send it on every request:

Authorization: Bearer sk_svgai_...        # preferred
x-api-key: sk_svgai_...                   # alternative header

Keys can be revoked any time from the console. Rate limits: 20 generations and 30 vectorizations per minute per account.

POST /api/v1/generate

Create one or more SVGs from a prompt, an image, or both.

FieldTypeDescription
promptstringWhat to create, in plain language. Optional when an image is provided. Max 4,000 chars.
imagestringBase64 source/reference image (raw or data URL). PNG, JPEG, or WebP, up to 8 MB.
image_urlstringAlternative to image: a publicly reachable http(s) URL.
modelstring"classic" (default, 2 credits) or "ultra" (4 credits).
variationsinteger1–4 designs per request (default 1). Each variation is charged.
transparent_backgroundstring"auto" (default), "on", or "off".
aspect_ratiostring"default" or "square" (forces a 1:1 canvas).
waitbooleanDefault true: the response holds until the final SVG is ready. With false you get HTTP 202 and poll the generation instead.
curl -X POST https://www.svgai.org/api/v1/generate \
  -H "Authorization: Bearer sk_svgai_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt": "minimal fox logo, orange and white", "model": "classic"}'

Response

{
  "object": "svg.generation",
  "id": "6dce86db-…",              // use with GET /api/v1/generations/:id
  "status": "completed",           // completed | processing | failed
  "model": "classic",
  "credits_used": 2,
  "credits_remaining": 148,
  "svgs": [
    { "design_id": "8acc61ce-…", "status": "completed", "svg": "<svg …>…</svg>" }
  ]
}

A failed generation refunds its credits automatically. If the request outlives the wait window, you receive status: "processing" plus a poll_url.

GET /api/v1/generations/:id

Fetch the state and results of an earlier generation by its id. Same response shape as above (without credit fields).

POST /api/v1/vectorize

Convert an existing image into a pixel-faithful SVG. Send image (base64) or image_url; images should be at least 256×256 pixels. Optional remove_background: true isolates the main subject on a transparent background before tracing.

curl -X POST https://www.svgai.org/api/v1/vectorize \
  -H "Authorization: Bearer sk_svgai_..." \
  -H "Content-Type: application/json" \
  -d '{"image_url": "https://example.com/logo.png"}'

// → { "object": "svg.vectorization", "status": "completed",
//     "svg": "<svg …>…</svg>", "background_removed": false,
//     "credits_used": 1, "credits_remaining": 147 }

GET /api/v1/credits

{
  "object": "credit.balance",
  "credits_remaining": 148,
  "subscription_active": true,
  "costs": { "generate_classic": 2, "generate_ultra": 4, "vectorize": 1 },
  "topup_url": "https://svgai.org/pricing"
}

Errors

Every error is { "error": { "type", "message" } } with a matching HTTP status:

TypeStatusMeaning
invalid_request400Malformed input; the message says which field.
authentication_error401Missing, invalid, or revoked API key.
insufficient_credits402Includes credits_remaining and credits_required.
rate_limit_exceeded429Includes retry_after_seconds.
generation_error502The pipeline failed; credits were refunded.

MCP server (for AI agents)

The MCP server at https://www.svgai.org/api/mcp exposes three tools — generate_svg, vectorize_image, and get_credits — over streamable HTTP, authenticated with the same API keys.

Claude Code

claude mcp add --transport http svgai https://www.svgai.org/api/mcp \
  --header "Authorization: Bearer sk_svgai_..."

Claude.ai

Settings → Connectors → Add custom connector → URL https://www.svgai.org/api/mcp. Where the request-headers option is available, add an Authorization header with value Bearer sk_svgai_….

ChatGPT (developer mode)

Settings → Apps & Connectors → enable Developer mode → Create connector with the same URL and Authorization header.

Cursor / Windsurf / other MCP clients

{
  "mcpServers": {
    "svgai": {
      "url": "https://www.svgai.org/api/mcp",
      "headers": { "Authorization": "Bearer sk_svgai_..." }
    }
  }
}

Notes

  • Use https://www.svgai.org (with www) — the apex domain redirects.
  • SVG outputs are sanitized and ready to embed, edit, or cut.
  • Questions or higher limits: contact us.