API documentation

Turn text, images, and video into structured results.

A single API endpoint for reliable, structured outputs from text, images, and video. You describe the fields you want back, and every field comes with its own confidence score.

View OpenAPI spec
Example outputJSON
{
  "label": {
    "value": "spam",
    "confidence": 0.99
  },
  "severity": {
    "value": 3,
    "confidence": 0.99
  },
  "reason": {
    "value": "Spam: Unsolicited promotion of a product using disguised links, discount codes, and high-pressure sales tactics.",
    "confidence": 0.71
  },
  "tags": {
    "value": [
      "advertising"
    ],
    "confidence": null
  }
}

Overview

Svift turns text, images, and video into short, structured answers. You describe the fields you want back, and every field comes back with its own confidence score. You don’t choose models, count tokens, or manage infrastructure.

Base URL
https://api.svift.ai
Endpoint
POST /v1/run

Quick start

Send a request to classify a comment for moderation. New to Svift? Start with the hello world tutorial.

curl https://api.svift.ai/v1/run \
  -H "Authorization: Bearer $SVIFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<'EOF'
{
  "instructions": "You moderate comments on a public community forum. Classify the comment under this policy.\n\nLabels\n- ok: allowed content, including criticism, opinions, and strong language that is not aimed at a person.\n- spam: unsolicited promotion of products, services, or links, affiliate or discount codes, and attempts to move readers to another site or contact channel.\n- abuse: harassment, threats, hate speech, or personal attacks against a person or group.\n\nSeverity\n- 0: the label is ok.\n- 1 (low): minor promotion with little risk, such as a single link to the author's own project.\n- 2 (medium): deliberate spam or abuse that should be removed, such as repeated advertising, disguised links, or insults.\n- 3 (high): content that can cause real harm: scams, phishing, selling drugs or prescription medicines without a prescription, threats, or targeted hate.\n\nTags: up to 5 options that describe what the comment contains or how it tries to get past filters; none when nothing applies.",
  "input": "Great write-up, thanks for sharing! 🙏 Honestly this helped me more than my doctor did 😅 For anyone else dealing with low energy: I switched to the 𝗡𝗔𝗧𝗨𝗥𝗔𝗟 option my cousin recommended 💊✨ no prescription needed, ships discreetly 📦 ➡️ v i t a - b o o s t [dot] example / deal 👈 Use code THANKYOU50 for 50% off, only a few left this week ⏳🔥",
  "output": {
    "label":    {"type": "string", "enum": ["ok", "spam", "abuse"], "description": "label under the policy"},
    "severity": {"type": "integer", "minimum": 0, "maximum": 3, "description": "0 when the label is ok, else 1 to 3 as the policy defines"},
    "reason":   {"type": "string", "max_length": 128, "description": "Provide a reason for the label."},
    "tags":     {"type": "array", "items": {"type": "string", "enum": ["advertising", "medication", "financial_scam", "external_link", "discount_code", "urgency", "off_platform_contact", "emoji_padding", "unicode_lookalikes", "obfuscated_link", "misspelling", "harassment", "hate_speech", "threat", "drugs"]}, "max_items": 5, "description": "what the comment contains or how it evades filters"}
  }
}
EOF
Response
{
  "request_id": "01a15eb4-4a1a-7aca-a653-36692bb9ad4c",
  "effort": "medium",
  "output": {
    "label":    {"value": "spam", "confidence": 0.99},
    "severity": {"value": 3, "confidence": 0.99},
    "reason":   {"value": "Spam: Unsolicited promotion of a product using disguised links, discount codes, and high-pressure sales tactics.", "confidence": 0.71},
    "tags":     {"value": ["advertising"], "confidence": null}
  },
  "usage": {"input_tokens": 2090, "output_fields": 4}
}

Authentication

Send your API key as a bearer token:

Header
Authorization: Bearer svift_sk_...

Keys start with svift_sk_ and are 52 characters long. They are shown once, when they are created. Keep them on your server and never put them in browsers or mobile apps. If a key leaks, ask us to revoke it and issue a new one; your account can have several keys, so you can rotate without downtime. A revoked key stops working within about 10 seconds.

Request

