Reference

API reference for every route

Models

The models a key may call, with what each is sold for.

The models this key may call. A model with no price is absent; it is not for sale.

GET/v1/models

Example request

curl https://sven.swedishembedded.com/v1/models \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The models this key may call, as a list. `pricing` states what a model is sold for in exact US dollars, as text: per token for `prompt` and `completion`, per image for `image`, "0" for a fee not charged. `supported_parameters` is as the model's provider listed it, null where nobody did.

The models this key may call. A model with no price is absent; it is not for sale.: 200 response
NameTypeDescription
objectrequiredstring, only list 
default_modelstring

The model this account's sessions start with when none is named.

datarequiredarray of object

The models, one entry each.

data[].idrequiredstring

The name to send as model.

data[].objectrequiredstring, only model 
data[].namestring

What people call the model.

data[].descriptionstring

A line about the model.

data[].context_lengthinteger

How many tokens of conversation it can take; null where unknown.

data[].architectureobject

What the model reads and writes.

data[].architecture.input_modalitiesarray of string

For example text and image.

data[].architecture.output_modalitiesarray of string 
data[].architecture.tokenizerstring 
data[].top_providerobject 
data[].top_provider.max_completion_tokensinteger

The longest answer it can write; null where unknown.

data[].supported_parametersarray of string

The request parameters the model takes.

data[].image_parametersobject

For an image model: the parameters it takes with their allowed values, and how many reference images a call may carry.

data[].image_parameters.parametersobject

By name: {type: enum, values}, {type: range, min, max} or {type: boolean}.

data[].image_parameters.max_referencesinteger

The most reference images one call may carry.

data[].capabilitiesrequiredarray of string, one of chat, tools, embeddings, images, transcription, speech

What the model can be called for.

data[].pricingrequiredobject

What the model is sold for, in exact US dollars as text.

data[].pricing.promptstring

