VidLabDocs
Copy for agent
llms.txtEvery page and model as links an agent can follow.Agent setup guideThe skill, your key and what to ask for.
StatusSupportGet API key
Text modelsMarkdown

Text models

POST /v1/chat/completions answers with text. It takes and returns the OpenAI chat shape, so an OpenAI SDK works with two changes: the base URL and the key. The same VidLab key and the same prepaid balance as every other model.

ModelMakerReadsLongest answerReasoning effort
claude-opus-5.5Anthropic1,000,000 tokens64,000 tokenslow, medium, high, xhigh, max
claude-fable-5.2Anthropic1,000,000 tokens64,000 tokenslow, medium, high, xhigh, max
gemini-4-neonGoogle1,048,576 tokens64,000 tokenslow, medium, high, xhigh

Live prices are on GET /v1/models?kind=text, in dollars per 1 million tokens: prices.input, prices.output, prices.cache_read and prices.cache_write.

Call it

curl https://vidlab.ai/v1/chat/completions \
  -H "Authorization: Bearer $VIDLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5.5",
    "max_tokens": 2000,
    "messages": [{"role": "user", "content": "Write one headline for a red running shoe."}]
  }'

The answer is a chat.completion. usage has the tokens and price_usd, what the call cost:

json
{
  "id": "chatcmpl_4fQ0c8mB7s2KxZr1TnVw9aLe",
  "object": "chat.completion",
  "created": 1763900000,
  "model": "claude-opus-5.5",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Run like the light just changed.", "refusal": null },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 9,
    "total_tokens": 27,
    "prompt_tokens_details": { "cached_tokens": 0, "cache_write_tokens": 0 },
    "price_usd": "what the call cost, in dollars (a number)"
  }
}

These models reason before they answer. Reasoning tokens are output tokens: they count in completion_tokens and toward max_tokens. An answer that comes back empty with finish_reason: "length" used its whole limit on reasoning: raise max_tokens or lower reasoning_effort.

Fields

FieldWhat it does
modelThe model's id.
messagessystem, developer, user, assistant and tool messages. Content is text, or text and image_url parts (images in user messages).
max_tokensThe most output tokens, reasoning included, up to 64,000. max_completion_tokens is the same limit. Left out: 8,192.
stream, stream_optionsstream: true sends server events. stream_options: {"include_usage": true} adds a last chunk with usage.
reasoning_effortOne of the model's efforts, or reasoning: {"effort": ...}. Left out: the model's own default.
tools, tool_choiceFunctions the model may call. The two Claude models take tool_choice auto or none; gemini-4-neon also takes required or a named function.
response_formattext, json_object or json_schema.
stopA string, or up to 4.
user, parallel_tool_callsAccepted. user is not passed on. parallel_tool_calls: false asks for one tool call an answer on the Claude models; gemini-4-neon does not take it.
temperature, top_p, seedgemini-4-neon only. The Claude models do not take them.

Any other field is refused with 400, never dropped, and so is anything the model does not take, before anything is held.

Images: up to 20 a call, as a public https link or inline as a base64 data URL: PNG, JPEG, WebP or GIF, up to 5 MB and 4,096 pixels a side each, 20 MB together. Moving images (an animated GIF, WebP or PNG) are not taken. We fetch a link ourselves and send the picture on: 30 seconds for all of a call's links. A request is at most 20 MB. Audio, video and files are not taken.

json
{"role": "user", "content": [
  {"type": "text", "text": "What is on the label?"},
  {"type": "image_url", "image_url": {"url": "https://example.com/bottle.jpg"}}
]}

Stream

