AI

env.AI is the AI binding wired into every app. There are three ways to use it, all through env.AI: call an included model by purpose (env.AI.chat), run a listed model by its name with no key (env.AI.run, including OpenAI, Anthropic, and Google), or bring your own vendor key. It also reaches the live web, env.AI.search and env.AI.browse. This page spells out exactly what to pass and how to read every response, plus billing and errors, so there's no guessing.

The three ways to use AI

Everything below is one of these three. Pick by what you need: simplest default, a specific model with no key, or your own vendor account.

WayCallAPI key?Billed toYou get back
Purpose methodenv.AI.chat({ messages })NoneYour workspace's usageres.response
Run by nameenv.AI.run("<name>", input)NoneYour workspace's usagethe model's native shape
Bring your own keyenv.AI.openai.chat({ … })Your vendor keyThe vendor (not us)the vendor's native shape
  • Purpose method, env.AI.chat / research / code / vision / image / embed / …. The included models, picked for you per task. No key, paid as usage, and we can upgrade the model behind a purpose without you changing code.
  • Run by name, env.AI.run("<name>", input). Run a specific model from the list on this page, still no key and paid as usage. That covers the included models ("llama-3.3-70b", "whisper", …) and OpenAI / Anthropic / Google models ("gpt-6-luna", "claude-haiku-4.5", "gemini-2.5-flash", …). Only models on this page can run.
  • Bring your own key, env.AI.openai / anthropic / google / jev. Set that vendor's key as an app env var and the call goes straight to the vendor on your account, Cloudrizz never sees the key and bills nothing.
The routing is server-side, your app just calls env.AI.run("gpt-6-luna", …) and Cloudrizz sends it to the right place. So every app can use any of this without a redeploy; env.AI is already attached.

Quickstart

// api/ai.js — a minimal included-model call, no key
export default {
  async fetch(request, env) {
    const { question } = await request.json();
    const res = await env.AI.chat({ messages: [{ role: "user", content: question }] });
    return Response.json({ answer: res.response });   // res.response is the text
  },
};

Included models by purpose (env.AI.chat, …)

The simplest way to add AI: no key, nothing to attach, paid as part of your workspace's usage. Each method takes the input in the table below and returns a fixed shape, so you always know where the answer is.

// api/assistant.js
export default {
  async fetch(request, env) {
    const { question, ticket } = await request.json();

    const reply    = await env.AI.chat({ messages: [{ role: "user", content: question }] });
    const analysis = await env.AI.research({ messages: [{ role: "user", content: "Analyse: " + question }] });
    const vec      = await env.AI.embed({ text: question });
    const picture  = await env.AI.image({ prompt: question });

    // Typed decision — branchable output, no prose to parse:
    const decision = await env.AI.decide({
      state: ticket,
      questions: {
        urgent: { type: "noul", instructions: "Is this time-sensitive?" },
        team:   { type: "choice", instructions: "Which team?", criteria: { billing: "Payments", technical: "Bugs" } },
      },
    });

    return Response.json({
      reply: reply.response,                       // text
      firstVector: vec.data[0],                    // embeddings
      urgentProb: decision.answers.urgent.noul,    // 0..1
      team: decision.answers.team.choice,          // "technical"
    });
  },
};

Every purpose method, its input, and where to read the result:

MethodPassRead the result at
env.AI.chat / research / code{ messages }res.response
env.AI.decide / decideFast{ state, questions }res.answers.<key>
env.AI.transcribe{ audio }res.text
env.AI.vision{ image, prompt } (image as bytes, base64 or a URL)res.response
env.AI.image{ prompt }res.image (base64 PNG)
env.AI.embed{ text }res.data (array of vectors)
env.AI.speak{ prompt } (English)res.audio (base64 MP3)
env.AI.translate{ text, source_lang, target_lang }res.translated_text
env.AI.rerank{ query, contexts }res.response ([{ id, score }])
env.AI.classify{ text }[{ label, score }]
env.AI.classifyImage{ image }[{ label, score }]
env.AI.searchquery or { query, limit }res.items ([{ url, title, description }])
env.AI.browseurl or { url }res.text (+ res.title)
code is an open-weight function-calling model for coding + agentic tool use. decideFast is the cheaper/faster typed-decision variant for high-volume routing. For embeddings + search, env.SEARCH embeds and indexes text for you (see Semantic search).