Per input token (per second of audio for a speech-to-text model

data[].pricing.completionstring

Per output token.

data[].pricing.imagestring

Per image: what a typical image is charged (about a megapixel, a short prompt, no reference image). A call is charged what its image cost, so a larger image or one with references costs more, never more than image_max.

data[].pricing.image_maxstring

For an image model: the most one image is ever charged, the largest size and every reference counted. What a call is held at before it runs.

data[].pricing.requeststring 
data[].pricing.web_searchstring 
data[].pricing.internal_reasoningstring 
data[].zero_data_retentionboolean

True when a call to the model keeps no data anywhere.

data[].needs_data_sharingboolean, only true

Present when the model is served only by providers that may keep data and the person the key acts for has not allowed sharing data with it: a call is refused (403, data_sharing_not_allowed) until they allow it.

data[].supported_voicesarray of string

The voices a text-to-speech model can say a text in.

json
{
  "object": "list",
  "default_model": "MODEL_ID",
  "data": [
    {
      "id": "MODEL_ID",
      "object": "model",
      "name": "Model name",
      "context_length": 131072,
      "capabilities": [
        "chat",
        "tools"
      ],
      "zero_data_retention": true,
      "pricing": {
        "prompt": "0.0000001",
        "completion": "0.0000004",
        "request": "0",
        "image": "0",
        "web_search": "0",
        "internal_reasoning": "0"
      }
    }
  ]
}

Errors

The models this key may call. A model with no price is absent; it is not for sale.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

Every refusal carries the error object described on Errors.

Allow a model that may keep data, for the next call or from now on.

POST/v1/data-sharing

The answer a person gives in their own terminal when an agent asks to use a model served only by providers that may keep data (needs_data_sharing in the model list). once lets the next call to it through within 15 minutes; always sets the model to Allow under Settings, Models. Only a key the person issued and that acts for them may send it: a key of a hosted or cloud environment or of a case run is refused, so an agent cannot allow a model for itself.

Request body application/json

Allow a model that may keep data, for the next call or from now on.: application/json body
NameTypeDescription
modelrequiredstring

The model to allow.

allowrequiredstring, one of once, always

once: the next call; always: from now on.

Example request

curl https://sven.swedishembedded.com/v1/data-sharing \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "allow": "once"}'

Responses

200 Recorded.

Allow a model that may keep data, for the next call or from now on.: 200 response
NameTypeDescription
modelrequiredstring 
allowrequiredstring, one of once, always 
json
{
  "model": "MODEL_ID",
  "allow": "once"
}

Errors

Allow a model that may keep data, for the next call or from now on.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

403permission_error

The key was not issued by the person it acts for (a key of an environment or a case run), or error.code is data_sharing_forbidden: the person's organisation does not allow sharing data with model providers.

Every refusal carries the error object described on Errors.

Chat

Chat with a model, streamed or whole, with tools and images.

Chat completion, optionally streamed as server-sent events.

POST/v1/chat/completions

Send a conversation, get the model's reply.

Limits: at least one message; n is 1; images are base64 data URLs of PNG, JPEG, GIF or WebP, up to 10 MiB each; the body is at most 32 MiB; a conversation longer than the model can take is refused with 400 on messages. A key and an account have rate limits; a call refused for one says when to retry in Retry-After.

Parameters

Chat completion, optionally streamed as server-sent events.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

Request body application/json

Chat completion, optionally streamed as server-sent events.: application/json body
NameTypeDescription
modelrequiredstring

A model id from GET /v1/models.

messagesrequiredarray of object, at least 1 item

The conversation. Each message has a role (system, user, assistant or tool) and content: text, or for a user message a list of text and image_url parts (an image is a base64 data URL).

temperaturenumber, 0 to 2 
top_pnumber, 0 to 1 
max_tokensinteger, at least 1

The most tokens to write.

max_completion_tokensinteger, at least 1

The same limit under its newer name; it wins when both are sent.

stopstring or array of string

Where the model stops writing.

ninteger, only 1

Only 1 is accepted.

toolsarray of object

Functions the model may call, as {type: function, function: {name, description, parameters}}.

tool_choicestring or object

none, auto, required, or a named function.

streamboolean

Server-sent events instead of one JSON body.

stream_optionsobject 

Example request

curl https://sven.swedishembedded.com/v1/chat/completions \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "messages": [{"role": "user", "content": "Hello"}]}'

Responses

200 The completion (`application/json`), or with `stream` an event stream (`text/event-stream`) of `chat.completion.chunk` objects that ends with `data: [DONE]`.

Chat completion, optionally streamed as server-sent events.: 200 response
NameTypeDescription
idrequiredstring

The completion's id.

objectrequiredstring, only chat.completion 
createdrequiredinteger

When it was made

modelrequiredstring

The model that answered.

choicesrequiredarray of object

The reply; always one choice.

choices[].indexinteger 
choices[].messageobject 
choices[].message.rolestring, only assistant 
choices[].message.contentstring

The text; null when the model called a tool.

choices[].message.tool_callsarray of object

The tools the model called, each with the id to answer in a tool message.

choices[].message.tool_calls[].idstring 
choices[].message.tool_calls[].typestring, only function 
choices[].message.tool_calls[].functionobject 
choices[].finish_reasonstring, one of stop, length, tool_calls, content_filter

Why the reply ended.

usagerequiredobject

What the call is charged for.

usage.prompt_tokensinteger

Every input token

usage.completion_tokensinteger 
usage.total_tokensinteger 
usage.prompt_tokens_detailsobject

Present where the model reported it.

usage.prompt_tokens_details.cached_tokensinteger

Input tokens the model had just read and reused

usage.costnumber

What the call was charged

json
{
  "id": "chatcmpl-1",
  "object": "chat.completion",
  "model": "MODEL_ID",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 8,
    "total_tokens": 17,
    "cost": 0.000041
  }
}

Errors

Chat completion, optionally streamed as server-sent events.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

403permission_error

The key is restricted to other models, or the model is served only by providers that may keep data and sharing data with it is not allowed. error.code is data_sharing_not_allowed when the person the key acts for has not allowed it (they can: once, or always under Settings, Models), and data_sharing_forbidden when their organization does not allow it (they cannot).

404model_not_found

There is no such model, or it has no price and is not for sale.

