Skip to main content

api reference

Base URL · https://www.lazysusan.ai/api/v1

LazySusan API

One key, one SDK and one bill for chat, image and video models from every major AI lab, with keys, budgets and usage tracking for your whole team.

Overview

The LazySusan API gives you 18 chat models, 26 image models and 12 video models behind one key, and the list keeps growing. Use our SDKs for JavaScript/TypeScript and Python, or call the HTTP API from any language. Every model in a category takes the same request, so switching models is a one-string change.

EndpointSDKWhat it does
POST /chat/completionschat.create · chat.streamChat with any chat model. Streaming, images in, function calling and JSON output.
POST /images/generationsimages.generateGenerate images. Returns hosted URLs or base64.
POST /videosvideos.createStart a video. It runs in the background.
GET /videos/{id}videos.get · videos.waitCheck a video and get its URL when it's done.
GET /videosvideos.listYour 50 most recent videos.
GET /modelsmodels.list · models.getEvery model with its limits and price. No key needed.
GET /creditscredits.getYour team's remaining balance.

You pay from a prepaid balance of credits shared by your team. One credit is $0.001, so $25 buys 25,000 credits. Every request is billed for what it actually used, and requests that fail aren't charged. No subscription is needed.

Quickstart

  1. Create an account in the developer console. No subscription needed.
  2. Buy credits (packs start at $25).
  3. Create a key and copy it: it's shown once. Save it as LAZYSUSAN_API_KEY.
  4. Install the SDK and send your first request:
// npm install lazysusan
import LazySusan from "lazysusan";

const ls = new LazySusan(); // reads LAZYSUSAN_API_KEY

const r = await ls.chat.create({
  model: "anthropic/claude-sonnet-5-5",
  messages: [{ role: "user", content: "Write a haiku about lazy susans." }],
});

console.log(r.text);
console.log(r.usage.costCredits, "credits");

Every response tells you what the request cost in credits. Working on a team? Have an owner or admin invite you and create your key under the team, so your usage is tracked there.

SDKs

Our SDKs wrap the HTTP API with typed requests and responses, streaming, video polling, retries and clear errors. They have no dependencies.

LanguageInstallRuns on
JavaScript / TypeScriptnpm install lazysusanNode 18+, Bun, Deno and edge runtimes. Types included.
Pythonpip install lazysusanPython 3.9+.
Source code, examples and the changelog are on GitHub: github.com/AhadV/lazysusan-api. Packages: npm and PyPI.

Configuration

The client reads LAZYSUSAN_API_KEY from the environment. You can also pass the key, a timeout and the number of retries:

const ls = new LazySusan({
  apiKey: process.env.MY_KEY,
  timeoutMs: 60_000, // default 300000
  maxRetries: 3,     // default 2
});

The SDK retries only requests that were never charged: rate limits and models that are briefly unavailable. Keep keys on your server; never ship them in browser or mobile app code.

Switching models

for (const model of ["openai/gpt-6.1-sol", "anthropic/claude-opus-5-5", "google/gemini-3.8-flash", "xai/grok-4.7"]) {
  const r = await ls.chat.create({
    model,
    messages: [{ role: "user", content: "Summarise our refund policy in one sentence." }],
    maxTokens: 400,
  });
  console.log(model, r.usage.costCredits, r.text);
}

Tagging requests

Add metadata to any chat, image or video call to label it. Tags are stored with the request's usage record, so you can filter the console's charts and request log by them.

await ls.chat.create({
  model: "google/gemini-3.8-flash",
  messages,
  metadata: { project: "checkout", feature: "summaries", customer: "acme" },
});

Up to 16 tags per request. Keys are 1–40 letters, digits or _ . : -; values are strings of up to 200 characters. Don't put secrets or personal data in tags.

Authentication and keys

The SDK sends your key for you. Over HTTP, send it on every request as Authorization: Bearer lsk_live_… (the x-api-key header works too). Keys are lsk_live_ followed by 40 letters and digits.

Each key belongs to a person on your team and can carry its own settings:

SettingWhat it does
Name and descriptionSo you know what it's for later.
ProjectGroups usage in the dashboard, for example checkout or support-bot.
Environmentproduction, staging, development or test. Filter usage by it.
Monthly budgetMost credits the key can spend in a calendar month. Past it, requests get 402 key_budget_reached.
Allowed modelsOnly these models can be called with the key. Anything else gets 403 model_not_allowed.
ExpiryThe key stops working on this date (401 api_key_expired).
  • Use one key per service and environment, so you can revoke one without breaking the others.
  • Revoking a key takes effect on the next request.
  • We store only a one-way hash of each key, so a lost key can't be shown again. Create a new one.
  • A team can have up to 200 active keys. Revoked keys don't count.

Teams and roles

Every API account is a team, and whoever creates it is its owner. Invite as many people as you need, up to 100 members including pending invites. Everyone shares one balance, while each person keeps their own keys and their own usage.

Team roles
RoleCan do
ownerEverything, including billing. One per team: the person who created it.
adminEverything except transferring or deleting the account: invite and remove members, change roles, manage every key, alerts and billing.
developerCreate, edit and revoke their own keys. See usage for their own keys only.
viewerRead-only: all usage, keys and alerts across the team. Good for finance or a project manager.

Inviting people

  1. In the console, open Team, enter one or more email addresses and pick a role.
  2. Each person gets an email with a one-click link. Links expire after 7 days; resend from the console if one lapses.
  3. New to LazySusan? Clicking the link creates their account and signs them in. Already have an account? They sign in and join. No subscription is needed either way.

A person can belong to several teams and switch between them in the console. Keys always belong to one team, and usage is billed to that team's balance.

Managing members

ActionEffect
Change roleTakes effect immediately in the console.
Monthly budgetCaps what the person can spend across all their keys each month. Past it, their requests get 402 member_budget_reached.
Allowed modelsLimits the person to a list of models on every key they own. A key's own list can narrow it further, never widen it.
SuspendAll their keys stop working at once (403 member_suspended). Unsuspend to restore them.
RemoveTakes them off the team and revokes every key they own.

Audit log

Owners and admins see a log of every change: invites, joins, removals, role changes, suspensions, keys created, edited or revoked, budget and allowed-model changes, alerts, settings and credit purchases, each with who did it and when.

Usage and analytics

The console's dashboard shows spend, requests, tokens, errors and latency for any date range up to a year, by hour or by day. Break it down by:

  • member (who made the requests)
  • key
  • project and environment
  • model and provider
  • endpoint (chat, images, videos)

Every filter applies to the chart, the breakdowns and the request log at once. Owners, admins and viewers see the whole team; developers see their own keys.

Request log

Every request is listed with its time, key, member, model, status, tokens, cost and latency. Search by request id (gen-…, img-…, vid-…), filter by status or by a metadata tag such as feature=summaries, and export the filtered list as CSV (up to 50,000 rows).

Alerts

Owners and admins can set email alerts. Each alert has a condition and up to 10 addresses to notify:

Alert types
AlertFires when
balance_belowThe team's balance drops below a number of credits.
daily_spend_aboveSpend today passes a number of credits.
monthly_spend_aboveSpend this month passes a number of credits.
key_budget_usedAny key has used more than a percentage of its monthly budget.
error_rate_aboveMore than a percentage of requests in the last hour failed (at least 20 requests).

Alerts are checked every 5 minutes. Each one emails once when its condition starts, then waits until the condition clears before it can fire again. A team can have up to 50 alerts.

Models and prices

Model ids are provider/model, for example openai/gpt-6.1-sol or google/veo-3.1-fast. Prices are in credits ($0.001 each). The same list, with every limit, is available from ls.models.list() or GET https://www.lazysusan.ai/api/v1/models (no key needed), and GET /models/{provider}/{model} for a single model.

Chat models

Priced per million tokens. Output includes any reasoning (“thinking”) tokens the model uses.