Pin a specific included model instead of a purpose by passing its clean name to env.AI.run, e.g. env.AI.run("llama-3.3-70b", { messages }). Prefer the purpose methods where you can: we move them to newer models for you. When a provider retires a model, its name keeps working and runs the model that replaces it (melotts runs aura-2, llama-3.2-vision runs llama-4-scout). The full catalogue:

Model (clean name)TaskPurpose method
llama-3.3-70bChat / generalenv.AI.chat
deepseek-r1Reasoning / analysisenv.AI.research
gpt-oss-120bCoding + tools (agentic)env.AI.code
deepseek-v4-flashCoding (fast, agentic)run("deepseek-v4-flash")
deepseek-v4-proCoding (long-horizon)run("deepseek-v4-pro")
glm-5.3-flashCoding (low-cost agentic)run("glm-5.3-flash")
clefTyped decisionsenv.AI.decide
clef-flashTyped decisions (faster)env.AI.decideFast
whisperSpeech → textenv.AI.transcribe
llama-4-scoutImage → textenv.AI.vision
fluxText → imageenv.AI.image
bge-embedText embeddingsenv.AI.embed
aura-2Text → speech (English)env.AI.speak
m2m100Translationenv.AI.translate
bge-rerankerRerank (RAG)env.AI.rerank
distilbert-sentimentSentimentenv.AI.classify
resnet-50Image → class labelsenv.AI.classifyImage
p-image-editImage → imageenv.AI.editImage
h3Image → videoenv.AI.animateImage
h3Text → video, with soundenv.AI.video
bria-video-rmbgVideo → videoenv.AI.editVideo
musicMusicenv.AI.music

Run a model by name (no key): gpt-6-luna, Claude, Gemini

env.AI.run("<name>", input) runs a specific model by its name, with no API key, paid as usage, exactly like the included models. That includes OpenAI, Anthropic, and Google models (gpt-6-luna, claude-sonnet-4.5, gemini-2.5-pro, …; the full list with prices is under What each model costs below). Cloudrizz routes each to the right endpoint server-side, you just pass the provider's native request shape.

Model kindCallRead the text at
OpenAI chat (gpt-4o, gpt-5, gpt-4.1…)run("gpt-5", { messages })res.choices[0].message.content
OpenAI Responses (gpt-6-luna)run("gpt-6-luna", { input, max_output_tokens })res.output[…].content[…].text
Anthropic Clauderun("claude-sonnet-4.5", { messages, max_tokens })res.content[0].text
Google Geminirun("gemini-2.5-pro", { messages })res.choices[0].message.content

Using gpt-6-luna (an OpenAI Responses model) in a user app. Pass input (a string), an optional max_output_tokens, and an optional reasoning.effort (low / medium / high). The reply is OpenAI's Responses shape, the text lives under output:

// api/luna.js: gpt-6-luna, no key, paid as usage
export default {
  async fetch(request, env) {
    const { question } = await request.json();

    const res = await env.AI.run("gpt-6-luna", {
      input: question,
      max_output_tokens: 512,
      reasoning: { effort: "low" },     // optional: low | medium | high
    });

    // Responses shape — pull the assistant text out of output[]:
    const text = res.output
      ?.find((o) => o.type === "message")
      ?.content?.find((c) => c.type === "output_text")?.text ?? "";

    return Response.json({ answer: text, usage: res.usage });
  },
};

Chat-shaped models (most OpenAI + all Google) take messages and return the familiar chat-completion shape; Anthropic needs max_tokens and returns its own shape:

// OpenAI / Google chat — read choices[0].message.content
const gpt = await env.AI.run("gpt-5", {
  messages: [{ role: "user", content: question }],
});
const gptText = gpt.choices[0].message.content;

const gem = await env.AI.run("gemini-2.5-pro", {
  messages: [{ role: "user", content: question }],
});
const gemText = gem.choices[0].message.content;

// Anthropic — max_tokens is required; read content[0].text
const claude = await env.AI.run("claude-sonnet-4.5", {
  messages: [{ role: "user", content: question }],
  max_tokens: 1024,
});
const claudeText = claude.content[0].text;

Available models: gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, gpt-5.5-pro, gpt-5.4, gpt-5.4-pro, gpt-5.4-mini, gpt-5.4-nano, gpt-5.1, gpt-5, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, o3, o3-mini, o4-mini, claude-fable-5.1, claude-opus-5.5, claude-sonnet-5.5, claude-haiku-5.5, claude-opus-4.8, claude-sonnet-4.6, claude-opus-4.5, claude-sonnet-4.5, claude-haiku-4.5, gemini-4-argon, gemini-3.8-flash, gemini-3.6-flash, gemini-3.5-flash-lite, gemini-3.1-pro, gemini-3.1-flash-lite, gemini-3-flash, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite.