409idempotency_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

413invalid_request_error

The body is past the size limit.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

503server_error

The model is temporarily unavailable, or is not for sale right now.

Every refusal carries the error object described on Errors.

Messages

The same chat as messages in the shape Anthropic's clients send, for code that already uses them.

Chat as messages, optionally streamed as server-sent events.

POST/v1/messages

The chat of POST /v1/chat/completions as messages, for code written for Anthropic's clients, which work against it unchanged: they send their anthropic-version for you, and take the API's address without /v1 as their base URL. Versions 2023-06-01 and 2026-10-21 are spoken; under 2026-10-21, temperature, top_p and top_k and a user's text with citations are refused with 400, as that version removed them. Any other version, and the anthropic-beta header, are refused with 400, and extended thinking cannot be switched on. The key may be sent as x-api-key or as a bearer token. Errors come back as {type: error, error: {type, message}}.

Parameters

Chat as messages, optionally streamed as server-sent events.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

anthropic-versionrequiredstring, one of 2023-06-01, 2026-10-21

The API version, 2026-10-21 (what current clients send) or 2023-06-01.

Request body application/json

Chat as messages, optionally streamed as server-sent events.: application/json body
NameTypeDescription
modelrequiredstring

A model id from GET /v1/models.

messagesrequiredarray of object

The conversation, as Anthropic's client sends it: alternating user and assistant messages.

max_tokensrequiredinteger, at least 1

The most tokens to write.

systemstring or array of object

Instructions for the whole conversation, as text or text blocks.

temperaturenumber, 0 to 1 
top_pnumber, 0 to 1 
top_kinteger, 1 to 1000 
stop_sequencesarray of string 
toolsarray of object

Tools the model may call, as Anthropic's clients send them.

tool_choiceobject

How the model chooses among the tools.

thinkingobject

Only {"type": "disabled"} is accepted.

streamboolean

Server-sent events instead of one JSON body.

Example request

curl https://sven.swedishembedded.com/v1/messages \
  -H "x-api-key: $SVEN_API_KEY" \
  -H "anthropic-version: 2026-10-21" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Responses

200 The message, or with `stream` an event stream (`message_start`, `content_block_delta`, `message_delta`, `message_stop` and the others of that kind).

Chat as messages, optionally streamed as server-sent events.: 200 response
NameTypeDescription
idrequiredstring 
typerequiredstring, only message 
rolerequiredstring, only assistant 
modelrequiredstring

The model that answered.

contentrequiredarray of object

The reply as blocks, text or tool_use.

content[].typestring, one of text, tool_use 
content[].textstring

The text of a text block.

content[].idstring

The id of a tool_use block.

content[].namestring

The tool a tool_use block calls.

content[].inputobject

The arguments of a tool_use block.

stop_reasonrequiredstring, one of end_turn, max_tokens, stop_sequence, tool_use

Why the reply ended.

usagerequiredobject

What the call is charged for.

usage.input_tokensinteger

Input read afresh.

usage.output_tokensinteger 
usage.cache_read_input_tokensinteger

Input reused from the cache

json
{
  "id": "msg_1",
  "type": "message",
  "role": "assistant",
  "model": "MODEL_ID",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help?"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 9,
    "output_tokens": 8
  }
}

Errors

Chat as messages, optionally streamed as server-sent events.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter or version that is not supported, or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402billing_error

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost.

403permission_error

The key is restricted to other models, or the model is served only by providers that may keep data and sharing data with it is not allowed. The x-error-code header is data_sharing_not_allowed when the person the key acts for has not allowed it (they can), and data_sharing_forbidden when their organization does not allow it (they cannot).

404not_found_error

There is no such model, or it is not for sale.

409invalid_request_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

429rate_limit_error

Too many calls per minute or at once, or the model is busy; Retry-After says when to retry.

500api_error

Something failed inside the service.

529overloaded_error

The model is temporarily unavailable.

Every refusal carries the error object described on Errors.

Embeddings

Vectors for texts, charged per input token.

Embeddings of one or more texts, as float arrays.

POST/v1/embeddings