Chat models and prices
Model idContextMax outputInput / 1MOutput / 1MImages in
openai/gpt-6.1-sol400K64,0002,30011,500yes
openai/gpt-6-astra400K64,00011,50057,500yes
openai/gpt-6-luna400K64,000115575yes
anthropic/claude-fable-5-11,000K64,00011,50057,500yes
anthropic/claude-opus-5-51,000K64,0004,60023,000yes
anthropic/claude-sonnet-5-51,000K64,0002,30011,500yes
anthropic/claude-haiku-5-51,000K64,000115575yes
google/gemini-3.1-pro1,000K65,5362,30013,800yes
google/gemini-3.8-flash1,000K65,536862.54,312.5yes
google/gemini-3.5-flash-lite1,000K65,5363452,875yes
xai/grok-4.71,000K32,7682,3006,900yes
xai/grok-4.31,000K32,7681,437.52,875yes
xai/grok-build-0.11,000K32,7681,1502,300yes
deepseek/deepseek-flash128K8,1923451,380no
deepseek/deepseek-v4-pro128K8,1921,5184,554no
perplexity/sonar127K8,1922,3002,300no
perplexity/sonar-pro127K8,1926,90034,500no
perplexity/sonar-reasoning-pro127K8,1924,60018,400no

Cached input (where a repeated prompt prefix is cached) is billed at the lower cached rate shown in GET /models. Long prompts on some models are billed at a higher tier: Claude Haiku 5.5 above 100K input tokens, Gemini 3.1 Pro above 200K and Grok above 200K. Perplexity Sonar models run a live web search on every request; the search adds a per-request fee and search-result tokens, which are included in the request's cost.

Image models

Image models and prices
Model idSizesPrice per imageMax nInput images
google/nano-banana-2.11024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x124838.644yes
google/nano-banana-pro1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248154.14yes
openai/gpt-image-2.51024x1024, 1536x1024, 1024x1536by usage: typically 5.635 (low), 19.435 (medium), 48.415 (high)4no
openai/gpt-image-2.5-fast1024x1024, 1536x1024, 1024x1536by usage: typically 5.635 (low), 19.435 (medium), 48.415 (high)4no
bfl/flux-2-pro1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x124857.51no
bfl/flux-31024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x124855.21no
bfl/flux-kontext-pro1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
bfl/flux-kontext-max1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248921no
bfl/flux-pro-1.11024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
bfl/flux-pro-1.1-ultra1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248691no
xai/grok-imagine-image1024x1024234no
xai/grok-imagine-image-quality1024x102457.54no
xai/grok-imagine-image-2.01024x1024694no
midjourney/v71024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248921no
midjourney/v6.11024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
midjourney/v61024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
midjourney/niji-61024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x124857.51no
stability/sd-3.5-large1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248921no
stability/sd-3.5-medium1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
stability/sdxl1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248461no
stability/sd-turbo1024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x124857.51no
ideogram/ideogram-31024x1024, 1344x768, 768x1344, 1184x864, 864x1184, 1248x832, 832x1248see GET /models1no
recraft/recraft-v31024x1024, 1280x1024, 1024x1280, 1536x1024, 1024x1536461no
recraft/recraft-v3-vector1024x1024, 1280x1024, 1024x1280, 1536x1024, 1024x1536921no
luma/photon-11024x1024, 1344x768, 768x1344, 1184x864, 864x118417.251no
luma/photon-flash-11024x1024, 1344x768, 768x1344, 1184x864, 864x11844.61no

GPT Image models are billed by the tokens each image actually uses (34,500 credits per 1M image output tokens, 5,750 per 1M prompt tokens), so the figures above are typical, not fixed. A request reserves the most an image of that size and quality could use and is charged only what it used. Larger sizes and higher quality use more tokens.

Video models

