v3

OpenAPI 3.1.02026-08-0142173.5 KB
Create SVGs

Text to SVG

Generates one or more SVGs from a prompt and optional references.

post/v1/svgs/generations

Headers

x-trace-idstring

Optional client-supplied trace identifier. The API echoes this value in X-Trace-ID and includes it in request logs for client-side correlation.

Example:trace_01J9AZ3XJ7D5S9ZV2Q5Z8E1A4N

Optional client-supplied trace identifier. The API echoes this value in X-Trace-ID and includes it in request logs for client-side correlation.

Request body

max_output_tokensinteger

Upper bound for output token count.

modelstring required

Model identifier to use for generation or vectorization.

presence_penaltynumber nullable

Penalty for tokens already present in prior output.

streamboolean

When true, emits a Server-Sent Events stream.

temperaturenumber

Sampling temperature.

top_pnumber

Nucleus sampling probability.

instructionsstring

Additional style or formatting guidance.

ninteger

Number of outputs to generate.

promptstring required

Primary text prompt that describes the desired SVG.

Example request

{
  "attributes": {
    "viewBox": {
      "height": 512,
      "width": 512
    }
  },
  "max_output_tokens": 4096,
  "model": "arrow-1.1",
  "presence_penalty": 0.2,
  "temperature": 0.4,
  "top_p": 0.95,
  "instructions": "Use a flat monochrome style with clean geometry.",
  "n": 1,
  "prompt": "Generate an icon of a unicorn",
  "references": [
    {
      "url": "https://example.com/uploads/reference1.png"
    }
  ]
}

Response

When stream is false, returns application/json with the full SVG response. When stream is true, returns text/event-stream with Server-Sent Events. Each SSE message contains an event: line (generating, reasoning, draft, or content) and a data: line with a JSON payload. For n > 1, events are interleaved across outputs, each output keeps a stable data.id, and data.index indicates the output position. usage token fields are deprecated and set to 0; use credits for billing values. For streaming, credits is emitted on completed content events. The stream terminates with data: [DONE].

createdinteger required
creditsinteger

Credit cost for this request. Use this for billing instead of usage tokens.

idstring required

Example response

{
  "created": 1704067200,
  "credits": 1,
  "data": [
    {
      "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 2l8 20H4z\"/></svg>"
    }
  ],
  "id": "resp_01J9AZ3XJ7D5S9ZV2Q5Z8E1A4N"
}