Limits: one text or up to 2048, none empty; encoding_format is float (send it explicitly, because some clients ask for another encoding unless told otherwise); dimensions is not accepted.

Parameters

Embeddings of one or more texts, as float arrays.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

Request body application/json

Embeddings of one or more texts, as float arrays.: application/json body
NameTypeDescription
modelrequiredstring

An embedding model id from GET /v1/models.

inputrequiredstring, at least 1 characters or array of string, at least 1 characters, 1 to 2048 items

One text, or up to 2048 texts.

encoding_formatstring, only float 

Example request

curl https://sven.swedishembedded.com/v1/embeddings \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "input": ["Hello", "World"]}'

Responses

200 One embedding per input, charged per input token.

Embeddings of one or more texts, as float arrays.: 200 response
NameTypeDescription
objectrequiredstring, only list 
modelrequiredstring 
datarequiredarray of object

One embedding per input, in order.

data[].objectstring, only embedding 
data[].indexinteger

The input this is the embedding of.

data[].embeddingarray of number

The vector.

usagerequiredobject

What the call is charged for.

usage.prompt_tokensinteger 
usage.total_tokensinteger 
json
{
  "object": "list",
  "model": "MODEL_ID",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.0123,
        -0.0456,
        0.0789
      ]
    },
    {
      "object": "embedding",
      "index": 1,
      "embedding": [
        0.0345,
        0.0211,
        -0.0102
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2
  }
}

Errors

Embeddings of one or more texts, as float arrays.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

404model_not_found

There is no such model, or it has no price and is not for sale.

409idempotency_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

503server_error

The model is temporarily unavailable, or is not for sale right now.

Every refusal carries the error object described on Errors.

Images

Images from a prompt, charged per image delivered.

Images from a prompt, returned inline as base64 PNG.

POST/v1/images/generations

Limits: 1 to 10 images a call, each side of size 1 to 4096; response_format is b64_json, because images are returned inline, never as links.

Parameters

Images from a prompt, returned inline as base64 PNG.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

Request body application/json

Images from a prompt, returned inline as base64 PNG.: application/json body
NameTypeDescription
modelrequiredstring

A model id from GET /v1/models.

promptrequiredstring, at least 1 characters

What to draw.

ninteger, 1 to 10

How many images. Default: 1.

sizestring

WIDTHxHEIGHT, each side 1 to 4096.

response_formatstring, only b64_json 

Example request

curl https://sven.swedishembedded.com/v1/images/generations \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "prompt": "A lighthouse at dawn",
    "n": 1,
    "size": "1024x1024"
  }'

Responses

200 The images, inline; charged per image delivered.

Images from a prompt, returned inline as base64 PNG.: 200 response
NameTypeDescription
createdrequiredinteger

When they were made

datarequiredarray of object

The images, in order.

data[].b64_jsonstring

The image as base64 PNG.

json
{
  "created": 1767225600,
  "data": [
    {
      "b64_json": "iVBORw0KGgo..."
    }
  ]
}

Errors

Images from a prompt, returned inline as base64 PNG.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

404model_not_found

There is no such model, or it has no price and is not for sale.

409idempotency_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

503server_error

The model is temporarily unavailable, or is not for sale right now.

Every refusal carries the error object described on Errors.

Audio

Speech to text, charged by the second of audio.

Speech to text for one recording.

POST/v1/audio/transcriptions

Send the recording as a file in a form, or as base64 in a JSON body. Limits: a WAV, Ogg/Opus or WebM/Opus recording of at most 300 seconds and 8 MiB. Streaming recognition over one connection is not available.

Parameters

Speech to text for one recording.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

Request body multipart/form-data

Speech to text for one recording.: multipart/form-data body
NameTypeDescription
filerequiredfile

A WAV, Ogg/Opus or WebM/Opus recording, at most 300 s and 8 MiB.

modelrequiredstring

A speech-to-text model id from GET /v1/models.

languagestring

The spoken language as an ISO-639-1 code; detected when absent.

response_formatstring, only json 

Request body application/json

Speech to text for one recording.: application/json body
NameTypeDescription
modelrequiredstring 
input_audiorequiredobject 
languagestring 

