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.
| Way | Call | API key? | Billed to | You get back |
|---|---|---|---|---|
| Purpose method | env.AI.chat({ messages }) | None | Your workspace's usage | res.response |
| Run by name | env.AI.run("<name>", input) | None | Your workspace's usage | the model's native shape |
| Bring your own key | env.AI.openai.chat({ … }) | Your vendor key | The 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.
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:
| Method | Pass | Read 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.search | query or { query, limit } | res.items ([{ url, title, description }]) |
env.AI.browse | url 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) | Task | Purpose method |
|---|---|---|
llama-3.3-70b | Chat / general | env.AI.chat |
deepseek-r1 | Reasoning / analysis | env.AI.research |
gpt-oss-120b | Coding + tools (agentic) | env.AI.code |
deepseek-v4-flash | Coding (fast, agentic) | run("deepseek-v4-flash") |
deepseek-v4-pro | Coding (long-horizon) | run("deepseek-v4-pro") |
glm-5.3-flash | Coding (low-cost agentic) | run("glm-5.3-flash") |
clef | Typed decisions | env.AI.decide |
clef-flash | Typed decisions (faster) | env.AI.decideFast |
whisper | Speech → text | env.AI.transcribe |
llama-4-scout | Image → text | env.AI.vision |
flux | Text → image | env.AI.image |
bge-embed | Text embeddings | env.AI.embed |
aura-2 | Text → speech (English) | env.AI.speak |
m2m100 | Translation | env.AI.translate |
bge-reranker | Rerank (RAG) | env.AI.rerank |
distilbert-sentiment | Sentiment | env.AI.classify |
resnet-50 | Image → class labels | env.AI.classifyImage |
p-image-edit | Image → image | env.AI.editImage |
h3 | Image → video | env.AI.animateImage |
h3 | Text → video, with sound | env.AI.video |
bria-video-rmbg | Video → video | env.AI.editVideo |
music | Music | env.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 kind | Call | Read 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 Claude | run("claude-sonnet-4.5", { messages, max_tokens }) | res.content[0].text |
| Google Gemini | run("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.
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).
| Method | Pass | Read 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" },
});editVideo needs its provider enabled on the platform gateway, ask us if a media call returns "not available".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.
| Method | Pass | Read the result at | Cost |
|---|---|---|---|
env.AI.search | query or { query, limit } (1-10) | res.items ([{ url, title, description }]) | $0.01 / call |
env.AI.browse | url 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 probability0–1.choice, pick one of your labelled options; returns thechoiceplus a probability per option and aconfidence.score, rate on a level scale; returns a probability-weightedscoreplus 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(aliasenv.AI.gemini) →GOOGLE_API_KEY. GeminigenerateContentshape (model+contents, notmessages).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); lowermax_tokensor 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:
| Model | Input | Output |
|---|---|---|
llama-3.3-70bCloudrizz chat (Llama 70B) | $0.80 / 1M | $8 / 1M |
deepseek-v4-flashCloudrizz code (DeepSeek V4 Flash) | $1.20 / 1M | $4 / 1M |
deepseek-v4-proCloudrizz code (DeepSeek V4 Pro) | $4 / 1M | $10 / 1M |
deepseek-r1Cloudrizz research (DeepSeek-R1 32B) | $1.50 / 1M | $15 / 1M |
gpt-oss-120bCloudrizz code (gpt-oss 120B) | $1 / 1M | $2 / 1M |
glm-5.3-flashCloudrizz code (GLM-5.3 Flash) | $0.40 / 1M | $1.50 / 1M |
clefCloudrizz decide (Clef) | $0.80 / 1M | $0 / 1M |
clef-flashCloudrizz decide (Clef flash) | $0.10 / 1M | $0 / 1M |
llama-4-scoutCloudrizz vision (Llama 4 Scout) | $0.80 / 1M | $2.50 / 1M |
bge-embedCloudrizz embeddings (BGE large) | $0.50 / 1M | $0 / 1M |
m2m100Cloudrizz translate (M2M100) | $1 / 1M | $1 / 1M |
bge-rerankerCloudrizz rerank (BGE reranker) | $0.015 / 1M | $0 / 1M |
distilbert-sentimentCloudrizz 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:
| Model | Input | Output |
|---|---|---|
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:
| Model | Per unit | Typical call |
|---|---|---|
whisperCloudrizz transcribe (Whisper v3 turbo) | $0.0015 / minute of audio | $0.015 for 10 minutes of audio |
aura-2Cloudrizz speech (Aura 2) | $0.08 / 1,000 characters | $0.08 for 1 1,000 characters |
p-image-editCloudrizz edit image (Pruna P-Image-Edit) | $0.025 / image | $0.025 for 1 image |
wan-i2vCloudrizz animate image (Wan 2.7 I2V) | $0.40 / second | $2 for 5 seconds |
veo-fastCloudrizz video (Veo 3.1 Fast) | $0.30 / second | $1.80 for 6 seconds |
wan-3Cloudrizz video (Wan 3.0) | $0.50 / second | $2.50 for 5 seconds |
h3Cloudrizz animate image (MiniMax H3) | $0.20 / second | $1 for 5 seconds |
bria-video-rmbgCloudrizz edit video (Bria RMBG 3.0) | $0.08 / second | $4.80 for 60 seconds |
musicCloudrizz 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:
| Model | Price |
|---|---|
fluxCloudrizz image (FLUX.1 schnell) | $0.01 / call |
resnet-50Cloudrizz 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.
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:
| code | HTTP | Means | Do |
|---|---|---|---|
unpriced_model | 400 | env.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_required | 400 | A 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_large | 402 | This 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_reached | 402 | A 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_credits | 402 | A 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_unavailable | 503 | AI is unavailable for this app for now. The message never says why. | Show a friendly message and try again later. |
rate_limited | 429 | Too many AI calls from this app in a short window. | Back off and retry shortly. |
upstream_error | 4xx / 5xx | The 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 });
}