POST /v1/run as JSON, or as multipart/form-data when you send files. The body is at most 1 MiB without media, and 70 MiB with media.

FieldTypeRequiredDescription
inputstringunless mediaThe text to process. Required and not blank unless you send media. At most 20,000 tokens, or 4,000 tokens when media is attached.
mediaarraynoUp to 16 images, and at most one video. See Media.
instructionsstringnoWhat to do with the input, for example “Classify this comment for moderation.” At most 4,000 tokens.
outputobjectyesThe fields you want back, 1 to 16 of them. See Output fields.
max_effortstringnolow, medium, or high. Default high. The highest effort the request may reach. See Limiting effort.

Unknown keys are rejected, so a typo like "intructions" gives a 400 error instead of being silently ignored.

Token limits are measured with the model’s tokenizer. As a rule of thumb, one token is about four characters of English text, so 20,000 tokens is roughly 80,000 characters and 4,000 tokens is roughly 16,000.

Output fields

output maps field names to field definitions. Fields come back in the order you list them.

Put everything a field needs into instructions or its description, and don’t rely on one field’s answer to decide another: enum fields are answered first, and each can be answered again on its own, before the other fields. To ask for a field only for some enum answers, use when.

Field names must start with a lowercase letter and contain only a-z, 0-9, and _, at most 64 characters. They can’t end in _confidence.

Every field has a type and an optional description (at most 512 characters). The model reads the description, so use it to explain what you want, for example "description": "the main product mentioned, as written in the text".

typeOptionsValue you get back
stringenum: 1 to 256 allowed values, or max_length: character limit, default 128, capped at 256. Not both.string
integerminimum, maximum (whole numbers)integer
floatminimum, maximumnumber
arrayitems: a string, integer, or float field definition (required); max_items: 1–128 (default 128)array

Rules:

  • enum has 1 to 256 options. They must be unique and non-empty, with at most 128 characters each.
  • If the model writes more than a field’s max_length, the value is cut to the limit. A max_length above 256 is accepted and capped at 256. The same limit applies to each item of a string array.
  • For an integer field, minimum and maximum are whole numbers between −2^53 and 2^53.
  • Arrays can’t contain arrays.
  • Options only apply to their own type. For example, minimum on a string field is an error.
  • Any field without enum can have when. See Conditional fields.

Examples:

JSON
{
  "sentiment": {"type": "string", "enum": ["positive", "neutral", "negative"]},
  "summary":   {"type": "string", "max_length": 100, "description": "one sentence"},
  "stars":     {"type": "integer", "minimum": 1, "maximum": 5},
  "price":     {"type": "float", "minimum": 0, "description": "price in EUR, 0 if not mentioned"},
  "languages": {"type": "array", "items": {"type": "string", "enum": ["en", "sv", "de", "fr"]}, "max_items": 4}
}

Conditional fields

when asks for a field only when enum fields got certain answers. It maps one or more enum fields of the same request to a list of their options. Here reason and severity are only wanted when the comment is spam or abuse:

cURL
curl https://api.svift.ai/v1/run \
  -H "Authorization: Bearer $SVIFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "Classify this comment for moderation.",
    "input": "Thanks for the great article, it helped me fix my bike.",
    "output": {
      "label":    {"type": "string", "enum": ["ok", "spam", "abuse"]},
      "reason":   {"type": "string", "max_length": 100, "when": {"label": ["spam", "abuse"]}},
      "severity": {"type": "integer", "minimum": 1, "maximum": 5, "when": {"label": ["spam", "abuse"]}}
    }
  }'

enum fields are answered first. A field with when is then answered only if every field it names got one of the listed options. Otherwise no model is asked for it, it is left out of output, and it isn’t charged. This comment is labeled ok, so only label comes back, and the request costs 1 unit instead of 3:

Response
{
  "request_id": "019a0f3c-...",
  "effort": "low",
  "output": {
    "label": {"value": "ok", "confidence": 0.99}
  },
  "usage": {"input_tokens": 112, "output_fields": 1}
}
  • An enum field that comes back unknown (value: null) meets no condition, so the fields that depend on it are left out.
  • The fields named in when must be string fields with enum in the same request, and each listed option must be one of theirs. Options must be unique.
  • With more than one field in when, all of them must match.
  • when isn’t supported on enum fields or on array items.