Example request

curl https://sven.swedishembedded.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -F "file=@recording.wav" \
  -F "model=MODEL_ID" \
  -F "language=en"

Responses

200 The text of the recording; charged per second of audio transcribed.

Speech to text for one recording.: 200 response
NameTypeDescription
textrequiredstring

What was said.

usagerequiredobject

What the call is charged for.

usage.typestring, only duration 
usage.secondsinteger

The seconds of audio transcribed.

json
{
  "text": "Hello and welcome.",
  "usage": {
    "type": "duration",
    "seconds": 3
  }
}

Errors

Speech to text for one recording.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

404model_not_found

There is no such model, or it has no price and is not for sale.

409idempotency_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

413invalid_request_error

The body is past the size limit.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

503server_error

The model is temporarily unavailable, or is not for sale right now.

Every refusal carries the error object described on Errors.

Video

Video generation, rolled out account by account.

Start generating a video; answers at once with the job to poll.

POST/v1/videos

Video generation is being rolled out; for an account it is not available to yet, the video routes answer 404. A job is charged once, when its video is stored, for the seconds delivered at the rate of its resolution, never more than the longest video the request could produce. The result is a file of the person the key acts for, kept until they delete it, and counts against their storage quota: once that is full a new video is refused with 507 before anything is charged.

Parameters

Start generating a video; answers at once with the job to poll.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

Request body application/json

Start generating a video; answers at once with the job to poll.: application/json body
NameTypeDescription
modelrequiredstring

A video model id from GET /v1/videos/models.

promptrequiredstring, at most 8000 characters 
durationnumber, 1 to 60

Seconds; the model's own default when absent.

resolutionstring, one of 480p, 720p, 768p, 1080p, 1K, 2K, 4K 
aspect_ratiostring, one of 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9, 9:21 
sizestring

WIDTHxHEIGHT, instead of resolution and aspect_ratio.

generate_audioboolean 
seedinteger 
input_videoobject

For an edit: a stored video file, as file:<id>, with the model's edit named in provider.options.

providerobject 

Example request

curl https://sven.swedishembedded.com/v1/videos \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "prompt": "A paper boat drifting down a rain-soaked street at dusk.",
    "duration": 5,
    "resolution": "720p"
  }'

Responses

200 The job an earlier request with the same Idempotency-Key started.

202 The job, to poll at `polling_url`.

Start generating a video; answers at once with the job to poll.: 202 response
NameTypeDescription
idrequiredstring

The job's id.

polling_urlrequiredstring

Where to read its status.

statusrequiredstring, only pending 
json
{
  "id": "job_1",
  "polling_url": "/v1/videos/job_1",
  "status": "pending"
}

Errors

Start generating a video; answers at once with the job to poll.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

403permission_error

The key is restricted to other models, or the model is served only by providers that may keep data and sharing data with it is not allowed. error.code is data_sharing_not_allowed when the person the key acts for has not allowed it (they can: once, or always under Settings, Models), and data_sharing_forbidden when their organization does not allow it (they cannot).

404not_found_error

There is no such job, or the video routes are not available to this account.

413invalid_request_error

The body is past the size limit.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

503server_error

The model is temporarily unavailable, or is not for sale right now.

507storage_full

The storage quota of the person whose file the result would be is full: nothing ran and nothing was charged. They free space under Settings, Storage.

Every refusal carries the error object described on Errors.

The video models for sale, with the durations, sizes and prices each offers.

GET/v1/videos/models

Example request

curl https://sven.swedishembedded.com/v1/videos/models \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The video models for sale; prices are dollars per second of video.

The video models for sale, with the durations, sizes and prices each offers.: 200 response
NameTypeDescription
datarequiredarray of object 
data[].idstring 
data[].supported_durationsarray of number 
data[].supported_resolutionsarray of string 
data[].supported_aspect_ratiosarray of string 
data[].supported_sizesarray of string 
data[].generate_audioboolean 
data[].seedboolean 
data[].supported_frame_imagesarray of string

The frames a clip can start or end on: first_frame, last_frame.

