AI Features Inside Your App

Your app can use AI for the people who use it - a button that writes a product description, a support reply that drafts itself, a summary of a long form. Playcode runs the AI calls for you, so you never sign up with an AI company and never handle an API key.

Two different AI things, one product

Playcode has AI in two places, and it is worth keeping them apart:

  • The agent that builds your project. You talk to it, it writes your code. That is covered in the AI agent article.
  • AI inside the app you built. It works for your users, while your app is running, long after you stopped typing. That is this page.

Your app calls AI through Playcode

Playcode runs its own AI gateway. Your app's backend sends its request there, and Playcode passes it on to the AI provider and returns the answer.

That removes the two steps most people get stuck on:

  • No provider account. You do not open an account with an AI company or add a card there. Playcode holds that account.
  • No API key to manage. Playcode creates the credential for your app and puts it in place. You never see it, copy it, or store it anywhere.

The models available to your app today are from the Claude family. Your app asks for a model by its real name, and Playcode passes that through unchanged - so a newly released model works without any change on your side.

How to ask for it

Describe the feature in plain words. "Add a Generate button to my product form that writes the description" is enough. You do not need to name a model or mention keys.

The agent then does four things:

  1. Checks whether AI is already switched on for this app.
  2. Switches it on if it is not. Playcode writes the credential and the gateway address into your app's settings and restarts the app.
  3. Writes a small endpoint in your app's backend that makes the AI call, and connects your screen to it.
  4. Makes one real call to prove it works, and reports back. A feature that was never called once is not finished.

Tell the agent what the feature should produce and who should be allowed to use it. Those two answers matter far more than the model.

It needs a Cloud project

The AI call happens in your app's backend, so the project has to be a Cloud project - one with its own backend, database, and files. A browser-only project has no backend to hold the credential, so there is nothing to switch on. Ask the agent to check, and it will tell you plainly if your project is not there yet.

Your work-in-progress app and your published app are separate. Switching AI on while you build does not switch it on for the published one - publish the project, and the agent can arm that side too.

The credential stays on your server

The credential authorizes spending against your workspace, so it belongs on the server and nowhere else. Your browser code never talks to Playcode's AI gateway. It talks to your own endpoint, and that endpoint makes the call. The agent builds it this way by default.

Put a sign-in check on every AI endpoint. An AI endpoint that anyone on the internet can call is an open tap on your credits. If your feature is for signed-in customers, say so when you ask for it.

How it is paid for

Playcode holds the provider account, so there is no second bill, no second account, and no card at another company. Every call your app makes is recorded against your workspace, and each one comes back with a usage id - a receipt the agent keeps in your app's log, so a single call can always be traced later.

What in-app AI costs is on the pricing page, which is the accurate place for it. Credits and top-ups work the same way as for the building agent, described in How credits work.

Watch it as your app grows

This is the real difference from the building agent. Your own spending stops when you stop working. In-app AI follows your users' activity - ten people or ten thousand, at night, at the weekend, while you sleep. Usage grows with them.

A few habits keep that comfortable:

  • Watch the usage after you launch an AI feature. That first real week tells you far more than any estimate. See your usage history.
  • Turn on auto-recharge so a popular feature does not stop at an awkward moment. See auto-recharge.
  • Ask for the fast, cheap model on high-volume features. Most product work - short answers, classification, drafts - does not need the most capable model. Save that one for the hard jobs.
  • Keep the feature behind a sign-in, and keep it off any public page that search engines and bots can reach.

Playcode also applies its own per-minute and per-day limits to your app's AI traffic. If a bug in your app ever starts a loop, those limits stop it rather than letting it run all night.

When a call fails

Tell the agent what you saw - it can read your app's log and the detail Playcode returns with every refusal. The common ones are short:

  • Out of credits. Top up. This is not a bug in your app.
  • Too many requests, too fast. A limit was reached. Your app should wait and try again, which the agent can build in.
  • AI is not switched on for this app. Ask the agent to check the app's services and switch it back on.
  • The AI provider rejected the request itself. Usually the input was too long or malformed. The agent can read the provider's own message and fix the request.

Where to go next

Need help?

Not sure whether your project can take an AI feature, or what it would cost you to run? Use the chat button in the bottom right corner of any Playcode page. A human will reply.

Need more help?

Can't find what you're looking for? Chat with us or send us an email.