A name that isn't on this page fails with unknown_model. For another provider model, use the bring-your-own-key path (env.AI.openai / anthropic / google, below). The result is always the provider's native shape (not the { response } of env.AI.chat), use the table above to read it.

Generative media (image, video, music)

env.AI also generates images, video, and music, one recommended model per task, no key. These are metered by output unit (per image, or per second of video/audio), so a longer clip costs more. They return JSON with a signed URL to the file (res.result.video / .audio / .image), not raw bytes; the models that edit an existing asset take a URL (host it in env.STORAGE and pass its link).

MethodPassRead the result at
env.AI.image{ prompt }res.image (base64 PNG)
env.AI.editImage{ prompt, images: [url] }res.result.image (URL)
env.AI.animateImage{ prompt, image: url, camera?: "still", duration? }res.result.video (URL)
env.AI.video{ prompt, duration?, aspect_ratio? }res.result.video (URL)
env.AI.editVideo{ video: url }res.result.video (URL)
env.AI.music{ prompt, music_length_ms }res.result.audio (URL)
// api/clip.js — a short video from a prompt (billed per second)
export default {
  async fetch(request, env) {
    const { prompt } = await request.json();
    const res = await env.AI.video({ prompt });
    // res.result.video is a signed URL (valid ~24h) — download + re-store it
    // in env.STORAGE if you need it to persist.
    return Response.json({ url: res.result.video });
  },
};

// Music: duration is in MILLISECONDS
const song = await env.AI.music({ prompt: "calm lofi loop", music_length_ms: 15000 });
// song.result.audio → signed URL

// Text → image returns base64 (not a URL):
const pic = await env.AI.image({ prompt: "a red bicycle" });
return new Response(Uint8Array.from(atob(pic.image), (c) => c.charCodeAt(0)), {
  headers: { "content-type": "image/png" },
});
Video can take one to two minutes per call (the request blocks until it finishes), so run it from a cron job or queue, not a user-facing request that would time out. editVideo needs its provider enabled on the platform gateway, ask us if a media call returns "not available".

Images and video on your own computer (free)

If your team runs Cloudrizz Machine on a computer with a graphics card, apps can make images and video there for free. Download a model in the machine's window (click its icon by the clock, then AI models), allow the app on the machine (Workspace, Machines), and name the machine:

const r = await env.AI.image({
  prompt: "a red oak chair in a bright room, soft daylight",
  node: "office",          // the machine's name
  model: "flux-schnell",   // or z-image-turbo, sdxl, flux-dev
  width: 1024, height: 768, seed: 42, format: "webp",
});
// r.image is base64, like the cloud image; also r.format, r.width, r.height, r.ms
  • Models: flux3-klein (correct text, also æ ø å; edits pictures), krea2-turbo (the most lifelike photos), qwen21-turbo (fast, not for commercial use), chroma-flash (trained without content filters), flux-schnell, z-image-turbo, sdxl, flux-dev. Without model the best one the machine has is used. Some licences limit commercial use; the machine's window says which.
  • Edit a picture from an instruction (machine 1.9+, FLUX.3 Klein): env.AI.editImage({ node, prompt: "make it winter, keep everything else", image }). The rest of the picture stays as it was.
  • LoRAs (styles, machine 1.9+): put the file in the machine's LoRAs folder and pass lora: "name" (and loraWeight, default 1) to env.AI.image.
  • The first image after a quiet spell takes about 15 seconds while the model loads, then a few seconds each on a strong card. The same seed gives the same image.
  • The computer must be on. If it isn't, the call fails with node_offline; other errors are node_not_allowed, no_such_node and model_not_installed.

An image from a picture. Give image (a URL, bytes or base64) and the new image keeps its layout while the prompt changes the rest: a new style, season or light. strength says how much may change, from 0.05 (almost nothing) to 1 (little of the picture left); 0.75 by default. With FLUX schnell, about 0.6 or less changes little, 0.75 to 0.85 keeps the scene in a new style, and 0.9 or more makes a new picture. Without width and height the image keeps the picture's shape at about a megapixel. Needs Cloudrizz Machine 1.7 or newer.