stream = client.chat.completions.create(
    model="gemini-4-neon",
    stream=True,
    stream_options={"include_usage": True},
    messages=[{"role": "user", "content": "Three hooks for a hydration drink."}],
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
    if chunk.usage:
        print(chunk.usage)

Lines that start with : are keep-alive comments: a model can think for minutes before its first word. If an answer breaks after it began, the last event is an error instead of a finish.

Use stream: true for anything that can take over a minute. Without it, an answer that takes over 88 seconds has to start its body before it is done: the status is already 200, blanks come while it is made (JSON allows them, so a parser still reads it), and a failure that late is an error object with status 200. Check for error in the body, not only the status. A stream has neither problem.

A call runs 45 minutes at most. One that reaches it is returned as it stands, with finish_reason: "length", and is charged.

Tools

Send back the assistant message exactly as you received it, reasoning_details included: it carries the model's reasoning, sealed, to the next turn. A sealed block opens only for your account and the model that made it. Leaving it out is allowed; the model then starts its reasoning over.

tools = [{"type": "function", "function": {
    "name": "get_weather",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
}}]
messages = [{"role": "user", "content": "Is it raining in Oslo?"}]

first = client.chat.completions.create(model="claude-opus-5.5", messages=messages, tools=tools)
reply = first.choices[0].message
messages.append(reply.model_dump(exclude_none=True))
for call in reply.tool_calls or []:
    messages.append({"role": "tool", "tool_call_id": call.id, "content": "Light rain, 6 C"})

second = client.chat.completions.create(model="claude-opus-5.5", messages=messages, tools=tools)
print(second.choices[0].message.content)

What a call costs

Each token is paid once, at its own price:

TokensWhere they are in usagePrice
Inputprompt_tokens, less the cached and written onesprices.input
Read from cacheprompt_tokens_details.cached_tokensprices.cache_read
Written to cacheprompt_tokens_details.cache_write_tokensprices.cache_write. On gemini-4-neon it is added to prices.input (cache_write_billing: added).
Output, reasoning includedcompletion_tokensprices.output
  • Held. Before a call is sent, the most it can cost is held on your balance: your request at its largest, plus max_tokens of output. A lower max_tokens holds less. If the balance does not cover it: 429 api_wallet_exhausted, and nothing is sent.
  • Charged. Once, for the tokens used, rounded up to the micro-dollar, never more than was held. The rest of the hold is released at once. These models are sold at the same price to every account: wholesale rates do not apply to them.
  • A call that fails after the model has run is billed for what it used, whole or streamed, and whether your connection broke or the model's. Its error carries price_usd, and it is in your logs. When the model's own count is not known, it is your request and what the model can have made while it was answering, its reasoning included. Never more than was held.
  • Free. A call that is refused, or that ends before the model gave anything, costs nothing.
  • Cut short. When part of an answer came and its count is known, that part is your answer, with finish_reason: "length".
  • If you leave. A call goes on when your connection closes, and is charged for what it used.
  • Cache. On the Claude models, mark a text part with "cache_control": {"type": "ephemeral"} to keep the prompt up to it for 5 minutes. gemini-4-neon caches by itself and ignores the marker.

Every call is in your logs with its tokens and cost. Prompts and answers are not kept.

Retries. Send an Idempotency-Key to make a retry safe: a key that already made a call answers 409, and nothing is sent or charged again. Answers are not kept, so the first one cannot be sent again. A call that was never run frees its key; one that failed after it ran, or may have, keeps it, and a repeat answers 409: use a new key.

Errors

The shape is the same as everywhere. The ones of this endpoint:

StatusCodeWhen
400invalid_requestA field is wrong, not taken, or not taken by this model. The message names it.
400not_a_text_modelThe model makes images, videos or sound: POST /v1/generations.
400context_length_exceededThe request is longer than the model reads.
400invalid_imageAn image could not be read.
400content_policyThe request was blocked by a content policy.
400invalid_reasoning_detailsA sealed block is not this account's, not this model's, or was changed.
409idempotency_key_in_progress, idempotency_key_usedThe key already made a call. call has its id and status.
429api_wallet_exhausted, rate_limitedNot enough balance for the hold, or too many calls at once.
429too_many_running_callsYour account has 20 text calls running, the most at once. Wait for one to finish.
429text_calls_pausedSeveral of your latest calls ended without a whole answer, so text calls are paused for up to an hour. None of those was charged.
502answer_interruptedThe answer was cut off. price_usd is there when it was charged.
503model_busy, model_unavailableTry again after Retry-After.
504timeoutThe model did not answer in time.

POST /v1/generations with a text model answers 400 use_chat_completions.