Video models and prices
Model idSecondsResolutionAspect ratioPrice per videoNotes
google/veo-3.14, 6, 8720p, 1080p16:9, 9:16720p · 4s: 1,840; 720p · 6s: 2,760; 720p · 8s: 3,680; 1080p · 8s: 3,680includes audio
google/veo-3.1-fast4, 6, 8720p, 1080p16:9, 9:16720p · 4s: 460; 720p · 6s: 690; 720p · 8s: 920; 1080p · 8s: 1,104includes audio
google/veo-3.1-lite4, 6, 8720p, 1080p16:9, 9:16720p · 4s: 230; 720p · 6s: 345; 720p · 8s: 460; 1080p · 8s: 736includes audio
runway/gen-4.55, 10720p16:9, 9:16720p · 5s: 690; 720p · 10s: 1,380—
runway/gen-4-turbo5, 10720p16:9, 9:16720p · 5s: 287.5; 720p · 10s: 575needs a starting image
luma/ray-25, 9540p, 720p, 1080p16:9, 9:16, 1:1, 4:3, 3:4, 21:9540p · 5s: 460; 540p · 9s: 828; 720p · 5s: 816.5; 720p · 9s: 1,469.7; 1080p · 5s: 989; 1080p · 9s: 1,780.2—
luma/ray-flash-25, 9540p, 720p, 1080p16:9, 9:16, 1:1, 4:3, 3:4, 21:9540p · 5s: 161; 540p · 9s: 289.8; 720p · 5s: 276; 720p · 9s: 496.8; 1080p · 5s: 448.5; 1080p · 9s: 807.3—
pika/pika-2.55, 9540p, 720p, 1080p16:9, 9:16, 1:1, 4:3, 3:4, 21:9540p · 5s: 460; 540p · 9s: 828; 720p · 5s: 816.5; 720p · 9s: 1,469.7; 1080p · 5s: 989; 1080p · 9s: 1,780.2—
pika/pika-2.25, 9540p, 720p, 1080p16:9, 9:16, 1:1, 4:3, 3:4, 21:9540p · 5s: 460; 540p · 9s: 828; 720p · 5s: 816.5; 720p · 9s: 1,469.7; 1080p · 5s: 989; 1080p · 9s: 1,780.2—
pika/pika-turbo5, 9540p, 720p, 1080p16:9, 9:16, 1:1, 4:3, 3:4, 21:9540p · 5s: 161; 540p · 9s: 289.8; 720p · 5s: 276; 720p · 9s: 496.8; 1080p · 5s: 448.5; 1080p · 9s: 807.3—
vidu/viduq2-pro4, 5, 8540p, 720p, 1080p16:9, 9:16, 1:1540p · 4s: 143.75; 540p · 5s: 172.5; 540p · 8s: 258.75; 720p · 4s: 258.75; 720p · 5s: 316.25; 720p · 8s: 488.75; 1080p · 4s: 575; 1080p · 5s: 661.25; 1080p · 8s: 920—
vidu/viduq2-turbo4, 5, 8540p, 720p, 1080p16:9, 9:16, 1:1540p · 4s: 69; 540p · 5s: 80.5; 540p · 8s: 115; 720p · 4s: 218.5; 720p · 5s: 276; 720p · 8s: 448.5; 1080p · 4s: 373.75; 1080p · 5s: 431.25; 1080p · 8s: 603.75needs a starting image

Chat

ls.chat.create(…) · POST https://www.lazysusan.ai/api/v1/chat/completions

Parameter names below are as sent over HTTP. The Python SDK uses the same names; the JavaScript SDK uses camelCase (maxTokens, responseFormat, toolChoice).

Chat parameters
ParameterTypeNotes
modelstring, requiredA chat model id from the table above.
messagesarray, required1–2,000 messages. Roles: system, developer, user, assistant, tool. content is a string or an array of parts ({type:"text",text} and {type:"image_url",image_url:{url,detail?}}). Assistant messages may have content null with tool_calls. Tool messages need tool_call_id. An optional name is kept (up to 64 characters).
max_tokensintegerMost tokens to generate, including reasoning tokens. max_completion_tokens is accepted as an alias. Up to the model's max output. Default 4,096; if your balance can't cover that and you didn't set it, the request runs with 1,024.
temperaturenumber 0–2Ignored by OpenAI GPT-6 models.
top_pnumber 0–1Ignored by OpenAI GPT-6 models.
presence_penaltynumber −2–2Ignored by OpenAI GPT-6 models.
frequency_penaltynumber −2–2Ignored by OpenAI GPT-6 models.
seedintegerBest-effort determinism where the model supports it.
stopstring or string[]Up to 4 stop sequences.
toolsarrayUp to 128 function tools: {type:"function", function:{name, description?, parameters?}}. Other tool types (for example built-in web search) are rejected.
tool_choicestring or objectauto, none, required, or a specific function.
parallel_tool_callsboolean
response_formatobject{type: "text" | "json_object" | "json_schema", …}.
metadataobjectUp to 16 string tags for filtering usage. See Tagging requests.
streambooleanHTTP only: stream tokens as server-sent events. In the SDK, use chat.stream. See Streaming.
stream_optionsobjectHTTP only: {include_usage: true} adds a final chunk with usage and cost.
nintegerOnly 1 is supported; any other value is rejected.

