Everything the agent adds is ordinary code you can read and change. A published app serves its built front end and the AI route; server code, including payment and webhook routes, keeps running in the project’s sandbox, which Preview and the Draft link reach.
AI
The app can call any model in the pre.dev catalog through the AI Gateway, billed to your workspace’s credits. The agent reads the model catalog, picks an id, and wires the call; ask it to list models with prices if you want to choose. Turn on auto-recharge in billing so a live app does not stop at zero.From browser code
The key never reaches the browser. Apps on pre.dev’s default web scaffold serve a same-origin route,/predev-ai/, that adds the key and the project id and sends the request on to https://api.pre.dev/v1. Browser code calls it with no key:
/predev-ai/images, /predev-ai/audio/speech, /predev-ai/audio/transcriptions, /predev-ai/embeddings, /predev-ai/models, and streaming responses. The route accepts requests only from the app’s own pages, and request bodies up to 25 MB. GET /__predev_ai reports whether the route is on. The same route is part of a published app, so AI features keep working at its permanent address.
From server code
Apps with their own server, such as Next.js, Express, or Hono, use a stock SDK with the variables above. Sendx-predev-project-id so usage is attributed to the project; calls through /predev-ai carry it automatically.
GET /v1/usage reports the attributed totals. Validate and rate-limit any route that spends credits. For local development outside the sandbox, set PREDEV_API_KEY to your key and PREDEV_API_URL=https://api.pre.dev; see authentication.
Payments
Payments run on Stripe, in test mode while you build. The agent creates products and prices in code, wires Stripe Checkout, mounts the webhook handler, and tests the flow with a test card before handing it back. The Payments overview explains how it works, webhooks covers event delivery, and go live covers real payments.Server side
The Stripe SDK needs its host pointed at pre.dev. That is the only difference from any Stripe app.lookup_key and creating it only when missing. There is no Stripe dashboard to click through while in test mode. STRIPE_SECRET_KEY can create refunds and read customers, so call Stripe from a server route, never from the browser.
Browser side
Stripe Checkout needs no browser code beyond sending the user tosession.url. The pre.dev preview runs your app inside an iframe, and Stripe Checkout refuses to render inside a frame, so open it in a new tab when framed:
stripeAccount, Elements cannot find your account.
Activation and test cards
The first time a workspace uses payments, pre.dev creates its test account. Stripe usually activates it in under a minute, occasionally a few. Until then a charge attempt returns HTTP 503 with codepayments_account_activating and a Retry-After header. Nothing is misconfigured; retry shortly.
In test mode, use card number 4242 4242 4242 4242 with any future expiry, any CVC, and any postal code. Stripe’s other test cards work too, including the ones that decline.
Sign-in
When a project needs user accounts, pre.dev creates a Clerk app for it and writes the app’s keys to the project’s environment. There is no Clerk account to create and no key to paste. Change how people sign in from the Auth card on Integrations → Built-in, or ask the agent:
Keep at least one sign-in method on. The preview picks up a change on its next page load.
Each Clerk app is managed by pre.dev until you claim it. Claim in Clerk moves the app into your own Clerk account; manage sign-in from Clerk’s dashboard after that. To use a Clerk app you already run, put its keys in the project’s API Keys tab instead.

