> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/account-level/ai-credits/sample-flows.md

## Article Content:

# AI Credits: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Display an account's AI credit balance

Apps that offer AI features often show account owners how many credits they have left. The AI Credits API returns the full balance in a single call, so you can render it in a dashboard or settings page.

To display an account's AI credit balance:

1. Call [Get Balance](https://dev.wix.com/docs/api-reference/account-level/ai-credits/get-balance.md) to retrieve the account's current balance. The request takes no parameters.
1. Read `periodicCredits.balance` for remaining recurring credits and `topUpCredits.balance` for remaining top-up credits, then show the total available as `periodicCredits.balance + (topUpCredits.balance ?? 0)`.
1. Optionally, use `creditBalanceBreakdown` to display credits from each source separately.
1. Refresh the balance after AI actions so the displayed total stays accurate.

## Gate an AI feature on available credits

Before running an AI action that consumes credits, check whether the account has enough credits and prompt the account to top up if it doesn't.

To gate an AI feature on available credits:

1. Call [Get Balance](https://dev.wix.com/docs/api-reference/account-level/ai-credits/get-balance.md) to retrieve the account's current balance.
1. Calculate the total available credits as `periodicCredits.balance + (topUpCredits.balance ?? 0)`.
1. Compare the available credits with the estimated cost of the action, and run the AI action when there are enough credits.
1. When there aren't enough credits, prompt the account to upgrade their plan or purchase top-up credits, and don't run the action.