Unknown parameters are ignored rather than rejected. Reasoning models (GPT-6, Gemini 3.x, Grok, DeepSeek V4 Pro, Sonar Reasoning Pro) spend part of max_tokens thinking before they answer. With a very small limit they can return an empty answer with a finish reason of length: leave room, a few hundred tokens or more.

Response

The SDK gives you text, toolCalls / tool_calls, finishReason / finish_reason, usage (input, output and cached tokens plus credits charged) and the requestId / request_id. Over HTTP the body is:

200 OK · application/json
{
  "id": "gen-6f0c2a5e-1d2b-4c7e-9a51-0b8f3c2d7e14",
  "object": "chat.completion",
  "created": 1791676800,
  "model": "anthropic/claude-sonnet-5-5",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Turns once, then rests…" },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 22,
    "total_tokens": 40,
    "cost_credits": 0.295
  }
}

usage.completion_tokens includes reasoning tokens. usage.prompt_tokens_details.cached_tokens appears when part of the prompt was cached. Perplexity models also return citations and search_results. Every response carries an x-request-id header with the same id as the body.

Streaming

ls.chat.stream(…) takes the same parameters as chat.create and yields the reply as it's generated. The last event carries the full text and the usage, including the credits charged.

const stream = ls.chat.stream({
  model: "openai/gpt-6-luna",
  messages: [{ role: "user", content: "Count from 1 to 5." }],
});

for await (const ev of stream) {
  if (ev.type === "delta") process.stdout.write(ev.text);
  if (ev.type === "done") console.log("\ncost:", ev.usage?.costCredits, "credits");
}

Over HTTP, each event is a data: line holding a chat.completion.chunk, and the stream ends with data: [DONE]. With "stream_options": {"include_usage": true}, one more chunk with an empty choices array and the request's usage arrives just before [DONE].

If you disconnect mid-stream, the request stops and you're billed for the prompt and the output generated up to that point. If a provider fails mid-stream, the SDK raises an error; over HTTP you get a final event of the form {"error": {"message", "type": "upstream_error"}} and the stream closes without [DONE].

Images in, tools and JSON

Images in a prompt

Models with “Images in: yes” accept up to 20 images per request as image_url parts. Use a public https:// URL or a base64 data:image/(png|jpeg|webp|gif);base64,… URL. detail may be low, high or auto.

await ls.chat.create({
  model: "google/gemini-3.8-flash",
  messages: [{
    role: "user",
    content: [
      { type: "text", text: "What's in this photo?" },
      { type: "image_url", image_url: { url: "https://example.com/photo.jpg" } },
    ],
  }],
});

Function calling

const tools = [{
  type: "function",
  function: {
    name: "get_order_status",
    description: "Look up an order by id",
    parameters: { type: "object", properties: { order_id: { type: "string" } }, required: ["order_id"] },
  },
}];
const messages = [{ role: "user", content: "Where is order A-1042?" }];

const first = await ls.chat.create({ model: "openai/gpt-6.1-sol", messages, tools });
const call = first.toolCalls[0];
// …run your function, then send the result back:
const second = await ls.chat.create({
  model: "openai/gpt-6.1-sol",
  messages: [...messages, first.message, { role: "tool", tool_call_id: call.id, content: '{"status": "shipped"}' }],
  tools,
});

JSON output

Set response_format (responseFormat in JavaScript) to {"type": "json_object"}, or json_schema with a schema, on models that support it. If a model doesn't, the request is rejected with a 400 and you aren't charged.

Images

ls.images.generate(…) · POST https://www.lazysusan.ai/api/v1/images/generations