data[].allowed_passthrough_parametersarray of string

The model's own options a request may give in provider.options.

data[].providersarray of string

The providers serving the model, by the name their options go under; empty when not known, and then options must name their provider.

data[].pricing_skusobject 
data[].needs_data_sharingboolean, only true

Present when the model is served only by providers that may keep data and the person the key acts for has not allowed sharing data with it: a video is refused (403, data_sharing_not_allowed) until they allow it.

Errors

The video models for sale, with the durations, sizes and prices each offers.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

404not_found_error

There is no such job, or the video routes are not available to this account.

Every refusal carries the error object described on Errors.

A video job's status.

GET/v1/videos/{jobId}

Parameters

A video job's status.: parameters
NameTypeDescription
jobIdrequiredstring 

Example request

curl https://sven.swedishembedded.com/v1/videos/{jobId} \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The job's status.

A video job's status.: 200 response
NameTypeDescription
idrequiredstring 
statusrequiredstring, one of pending, in_progress, completed, failed, cancelled 
progressnumber

How far along it is

unsigned_urlsarray of string

Where the finished video is.

usageobject 
usage.secondsnumber 
usage.coststring 
file_idstring

The stored file

errorobject

Why it failed

Errors

A video job's status.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

404not_found_error

There is no such job, or the video routes are not available to this account.

Every refusal carries the error object described on Errors.

Ask a running job to stop; a job that cannot be stopped is still delivered and charged.

DELETE/v1/videos/{jobId}

Parameters

Ask a running job to stop; a job that cannot be stopped is still delivered and charged.: parameters
NameTypeDescription
jobIdrequiredstring 

Example request

curl -X DELETE https://sven.swedishembedded.com/v1/videos/{jobId} \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The job and where it stands.

Ask a running job to stop; a job that cannot be stopped is still delivered and charged.: 200 response
NameTypeDescription
idstring 
statusstring 

Errors

Ask a running job to stop; a job that cannot be stopped is still delivered and charged.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

404not_found_error

There is no such job, or the video routes are not available to this account.

Every refusal carries the error object described on Errors.

The finished video (MP4), with the same API key.

GET/v1/videos/{jobId}/content

Parameters

The finished video (MP4), with the same API key.: parameters
NameTypeDescription
jobIdrequiredstring 
indexinteger, only 0 

Example request

curl https://sven.swedishembedded.com/v1/videos/{jobId}/content \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The video file.

Errors

The finished video (MP4), with the same API key.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

404not_found_error

There is no such job, or the video routes are not available to this account.

409conflict

The video is not ready: poll the job's status.

410gone

The video has expired.

Every refusal carries the error object described on Errors.

Invocations

Any model run once for an agent, with files in and out by reference, charged as the same call made directly.

Run one model once; what it makes is kept as files and answered by reference.

POST/v1/invocations

For agents that combine models: a chat model reading images, an image model making or editing a picture, a speech model saying a text. Inputs are files by reference (uri, as an earlier answer gave it) or inline base64, at most 16 of at most 15 MiB each. What the model makes is checked to be what it says it is (a PNG, JPEG, GIF or WebP image; an SVG, kept as a file; MP3, or speech in raw PCM kept as a playable WAV) and answered as a file reference, never as its bytes. It is charged as the same call to the model made directly; an output that is not kept is not charged. With X-Sven-Session naming a conversation of the key's computer, the files belong to that conversation and are shown in it; without one they are the key's person's own files. Either way they are kept until deleted and count against that person's storage quota: once it is full an image or speech call is refused with 507 before the model runs. An Idempotency-Key is required: the same key answers the same files again without a second charge.

Parameters

Run one model once; what it makes is kept as files and answered by reference.: parameters
NameTypeDescription
Idempotency-Keystring, 1 to 255 characters

1 to 255 printable characters. A retry with the same value, API key and request body answers the first call's result without a second charge.

X-Sven-Sessionstring

A conversation of the key's computer that the files belong to.

Request body application/json

Run one model once; what it makes is kept as files and answered by reference.: application/json body
NameTypeDescription
modelrequiredstring