const r = await env.AI.image({
  prompt: "the same house in deep winter snow, oil painting",
  image: pictureUrlOrBytes,
  strength: 0.8,
  node: "office",
});

For the best quality, tick Wan 2.2 14B video (quality) and ask for it by name. It only brings a picture to life, so it works with animateImage. It takes 10 to 15 minutes a clip and needs a graphics card with 24 GB, so queue it with wait: false.

const job = await env.AI.animateImage({
  model: "wan14-video",
  prompt: "she strums the guitar and smiles",
  image: pictureUrlOrBytes,
  node: "office",
  width: 1280, height: 720,    // or 720 x 1280; 1920 x 1088 or 1088 x 1920 for 1080p
  seconds: 5,                  // up to 5 (up to 2 in 1080p)
  wait: false,                 // then env.AI.job(job.jobId) until it is done
});

A LoRA teaches a model a style, a character or a motion. Whoever runs the machine adds LoRAs in its window, by pasting a link to one on Civitai. Your app then names it with lora (and optionally loraWeight, from -2 to 2) in env.AI.image, or in env.AI.animateImage with the 14B model.

Chat on the machine. Tick a chat model in the machine's window (Qwen3.8 27B is the best at tools, Gemma 4 26B the fastest, gpt-oss 20B and Gemma 4 12B fit smaller cards) and name the machine. The answer has OpenAI's shape, tools included. Needs Cloudrizz Machine 1.8 or newer.

const r = await env.AI.chat({
  node: "office",              // or "any"
  messages: [{ role: "user", content: "Summarise this in two lines: ..." }],
  // model: "gemma4-26b",      // default: the best chat model the machine has
  max_tokens: 1024,            // up to 16384
});
const text = r.choices[0].message.content;   // also r.usage, r.model, r.ms
  • The first answer after a quiet spell loads the model (up to a minute); then Qwen3.8 27B writes about 30 tokens a second and Gemma 4 26B about 75 on a strong card.
  • Images, video and chat share the graphics card, one at a time: a chat waits while an image is made. No streaming yet.

Video works the same way once the machine has the Wan 2.2 video (Turbo) model: a clip from text, or a picture brought to life.

const r = await env.AI.video({
  prompt: "a red fox running through fresh snow, golden hour",
  node: "office",
  seconds: 5,                  // 1 to 5
  width: 1280, height: 704,    // or 704 x 1280 (portrait)
});
// r.result.video: a link to the clip (works for a day); r.key: the clip in
// your app's storage (env.STORAGE), yours to keep or delete

const a = await env.AI.animateImage({
  prompt: "big waves crash on the rocks",
  image: pictureUrlOrBytes,    // a URL, bytes or base64
  node: "office",
});
  • A 5 second clip in 720p takes about a minute on a strong card (about 16 GB of graphics memory needed), shorter clips less. Call it from a background job rather than while a visitor waits.
  • The clip (webm, a few MB) is saved in your app's files under ai/video/, so it counts toward your storage; delete the ones you don't keep.
  • Only the two sizes above: the model is made for them, and other sizes look broken.

Queue it instead of waiting. Add wait: false and the call returns at once with a job id; the machine works through jobs one at a time, and you pick the result up later (from another request, a cron or a queue). Use node: "any" to let whichever of your machines has the model take it.

const { jobId, position } = await env.AI.video({ prompt, node: "any", wait: false });

// later
const j = await env.AI.job(jobId);
// j.status: "queued" | "running" | "completed" | "failed" | "cancelled"
// j.position (jobs ahead), j.progress ({ stage, completed, total })
// completed: j.result.video (link), j.key (in your storage); an image job: j.image (base64)

await env.AI.cancelJob(jobId);   // stops it, also while it runs
await env.AI.releaseJob(jobId);  // done with it: Cloudrizz deletes its copy of the result now
  • Works the same for env.AI.image and env.AI.animateImage.
  • Jobs wait when the machine is off and survive it restarting: a job its machine stops working on goes back in the queue. One nobody takes within a day fails; results are kept 7 days.
  • Up to 20 jobs per app and 50 per team wait at once. The Machines page shows the queue.
  • Needs Cloudrizz Machine 1.6 or newer on the computer.
  • A machine takes jobs for the model it already has loaded first (no waiting while it switches), but never keeps another job waiting more than about two minutes for that.