Image generation parameters
ParameterTypeNotes
modelstring, requiredAn image model id.
promptstring, requiredUp to 4,000 characters.
nintegerDefault 1, up to the model's Max n (FLUX: 1; Nano Banana, GPT Image and Grok Imagine: 4).
sizestringOne of the model's sizes, e.g. 1024x1024 (the default) or 1344x768. Nano Banana and FLUX map sizes to aspect ratios.
qualitystringGPT Image only: low, medium (default) or high. auto and standard mean medium; hd means high.
response_formatstringurl (default): a permanent hosted URL. b64_json: the image inline as base64. In the SDK this is format.
imagestringNano Banana models only: an image to edit or use as a reference (https URL or data: URL, PNG/JPEG/WebP, up to 20 MB). Or send up to 3 as images: [].
metadataobjectUp to 16 string tags for filtering usage.
const img = await ls.images.generate({
  model: "google/nano-banana-2.1",
  prompt: "A red ceramic cube on a white table, studio light",
  size: "1344x768",
});
console.log(img.images[0].url, img.usage.costCredits);

You're charged only for images actually delivered: if you ask for 4 and 3 come back, you pay for 3. If no image comes back (for example the prompt was declined by a safety filter) the request returns 400 and costs nothing. Hosted URLs stay up and are unguessable; anyone with the URL can open it, so treat it like a share link. In the rare case hosting is unavailable, an item comes back as base64 even if you asked for a URL.

Videos

Video takes from about a minute to a few minutes, so it runs in the background. ls.videos.create(…) starts it and returns straight away; ls.videos.wait(id) polls until it's done and returns the finished video, or raises an error if it failed (you aren't charged for a failure).

const v = await ls.videos.create({
  model: "google/veo-3.1-fast",
  prompt: "A slow pan across a calm lake at sunrise",
  seconds: 8,
  resolution: "1080p",
});

const done = await ls.videos.wait(v.id);
console.log(done.videoUrl, done.costCredits);
Video parameters
ParameterTypeNotes
modelstring, requiredA video model id.
promptstring, requiredUp to 2,000 characters.
secondsintegerOne of the model's durations. Default: the shortest.
resolutionstringOne of the model's resolutions. Default: the first listed. Veo renders 1080p only at 8 seconds.
aspect_ratiostring16:9 (default) or 9:16. aspectRatio in JavaScript.
imagestringStarting frame (https or data: URL, PNG/JPEG/WebP, up to 20 MB). Required for runway/gen-4-turbo.
negative_promptstringGoogle Veo models only. Up to 1,000 characters. negativePrompt in JavaScript.
metadataobjectUp to 16 string tags for filtering usage.
GET /videos/{id} · succeeded
{
  "id": "vid-91c4…",
  "object": "video",
  "model": "google/veo-3.1-fast",
  "status": "succeeded",
  "created": 1791676800,
  "completed": 1791676911,
  "seconds": 8,
  "resolution": "1080p",
  "aspect_ratio": "16:9",
  "video_url": "https://…/api/…/91c4…-0.mp4",
  "cost_credits": 1104
}
  • Starting a video holds its exact price from your balance while it renders (cost_credits_held).
  • On success you're charged that amount. On failure, the status is failed, error.message says why, and the hold is returned in full.
  • A video that hasn't finished after 2 hours is marked failed and refunded.
  • Videos finish even if you stop waiting; ls.videos.list() returns your 50 most recent. The video URL is permanent and unguessable.

Credits and billing

The API runs on a prepaid balance shared by everyone on the team. One credit is $0.001. Nothing is billed in arrears: a request only runs if the balance can cover it. Credits don't expire.

Buying credits

PackCredits
$2525,000
$100100,000
$500500,000
$2,0002,000,000

Owners and admins buy packs, or any amount from $25 to $5,000, in the console with a card. Every purchase has a receipt in the console. New accounts can add up to $250 a day for their first week; after that, up to $5,000 a day.

Automatic top-up

Turn on auto top-up to never run dry: when your balance falls below a threshold you choose (1,000 to 10,000,000 credits), we charge the card you last paid with for an amount you choose ($25 to $5,000) and add the credits straight away. It needs one manual purchase first, so there's a card on file. After 3 declined charges in a row, auto top-up switches itself off.

Spend limits

Three limits, which all apply. A request that would go past any of them is refused with 402 before it runs:

LimitSet onError code
Monthly limitThe whole team (Settings)monthly_limit_reached
Member budgetOne person, across all their keys (Team)member_budget_reached
Key budgetOne key (Keys)key_budget_reached

Credits held by requests in progress count toward each limit. Budgets reset at the start of each calendar month (UTC).

How a request is billed

  1. Before a request runs, we hold the most it could cost: the full prompt plus max_tokens of output for chat, the per-image price × n for images, the clip price for video.
  2. We run it, and the model reports exactly what was used.
  3. You're charged for actual usage (never more than the hold), and the rest of the hold is released immediately.

Holds mean many requests can run at once without ever overdrawing your balance. A large max_tokens on an expensive model needs a bigger balance to start, even though you're only charged for what's used. Requests rejected before they reach a model, and requests the provider fails, cost nothing.

Checking your balance

const { balance, autoTopUp } = await ls.credits.get();

Errors

The SDKs raise LazySusanError with status, code, message and requestId (request_id in Python), so you can branch on the code:

import LazySusan, { LazySusanError } from "lazysusan";

try {
  await ls.chat.create({ model, messages });
} catch (err) {
  if (err instanceof LazySusanError && err.code === "key_budget_reached") {
    // this key is out of budget for the month
  }
  console.error(err.status, err.code, err.message, err.requestId);
}
Error codes
StatusCodesWhat to do
400invalid_json, invalid_request, invalid_metadata, model_not_found, images_not_supported, invalid_image, image_unreachable, image_too_large, image_required, context_length_exceeded, provider_rejected_request, no_imageFix the request; param names the field. provider_rejected_request means the model refused it (for example a safety filter); you weren't charged.
401missing_api_key, invalid_api_key, api_key_expiredCheck the key and the Authorization header, or create a new key.
402insufficient_balance, monthly_limit_reached, member_budget_reached, key_budget_reachedAdd credits, lower max_tokens, or raise the limit in the console.
403model_not_allowed, member_suspended, account_suspendedUse a model the key allows, or ask a team admin.
404model_not_found, video_not_foundCheck the id.
405method_not_allowedUse POST for chat, images and starting videos.
413request_too_largeSend a smaller body (see Limits).
429rate_limitedWait for the Retry-After seconds, then retry. The SDK does this for you.
500server_errorRetry; if it persists, send us the request id.
502provider_error, provider_unreachableThe model failed to respond. Retry, or switch models. You weren't charged.
503model_unavailable, provider_rate_limitedThe model is briefly unavailable or busy. Retry after Retry-After, or switch models. You weren't charged.

Responses include an x-request-id header (gen-…, img-… or vid-…) whenever a request got far enough to be billed. Search for it in the console's request log.

Rate limits and limits

LimitValue
Requests per key120 per minute
Requests per team600 per minute, across all keys
Members per team100, including pending invites
Active keys per team200
Alerts per team50
Chat request body8 MB
Image request body64 MB
Video request body32 MB
Messages per chat request2,000
Images in a chat request20
Input images for image models3, each up to 20 MB
Image prompt4,000 characters
Video prompt2,000 characters
Metadata tags per request16

Over the rate limit you get 429 with a Retry-After header. Spread heavy traffic across keys, one per service. Repeated requests with invalid keys from one address are also rate limited.

Data and security

  • All traffic is HTTPS. Keys are stored only as one-way hashes and shown once.
  • We don't store your prompts or the text models send back, and we don't train on them. We keep a usage record per request (model, key, token counts, cost, latency, tags, time) for billing and your dashboard.
  • Generated images and videos are hosted at unguessable URLs so you can use them directly. Download and re-host them if you need to control access.
  • Image URLs you send us are fetched only from the public internet; private and internal addresses are refused.
  • Team changes, key changes and purchases are recorded in the audit log.

Changelog

DateChange
2026-10-11JavaScript and Python SDKs. Teams with owner, admin, developer and viewer roles and one-click invites. Per-key and per-member budgets, allowed models and key expiry. Usage analytics, request log with CSV export, request tags, email alerts and an audit log.
2026-10-11Launch: chat, image and video models; prepaid credits, auto top-up and monthly limits.

Support

Something look wrong? Email support@lazysusan.ai with the request id (x-request-id).