On this page
You can give your own app AI features, such as a chat assistant, image generation, search over your content or turning speech into text. Swarmz handles the AI keys and billing for you, so there is no separate account to open. Usage is charged to your credits. Turn it on under Tools, then AI.
What you can add#
- Chat: a helper that answers questions, writes text or explains things on your site.
- Images: create pictures from a description.
- Search: let visitors find things in your content by meaning, not just exact words.
- Speech to text: turn a recording into written text.
Turn it on#
AI runs on Swarmz Cloud, so turning AI on also sets up a database, sign-in and storage for your app.
Step 1: Open the AI page
Click Tools, then AI. If Cloud is not on, you see "AI in your app" with a button Enable Cloud + AI.
Step 2: Choose a region
Click Enable Cloud + AI, pick the Region closest to your visitors and click Create Cloud + AI. Setup takes a few minutes.
Step 3: Ask the AI to build the feature
Describe what you want. For example the prompt below. The AI adds the screen, the server code and the connection to the AI service.
Step 4: Test it in the preview
Try the feature and check the result looks right.
Add a help chat bubble to the bottom right of my site. It should answer questions about my opening hours and menu, and politely say so if it does not know.
How it is wired#
Your project gets its own managed key, saved in Tools, Cloud, Secrets as SWARMZ_API_KEY and marked Managed. The AI uses it in a server function so it never reaches a visitor's browser. You do not copy or paste it anywhere. If you ever need to replace it, use Regenerate key. The old one keeps working for 24 hours.
See what your app asked for#
The AI page under Tools shows requests your app makes to AI models. Until your app makes one, it offers Ask Swarmz to add an AI feature instead.
- Credits: what was charged to your credits.
- Requests: how many calls were made, across all models.
- Success rate: the share of requests that got an answer.
- Avg duration: the average time to answer.
The Requests list shows the latest calls with a status of Succeeded, Failed or Out of credits. Select one for its model, timing, size and the full request and response, which helps when an answer looks wrong. Open requests contain what your visitors typed, so share the page carefully.
What it costs#
AI requests use the same credits as everything else in your workspace. Your plan may include some free Cloud and AI usage each month, and anything beyond that uses your credits automatically. The AI intro page shows the exact amount for your account. If credits run out, requests show Out of credits until you add more. See Cloud usage and limits and How credits work.
Good to know#
- Keep prompts short and clear, and ask the AI to limit how long answers can be. Longer requests cost more.
- If your app is public, ask the AI to add a limit so one visitor cannot make thousands of requests, or require sign-in first. See Add sign-in to your app.
- Do not ask the AI to put a provider key in your app's code. The managed key already covers this.
- Using a different AI service with your own key is possible too. Add the key in Secrets.
Common questions#
Do I need an account with an AI company?
No. Keys and billing are handled for you.
Which AI model does my app use?
The usage page shows the model for each request. Ask the AI to use a different type, such as an image model, if you need one.
Can I stop it spending credits?
Remove the feature, or ask the AI to add a limit. Idle apps use nothing.
Why did a request fail?
Open it in the Requests list. Out of credits means your balance ran out. Otherwise the detail shows the error.
Was this helpful?
Related articles
What is Swarmz Cloud?
Swarmz Cloud is the backend for your app: a database, user accounts, file storage and server functions, set up and looked after for you.In Cloud: data, sign-in and storageCloud usage and limits
See what your app's backend has used, how it is charged in credits, and what to do if the database is full or Cloud is paused.In Cloud: data, sign-in and storageKeep API keys and secrets safe
Store API keys and passwords for your app in Cloud Secrets, so they never end up in your code or chat.In Cloud: data, sign-in and storageHow credits work
What a credit is, which credits Swarmz spends first, and where to see your balance.In Credits, plans and billing
Still have a question?
Ask about this article, or talk to a person.