Hear when it is done. Instead of asking env.AI.job again and again, add api/ai_jobs.js. Cloudrizz calls it when a queued job ends (done, failed or cancelled), on the same version of your app that queued it, with what env.AI.job would return:

// api/ai_jobs.js
export async function onAiJob(job, env) {
  if (job.status === "completed" && job.kind === "video") {
    // job.key: the clip in env.STORAGE; job.result.video: a link to it
    await env.DB.prepare("UPDATE clips SET file = ?, ready = 1 WHERE job_id = ?").bind(job.key, job.jobId).run();
  }
}

Live web (search & browse)

Two methods give a model access to the live internet, so your app isn't stuck at a model's training cutoff. Both are included (no key, paid as usage) and run on Cloudrizz:env.AI.search returns ranked web results, env.AI.browse reads a page's text.

MethodPassRead the result atCost
env.AI.searchquery or { query, limit } (1-10)res.items ([{ url, title, description }])$0.01 / call
env.AI.browseurl or { url }res.text, res.title, res.finalUrl, res.status$0.01 / call

The classic pattern is search, then browse the best hits, then answer (a live-web RAG loop), all with no key:

// api/ask-web.js — answer a question from fresh web results
export default {
  async fetch(request, env) {
    const { question } = await request.json();

    // 1) Search the live web (ranked results).
    const { items } = await env.AI.search({ query: question, limit: 5 });

    // 2) Read the top couple of pages for their actual text.
    const pages = await Promise.all(
      items.slice(0, 2).map((r) => env.AI.browse(r.url).catch(() => null)),
    );
    const context = pages
      .filter(Boolean)
      .map((p) => p.title + "\n" + p.text)
      .join("\n\n---\n\n");

    // 3) Answer grounded in what you just fetched, with citations.
    const res = await env.AI.chat({
      messages: [
        { role: "user", content:
          "Using these web sources, answer: " + question +
          "\n\nSources:\n" + context +
          "\n\nCite the source URLs you used." },
      ],
    });
    return Response.json({ answer: res.response, sources: items.map((i) => i.url) });
  },
};
browse renders the page in a real browser, so JavaScript-heavy pages still yield text; it returns up to ~12k characters (longer pages are truncated). Private, loopback, and internal addresses are refused. For a known URL you can always browse it directly without a search first. search takes a limit of 1-10 (default 5).

Streaming (for chat UIs)

For a live “typing” chat, pass stream: true (purpose methods) or use .stream(...) (BYO). You get a Response whose body is a Server-Sent-Events stream, pipe it straight to the browser and render tokens as they arrive.

// api/chat.js — stream an included-model reply to the browser
export default {
  async fetch(request, env) {
    const { messages } = await request.json();
    const res = await env.AI.chat({ messages, stream: true });
    return new Response(res.body, {
      headers: { "content-type": "text/event-stream; charset=utf-8" },
    });
  },
};

On the client, read it with EventSource (or fetch + a stream reader) and append each delta. With your own key, env.AI.openai.stream(...) / env.AI.anthropic.stream(...) / env.AI.google.stream(...) stream direct from the vendor.

Answer from your own data (RAG)

To make a model answer from your app's content, pair it with env.SEARCH. Retrieve the most relevant passages by meaning, put them in the prompt, then stream the answer, no key needed:

const { matches } = await env.SEARCH.query(question, { topK: 6 });
const context = matches.map((m) => m.text).join("\n---\n");
const res = await env.AI.chat({
  stream: true,
  messages: [{ role: "user", content: `Context:\n${context}\n\nQuestion: ${question}` }],
});
return new Response(res.body, { headers: { "content-type": "text/event-stream" } });

Typed decisions (env.AI.decide, Jev)

When you want a decision your code can branch on (not prose), env.AI.decide (included, no key) and env.AI.jev (bring-your-own TypeSafe key) both take state plus typed questions and return typed answers with calibrated probabilities, in one call. No prompt-wrangling, no JSON parsing. Three question types:

  • noul, a yes/no judgment, returned as a probability 0–1.
  • choice, pick one of your labelled options; returns the choice plus a probability per option and a confidence.
  • score, rate on a level scale; returns a probability-weighted score plus the distribution.
