AI feature went silent? Check API quota
Your site has an AI feature: a chatbot, a summary button, an image generator. It worked in the preview, it worked at launch, and then one morning it just spins, shows a vague "something went wrong", or returns nothing at all. You didn't deploy anything. What changed is usually on the AI provider's side: your account ran out of credit, hit a rate limit, or had its key switched off.
The symptom
- The AI part of the site fails while everything else (pages, login, database) still works.
- It fails for every visitor at once, often starting at a specific time, not gradually.
The cause
Almost every AI provider (OpenAI, Anthropic, Google) bills per request and enforces limits per account and per key. Sites built with Lovable, Bolt, Replit, v0 or Cursor usually call one of these from a server function or edge function with a single secret key. When that one key stops being accepted, the whole feature stops. The common reasons are:
- Credit or quota used up. Prepaid credit ran to zero, a monthly spend cap you set was reached, or a free trial allowance ended.
- Rate limits. The provider allows a set number of requests or tokens per minute. A traffic spike, a loop that retries too quickly, or one heavy user can push you over, and requests get rejected until the window resets.
- Revoked or rotated key. If a key was ever shipped in front-end code or pushed to a public repository, it can be found and abused, and providers may disable keys they detect as leaked.
- Model retired or renamed. Providers retire older model names on a published schedule. A request naming a model that no longer exists is rejected.
Step-by-step diagnosis
- Read the real error. Open your browser's developer tools on the live site, go to the Network tab, trigger the AI feature and click the failing request.
- Check the function logs. In Supabase, open Edge Functions and the logs for the function that calls the AI provider. On Vercel or Netlify, open the function logs for the deployment. Look for the HTTP status the provider returned.
- Match the status code. A
429means rate limit or quota (the message usually says which). A401means the key is missing, wrong or revoked. A billing message means payment. A404or "model not found" usually means a retired or misspelled model name. - Check the provider dashboard. Log in to the AI provider's console and look at usage, billing, limits and API keys. Confirm there is credit, the spend cap isn't hit, and the key your site uses still exists and is active.
- Test the key directly. Make one small request with the same key from a terminal or the provider's playground. If it fails there too, the problem is the account or key, not your site.
Fixes per builder or host
- Lovable and Supabase. Store the provider key as a Supabase Edge Function secret, never in front-end code. After rotating a key, update the secret and redeploy or restart the function so it reads the new value.
- Bolt and Netlify. Put the key in the site's environment variables and call the provider from a Netlify function. Changing an environment variable needs a new deploy before it takes effect.
- v0 and Vercel. Add the key under the project's environment variables for Production, not only Preview, then redeploy. Call the provider from a route handler or server action, not the browser.
- Replit. Use Secrets for the key, and check that the deployment has the secret too, since the workspace and the deployment can differ.
- Cursor projects. Wherever you host, keep the key in the host's secret store and out of the repository. If it was ever committed, rotate it, because removing the file does not remove it from git history.
For rate limits, add a short retry with growing delays and cap the number of retries so a failure doesn't turn into a flood. For quota, set a spend cap you can afford plus a usage alert from the provider, and top up or raise the cap if real usage outgrew it.
Whatever the cause, show visitors a clear message when the AI call fails instead of an endless spinner.
How to verify
- Trigger the feature on the live domain from a private window and confirm a real answer comes back.
- Check the function logs show a
200from the provider, not a retry that happened to succeed.
Prevention
- Turn on the provider's usage and billing alerts, sent to an inbox someone reads.
- Never put an AI key in browser code; route every call through a server function.
- Add per-visitor limits so one person or bot can't burn your whole quota.
- Check the AI feature from outside on a schedule, because a spent quota fails silently until a visitor complains.
An AI feature can break with zero changes on your side. Checking the live site the way a visitor uses it is the quickest way to find out before they do.
