AI credits in your deployed app

Every AI call inside an app you ship with DontCode draws from the same credit balance you use in the editor. When that balance hits zero, the AI features in your live app pause until you refill. Here is exactly what that looks like for you and for your users.

6 min read
For project owners

Why this page matters

If your app uses AI image analysis, text generation, agents, or image generation, those calls cost money on every request. End users of your app cannot top up your account, so they cannot fix it when it stops working. You can. This page explains what happens at the wall, what your users see, and what email lands in your inbox.

How AI billing works

There is one shared credit pool per DontCode account. The editor (the AI that writes your app) and the deployed app (the AI features your users invoke) both pull from it. Pricing is per-token for chat / vision / agents and per-image for generation, with a small platform markup over the underlying model cost.

  • Every AI request in your live app is authenticated as your project, so we know whose balance to charge.
  • The actual model used depends on the "intent" you set when you call the SDK: quick, balanced, or thorough.
  • Charges land as a usage event in your credits ledger as soon as the call finishes.
  • There is a small platform markup on top of the raw model price to cover infrastructure and hosting.

What happens the moment your balance hits zero

We check your balance before every AI call. If it is at or below zero, the call is rejected before any AI runs (you are not charged for a partial failed call). The deployed app receives a structured 402 response that the @dontcode/ai SDK turns into a typed InsufficientCreditsError.

On the very first rejection per project per 24 hours, we also send you an email at your account address. Subsequent rejections inside that 24-hour window are silently counted but do not re-email you, so a busy app cannot spam your inbox. Once you top up, the counter resets and the next-time-it-happens email is armed again.

What your end user sees

By default, the SDK surfaces a generic English (or Korean) message: "This feature is temporarily unavailable. The site owner has been notified." We deliberately do not say "out of credits" or mention DontCode to your end user. They are not your billing contact, do not know what credits are, and seeing platform branding inside your app would be confusing.

You can override this copy in your own code if you want a more product-specific message (for example, "Your monthly AI quota has been used up, contact support"). The SDK exposes `error.userFacingMessage` and `error.userFacingMessageKo`, plus a stable `error.code === "INSUFFICIENT_CREDITS"` to detect the case.

Detecting it in your client app

import { isInsufficientCreditsError, useChat } from '@dontcode/ai/client'

function MyChatPage() {
  const { error } = useChat({ intent: 'balanced' })

  if (isInsufficientCreditsError(error)) {
    // Show a friendly message. The owner has already been notified.
    return <p>{error.forLocale('en')}</p>
  }
  // ...your normal UI
}

The email you receive

When your app blocks its first request after running out, you will get an email at your account address from "DontCode Billing". The subject reads:

[DontCode] "YourProjectName" is out of AI credits

The body confirms which project ran out, which AI feature was blocked (chat, vision, image generation, or agent), how many user requests have been blocked since the balance hit zero, and a direct link to top up. Once you refill, AI features resume immediately. No redeploy needed.

Things to think about before you launch

Pick the cheapest intent that gets the job done.

"quick" uses our smallest model and costs the least. "balanced" is a good default. Only use "thorough" when accuracy genuinely matters more than cost.

Watch the credits dashboard in the editor.

Your project credits balance and usage history are visible in the billing area of the dashboard. Set a calendar reminder to check it weekly until you have a feel for your burn rate.

Turn on Auto purchase.

On the Billing page, Auto purchase buys a credit package whenever your balance drops below a level you pick ("Buy when below"). It needs a card payment method. The 24h owner email is a safety net, not a substitute for monitoring.

Be ready to explain it to your users.

The default error message is intentionally vague. If you run an internal team app or a small customer base, you may want to override it with copy that mentions support contact details.

Troubleshooting "it stopped working"

When users tell you the AI feature is broken, check these in order:

  1. Open the dashboard and check your credits balance. If it is zero, that is your answer; top up and the app resumes.
  2. Check your inbox (and spam folder) for the "out of AI credits" email from DontCode Billing. If you see one, that confirms the cause.
  3. If your balance is positive but the app still fails, open your project's Analytics and check the Errors view, then the deploy logs under Details on History. A real bug returns a 500, not a 402.
  4. If a single specific AI call fails consistently but others work, the issue is likely with the prompt or the input data, not your billing.

Manage your balance

Open the billing area to see your current balance and refill options.

Still confused?

Billing questions are the kind of thing we want to answer quickly. Email us, we read everything.