// api/triage.js — included, no key:
const d = await env.AI.decide({
  state: message,
  questions: {
    is_urgent:  { type: "noul", instructions: "Does this convey urgency?" },
    department: { type: "choice", instructions: "Which team?", criteria: { billing: "Payments", technical: "Bugs" } },
    frustration:{ type: "score", instructions: "How frustrated?", criteria: ["Calm", "Frustrated", "Very angry"] },
  },
});
// d.answers.is_urgent.noul   → 0.95
// d.answers.department.choice → "billing" (+ .probabilities, .confidence)
// d.answers.frustration.score → 1.05       (+ .probabilities, .confidence)

// Same interface, bring-your-own TypeSafe key (set TYPESAFE_API_KEY):
const j = await env.AI.jev({ state: message, questions: { is_urgent: { type: "noul", instructions: "Urgent?" } } });
env.AI.decide runs on a built-in decision model (included, no key). env.AI.jev / env.AI.typesafe.systemOne is the bring-your-own TypeSafe alternative. Decisions are a single call, so there's no streaming.

Bring your own provider (OpenAI, Anthropic, Gemini)

Want to call a vendor on your own account (your billing, your key)? Set the provider's key as an app env var (via manage_app_env, action: set) and that provider's calls go straight to the vendor, Cloudrizz never sees the key and bills nothing. Without the key these throw byo_key_required. Note this is a separate path from env.AI.run("gpt-5") above (which is key-free, paid as usage), use BYO when you specifically want it billed by the vendor, or for a model that isn't available key-free.

  • env.AI.openai → OPENAI_API_KEY. OpenAI Chat Completions shape.
  • env.AI.anthropic → ANTHROPIC_API_KEY. Anthropic Messages shape.
  • env.AI.google (alias env.AI.gemini) → GOOGLE_API_KEY. Gemini generateContent shape (model + contents, not messages).
  • env.AI.jev / env.AI.typesafe → TYPESAFE_API_KEY. Typed decisions.
// api/ask.js — requires OPENAI_API_KEY / ANTHROPIC_API_KEY / GOOGLE_API_KEY
const openai = await env.AI.openai.chat({ model: "gpt-5", messages: [{ role: "user", content: q }] });
const claude = await env.AI.anthropic.chat({ model: "claude-sonnet-4-6", max_tokens: 1024, messages: [{ role: "user", content: q }] });
const gemini = await env.AI.google.chat({ model: "gemini-2.5-flash", contents: [{ role: "user", parts: [{ text: q }] }] });

Billing

Every included and run-by-name call (purpose methods, and env.AI.run on the included and key-free provider models) is priced in dollars and counts toward your workspace's usage, on the same monthly bill as hosting, with the same volume discount. Text models bill by token, media by output unit. Bring-your-own-key calls bill you nothing on Cloudrizz, the vendor bills your account directly.

  • With a card, AI is not limited unless the workspace sets a monthly AI maximum on the usage page. When the maximum is reached, included / run-by-name calls fail with rizz_limit_reached (HTTP 402) until next month or until it is raised. Your apps keep running; only AI stops.
  • Without a card, AI is paid from the workspace's free $1 a month. When it is used, calls fail with out_of_credits (HTTP 402) until next month or until a card is added.
  • If the workspace's payment has failed for a while, calls fail with ai_unavailable (HTTP 503). The message only says AI is unavailable for now, so your app's users see nothing about billing.
  • One AI request may cost at most $5. A call that could cost more is refused before it runs (request_too_large); lower max_tokens or send less input.
  • Owners and admins can also set a monthly AI limit per app and per member.
  • Check usage in your dashboard under Usage.
  • Every model has its price on this page: text models by token, media by output unit.

See Billing & usage for how usage is billed, the volume discount and usage alerts.

What each model costs

Exact list prices in dollars, kept in sync with what we bill. Text models bill per token, split into input (the prompt + context you send) and output (what the model writes back), quoted here per 1M tokens. As a feel for it, a short chat turn is typically a few hundred to a few thousand tokens, so a llama-3.3-70b reply is far below the rate shown. Every call is rounded up to the next $0.001, with a per-model floor (at least $0.001 for most calls).

Included models (by purpose / clean name). What env.AI.chat, research, code, decide and friends run, and what env.AI.run("<clean-name>") pins:

ModelInputOutput
llama-3.3-70b
Cloudrizz chat (Llama 70B)
$0.80 / 1M$8 / 1M
deepseek-v4-flash
Cloudrizz code (DeepSeek V4 Flash)
$1.20 / 1M$4 / 1M
deepseek-v4-pro
Cloudrizz code (DeepSeek V4 Pro)
$4 / 1M$10 / 1M
deepseek-r1
Cloudrizz research (DeepSeek-R1 32B)
$1.50 / 1M$15 / 1M
gpt-oss-120b
Cloudrizz code (gpt-oss 120B)
$1 / 1M$2 / 1M
glm-5.3-flash
Cloudrizz code (GLM-5.3 Flash)
$0.40 / 1M$1.50 / 1M
clef
Cloudrizz decide (Clef)
$0.80 / 1M$0 / 1M
clef-flash
Cloudrizz decide (Clef flash)
$0.10 / 1M$0 / 1M
llama-4-scout
Cloudrizz vision (Llama 4 Scout)
$0.80 / 1M$2.50 / 1M
bge-embed
Cloudrizz embeddings (BGE large)
$0.50 / 1M$0 / 1M
m2m100
Cloudrizz translate (M2M100)
$1 / 1M$1 / 1M
bge-reranker
Cloudrizz rerank (BGE reranker)
$0.015 / 1M$0 / 1M
distilbert-sentiment
Cloudrizz classify (DistilBERT sentiment)
$0.08 / 1M$0 / 1M

Provider models (key-free). Called by name with env.AI.run("gpt-6-luna") etc., paid by token just like the included models:

ModelInputOutput
gpt-6-astra$25 / 1M ($50 / 1M over 272K input tokens)$150 / 1M ($200 / 1M over 272K)
gpt-6.1-sol$5 / 1M ($10 / 1M over 272K input tokens)$25 / 1M ($40 / 1M over 272K)
gpt-6.1-terra$2.50 / 1M ($5 / 1M over 272K input tokens)$15 / 1M ($20 / 1M over 272K)
gpt-6-sol$5 / 1M ($10 / 1M over 272K input tokens)$25 / 1M ($40 / 1M over 272K)
gpt-6-luna$0.25 / 1M ($0.50 / 1M over 272K input tokens)$1.50 / 1M ($2 / 1M over 272K)
gpt-5.6-sol$10 / 1M ($20 / 1M over 272K input tokens)$50 / 1M ($80 / 1M over 272K)
gpt-5.6-terra$5 / 1M ($10 / 1M over 272K input tokens)$30 / 1M ($50 / 1M over 272K)
gpt-5.6-luna$0.50 / 1M ($1 / 1M over 272K input tokens)$3 / 1M ($5 / 1M over 272K)
gpt-5.5$15 / 1M ($25 / 1M over 272K input tokens)$80 / 1M ($120 / 1M over 272K)
gpt-5.5-pro$80 / 1M ($150 / 1M over 272K input tokens)$500 / 1M ($800 / 1M over 272K)
gpt-5.4$8 / 1M ($15 / 1M over 272K input tokens)$40 / 1M ($60 / 1M over 272K)
gpt-5.4-pro$80 / 1M ($150 / 1M over 272K input tokens)$500 / 1M ($800 / 1M over 272K)
gpt-5.4-mini$2 / 1M$12 / 1M
gpt-5.4-nano$0.50 / 1M$4 / 1M
gpt-5.1$4 / 1M$25 / 1M
gpt-5$4 / 1M$25 / 1M
gpt-5-mini$0.80 / 1M$5 / 1M
gpt-5-nano$0.15 / 1M$1 / 1M
gpt-4.1$5 / 1M$20 / 1M
gpt-4.1-mini$1 / 1M$4 / 1M
gpt-4.1-nano$0.25 / 1M$1 / 1M
gpt-4o$8 / 1M$25 / 1M
gpt-4o-mini$0.40 / 1M$1.50 / 1M
o3$5 / 1M$20 / 1M
o3-mini$3 / 1M$12 / 1M
o4-mini$3 / 1M$12 / 1M
claude-fable-5.1$25 / 1M$150 / 1M
claude-opus-5.5$10 / 1M$50 / 1M
claude-sonnet-5.5$5 / 1M$25 / 1M
claude-haiku-5.5$0.25 / 1M ($1.50 / 1M over 100K input tokens)$1.50 / 1M ($8 / 1M over 100K)
claude-opus-4.8$15 / 1M$80 / 1M
claude-sonnet-4.6$8 / 1M$40 / 1M
claude-opus-4.5$15 / 1M$80 / 1M
claude-sonnet-4.5$8 / 1M$40 / 1M
claude-haiku-4.5$2.50 / 1M$15 / 1M
gemini-4-argon$10 / 1M$50 / 1M
gemini-3.8-flash$4 / 1M$20 / 1M
gemini-3.6-flash$4 / 1M$20 / 1M
gemini-3.5-flash-lite$0.80 / 1M$8 / 1M
gemini-3.1-pro$5 / 1M ($10 / 1M over 200K input tokens)$30 / 1M ($50 / 1M over 200K)
gemini-3.1-flash-lite$0.80 / 1M$4 / 1M
gemini-3-flash$1.50 / 1M$8 / 1M
gemini-2.5-pro$4 / 1M ($8 / 1M over 200K input tokens)$25 / 1M ($40 / 1M over 200K)
gemini-2.5-flash$0.80 / 1M$8 / 1M
gemini-2.5-flash-lite$0.25 / 1M$1 / 1M