A model id from GET /v1/models.

operationrequiredstring, one of chat, image, speech

How the model is run: chat answers text (from images too), image makes images, speech says the prompt.

promptrequiredstring, 1 to 32000 characters

What to ask, draw or say (at most 4096 characters for speech).

inputsarray of object, at most 16 items

Files the model reads, in order.

paramsobject

The operation's parameters: for image n (1 to 4), aspect_ratio, resolution, size, quality, output_format, background, seed; for speech voice, instructions, speed, format (mp3 or pcm); for chat system, max_tokens, temperature. Which values a model takes is in GET /v1/models.

Example request

curl https://sven.swedishembedded.com/v1/invocations \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "operation": "image",
    "prompt": "A red sports car in the rain",
    "params": {"aspect_ratio": "16:9"}
  }'

Responses

200 The text and the files the model made.

Run one model once; what it makes is kept as files and answered by reference.: 200 response
NameTypeDescription
idrequiredstring

The invocation.

statusrequiredstring, only completed 
modelrequiredstring 
operationrequiredstring 
textstring

What a chat model answered.

outputsrequiredarray of object

The files made, in order.

outputs[].uristring

The file's reference, for a later invocation's inputs and for GET /v1/files/{fileId}/content.

outputs[].namestring 
outputs[].mimeTypestring 
outputs[].sizeinteger 
outputs[].digestobject

The file's SHA-256, {algorithm, value} in base64url.

usagerequiredobject 
usage.cost_micro_usdstring

What the call was charged

json
{
  "id": "inv-1",
  "status": "completed",
  "model": "MODEL_ID",
  "operation": "image",
  "text": null,
  "outputs": [
    {
      "uri": "mcp-file://files/7b1d6c1e-2f0a-4c3b-9a8d-5e6f7a8b9c0d",
      "name": "image-1.png",
      "mimeType": "image/png",
      "size": 1843202
    }
  ],
  "usage": {
    "cost_micro_usd": "41000"
  }
}

Errors

Run one model once; what it makes is kept as files and answered by reference.: errors
StatusTypeWhen
400invalid_request_error

The request is malformed, sets a parameter the model does not accept (error.param names it), or carries a conversation longer than the model can take.

401authentication_error

No key, or a key that is unknown, expired or removed.

402insufficient_quota

The account's credit, the key's spending limit or the monthly budget cannot cover what the call could cost. error.code is key_spend_limit or monthly_budget when a limit refused it, and absent when credit ran out.

404not_found_error

There is no such file or conversation for this key, or the model is not for sale. A file of another conversation or another key answers the same.

409idempotency_error

A call with this Idempotency-Key is still running, or it finished and its stored answer is gone.

429rate_limit_error

Too many calls per minute or at once, or the model is busy. error.code is key_rate or workspace_concurrency when a limit refused it; Retry-After says when to retry.

500server_error

Something failed inside the service. The response says nothing about how.

502upstream_error

The model delivered something other than it said, or too much of it; nothing was kept and nothing was charged.

503server_error

The model is temporarily unavailable, or is not for sale right now.

507storage_full

The storage quota of the person whose file the result would be is full: nothing ran and nothing was charged. They free space under Settings, Storage.

Every refusal carries the error object described on Errors.

The bytes of a file an invocation made or may read, with the same API key.

GET/v1/files/{fileId}/content

Parameters

The bytes of a file an invocation made or may read, with the same API key.: parameters
NameTypeDescription
fileIdrequiredstring 
X-Sven-Sessionstring

The conversation the file belongs to, when it belongs to one.

Example request

curl https://sven.swedishembedded.com/v1/files/{fileId}/content \
  -H "Authorization: Bearer $SVEN_API_KEY"

Responses

200 The file

Errors

The bytes of a file an invocation made or may read, with the same API key.: errors
StatusTypeWhen
401authentication_error

No key, or a key that is unknown, expired or removed.

404not_found_error

There is no such file or conversation for this key, or the model is not for sale. A file of another conversation or another key answers the same.

410gone

The file is no longer kept.

Every refusal carries the error object described on Errors.