Media

You can attach up to 16 files: images, and at most one video. The models see them in the order you list them, before input. Images and videos have no price of their own, but each picture adds to usage.input_tokens, which can double the cost per field. See Quota. Links are not accepted.

  • Images: JPEG, PNG, or WebP, at most 10 MiB and 7680×4320 each. Each image is scaled to at most 1024 pixels on its longest side.
  • Video: at most one, in MP4, MOV, WebM, MKV, or GIF, at most 50 MiB, 3 minutes, and 3840×2160. It is shown as its most informative frame per 2-second span, plus briefly shown frames, each labelled with its time. A request shows at most 48 pictures in total. The sound track is ignored.
  • Together: all media in one request is at most 50 MiB.

Send the files as base64 inside the JSON body, or as file parts in multipart/form-data. Each media item has a type of image or video, and exactly one of data or part.

  • JSON: data is the file as standard base64 with padding, without a data: prefix.
  • Multipart: the first part is the JSON request, named request, with content type application/json. Each media item sets part to the name of the file part that holds the file. Part names are free except request, and every file part is named by exactly one media item.

A file that can’t be used, such as a corrupt or too long video, is rejected with 400.

{
  "instructions": "Describe what the image shows.",
  "media": [{"type": "image", "data": "<base64>"}],
  "output": {
    "caption": {"type": "string", "max_length": 120}
  }
}

Response

A successful request returns 200 with:

FieldDescription
request_idUnique ID of the request, also in the X-Request-Id header. Include it when you contact support.
effortlow, medium, or high. Never above the request’s max_effort. See Confidence and effort.
outputOne entry per answered field, in your order: {"value": ..., "confidence": ...}.
usage.input_tokensThe tokens in your request, counted once: your instructions, input and output schema, plus the pictures when you attach media. Above 2,000, every field costs 2 quota units.
usage.output_fieldsNumber of fields returned. Each one is charged: 1 quota unit, or 2 when usage.input_tokens is above 2,000.

Every requested field is present in output, except a conditional field whose when wasn’t met.

  • confidence is a number from 0 to 0.99: how likely the value is to be correct.
  • For arrays confidence is null, because arrays aren’t scored.
  • value: null with confidence: 0 means the model couldn’t give a valid answer for that field, for example a value outside minimum/maximum or not in enum. Treat it as unknown.

Confidence and effort

Every field comes back with a confidence score. As a guide to reading it:

confidenceLevel
≥ 0.9Very high
≥ 0.8High
≥ 0.7Medium
< 0.7Low

Every field is answered by a fast model, and enum fields are also answered by a second model. If the models aren’t confident enough in an enum field, both answer that field again with reasoning, and the majority wins. The hardest fields then go to a larger model. effort is low when no enum field was answered again, medium when at least one needed the reasoning step, and high when at least one went to the larger model.

What this means in practice:

  • A field can still come back with low confidence. The answer is returned with its confidence, even when it stays low after the reasoning step. Decide in your code what to do with low-confidence values, for example sending them for human review.
  • Only enum fields are answered again. Arrays aren’t scored, so their confidence is null. Other field types are answered by the fast model only.
  • Price is the same either way: effort doesn’t affect what a field costs. See Quota.

A request with one field typically completes with a p95 latency under 800 ms. The reasoning step and the larger model take longer, and so do long inputs and video. Set your HTTP client timeout to at least 30 seconds, so that slow requests aren’t cut off.

Limiting effort

Set max_effort to cap how far a request may go. The response’s effort is never above it.

max_effortWhat it allowsTypical latency
lowOnly the first answer from the two models. No field is answered again.0.2–0.5 s
mediumThe reasoning step, but not the larger model.0.5–1.5 s
high (default)Everything.1–10 s
  • Trade-off: a lower max_effort makes responses faster and latency more predictable, at the cost of accuracy on the harder fields.
  • Capped fields: a field that would have been answered again keeps the answer it had, with its confidence, which is usually lower.
  • Price: unchanged. max_effort doesn’t affect what a field costs.
  • Scope: it only affects enum fields, because other fields are never answered again. Requests with images or video are already always low.

This request returns the first answer for label and never answers it again:

JSON
{
  "instructions": "Classify this comment for moderation.",
  "input": "BUY CHEAP PILLS!!!",
  "max_effort": "low",
  "output": {
    "label": {"type": "string", "enum": ["ok", "spam", "abuse"]}
  }
}

The value must be exactly low, medium, or high. Anything else, such as "Low", an empty string, or a number, is rejected with 400 invalid_request and field set to max_effort.

Quota

Your account has a prepaid balance of field units. Each request costs one unit per answered output field, and an array counts as one field. When a request’s usage.input_tokens is above 2,000, every answered field costs 2 units instead of 1. A request with exactly 2,000 costs 1 per field. The 4-field quick-start request costs 4 units, or 8 if its usage.input_tokens is above 2,000.

  • What counts: usage.input_tokens covers the instructions, input and output schema, plus the pictures of any media.
  • Media: images and videos have no price of their own, but each picture adds up to a few hundred tokens. A request with several images or a video is usually above 2,000.
  • Checking a charge: the cost is usage.output_fields, times 2 if usage.input_tokens is above 2,000.
  • Fields: a field that comes back as null still counts. A conditional field whose when wasn’t met costs nothing.
  • Effort: effort and max_effort don’t affect the price.

A request is only accepted when your balance covers every requested field, conditional ones included. If the balance is too low, the request is rejected with 402 quota_exceeded, and nothing is charged.

  • Balance needed: a request that could be above 2,000 input tokens needs 2 units per field in the balance to be accepted, even if it ends up costing 1. That applies when it has media, or more than about 1,000 characters of text and schema.
  • Invalid requests (400, 401, 413, 415) are never charged.
  • If processing fails (502, 503, 504), nothing is charged.

Checking your balance

GET /v1/quota returns the remaining quota of the account the API key belongs to. It costs nothing, and it has no request body or parameters.

cURL
curl https://api.svift.ai/v1/quota -H "Authorization: Bearer $SVIFT_API_KEY"
Response
{"request_id": "019a0f3c-...", "quota": 9412}
FieldDescription
request_idUnique ID of the request, also in the X-Request-Id header.
quotaRemaining balance in field units, after everything charged so far. Never below 0.
  • All keys of an account share one balance.
  • Requests still being processed aren’t subtracted until they finish.
  • A top-up takes a few seconds to show.
  • Errors are 401 unauthorized and 503 unavailable, in the standard error shape.
  • It also works on https://api-eu.svift.ai.

Errors

Errors have this shape:

JSON
{
  "request_id": "019a0f3c-...",
  "error": {
    "type": "invalid_request",
    "message": "at most 16 fields are allowed",
    "field": "output"
  }
}

field is the part of the request that caused the error, such as input, max_effort, output.reason.max_length, output.label.enum[2] or media[0].data. It is left out when the error isn’t about a specific field.

StatustypeMeaningWhat to do
400invalid_requestThe request breaks a rule above, or a file can’t be used, such as a corrupt or too long video.Fix the request; message and field say what’s wrong.
401unauthorizedAPI key missing, malformed, unknown, or revoked.Check the Authorization header.
402quota_exceededNot enough quota for this request.Top up your balance. GET /v1/quota shows what’s left.
413invalid_requestBody larger than 1 MiB without media, or 70 MiB with media.Send less text, or smaller files.
415invalid_requestContent-Type is neither application/json nor multipart/form-data.Set the header.
500internal_errorUnexpected error.Retry; contact us with the request_id if it persists.
502upstream_errorThe model couldn’t produce a valid result, or a file couldn’t be processed.Retry with backoff. Not charged.
503unavailableA backend is temporarily down, or too many large uploads are being processed.Retry with backoff. Not charged.
504timeoutThe request took too long.Retry, or send a shorter input or video. Not charged.

For 500, 502, 503, and 504, retry with exponential backoff, for example 1 s, 2 s, 4 s, at most about 5 attempts. Don’t retry 4xx errors without changing the request.

Let’s build what’s next

Show us your BS (and we’ll help you fix it).

Bring a real task. We’ll run it across the top models and show you where they make things up, which one wins, and what it costs.

Talk to us

Tell us a little about your use case and we’ll get back to you.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.