Generative media. Billed per output unit (an image, or a second of video / audio), so a longer clip costs more. The “typical call” column is the default length:

ModelPer unitTypical call
whisper
Cloudrizz transcribe (Whisper v3 turbo)
$0.0015 / minute of audio$0.015 for 10 minutes of audio
aura-2
Cloudrizz speech (Aura 2)
$0.08 / 1,000 characters$0.08 for 1 1,000 characters
p-image-edit
Cloudrizz edit image (Pruna P-Image-Edit)
$0.025 / image$0.025 for 1 image
wan-i2v
Cloudrizz animate image (Wan 2.7 I2V)
$0.40 / second$2 for 5 seconds
veo-fast
Cloudrizz video (Veo 3.1 Fast)
$0.30 / second$1.80 for 6 seconds
wan-3
Cloudrizz video (Wan 3.0)
$0.50 / second$2.50 for 5 seconds
h3
Cloudrizz animate image (MiniMax H3)
$0.20 / second$1 for 5 seconds
bria-video-rmbg
Cloudrizz edit video (Bria RMBG 3.0)
$0.08 / second$4.80 for 60 seconds
music
Cloudrizz music (ElevenLabs Music v2)
$0.008 / second$0.24 for 30 seconds

Flat per-call models. A few models don't report token usage, so they bill a flat amount per call regardless of size:

ModelPrice
flux
Cloudrizz image (FLUX.1 schnell)
$0.01 / call
resnet-50
Cloudrizz image classify (ResNet-50)
$0.01 / call

Web tools. env.AI.search and env.AI.browse (the Live web section above) each bill a flat $0.01 per call.

Rates can change as upstream provider pricing moves; this table always reflects the current rate. Only the models listed on this page run; any other name is refused with unknown_model before it runs. Bring-your-own-key calls cost nothing on Cloudrizz, the vendor bills your account at their rates.

Errors

A failed call throws an Error with status and code fields. Wrap calls in try / catch and branch on e.code:

codeHTTPMeansDo
unpriced_model400env.AI.run was given a provider or partner model Cloudrizz has no price for. It was refused before it ran.Use a model listed under What each model costs, or call it with your own vendor key.
byo_key_required400A bring-your-own-key method was called without its key (or a model that isn't available key-free).Set the vendor key, or use an included model / run-by-id.
request_too_large402This one request could cost more than $5, the most a single AI request may cost. It was refused before it ran.Lower max_tokens or send less input.
rizz_limit_reached402A monthly AI limit is reached: the workspace's AI maximum, or the limit set for this app or member. The message says which.An owner or admin raises the limit (the usage page, or the app's AI settings), or wait for the 1st of next month.
out_of_credits402A workspace without a card has used its free $1 for the month (hosting pauses too).Add a card on the billing page, or wait for next month.
ai_unavailable503AI is unavailable for this app for now. The message never says why.Show a friendly message and try again later.
rate_limited429Too many AI calls from this app in a short window.Back off and retry shortly.
upstream_error4xx / 5xxThe model/provider rejected the call (bad input, unavailable model, …). The message carries the provider's reason.Fix the request, or try another model.
try {
  const res = await env.AI.run("gpt-6-luna", { input: question, max_output_tokens: 512 });
  // …
} catch (e) {
  if (e.code === "ai_unavailable") return Response.json({ error: "AI is unavailable right now" }, { status: 503 });
  if (e.code === "rizz_limit_reached") return Response.json({ error: "Monthly AI limit reached" }, { status: 402 });
  if (e.code === "byo_key_required") return Response.json({ error: "Set an API key for this model" }, { status: 400 });
  return Response.json({ error: e.message }, { status: e.status || 500 });
}