Skip to main content
Every project built on pre.dev gets the workspace’s API key injected into its sandbox and deploy environment automatically. There is nothing to paste and nothing to rotate by hand. Build the gateway URL as ${PREDEV_API_URL}/v1.

Ask the build agent

Tell the coding agent what you want, for example “add an AI feature”, “add a summarize button that uses a fast model”, or “let users chat with their documents”. The agent reads the model catalog for you, picks an id, and wires a server-side call using the variables above. Ask it to list models with prices if you want to choose. Everything the agent adds is ordinary code you can read and change. The credits a deployed feature spends come from the same workspace balance; turn on auto-recharge in billing so a live app does not stop at zero. See pricing.

Server-side only

The key spends the workspace’s credits, so it must never reach the browser. A single-page app calls its own backend route, and the route calls the gateway. The build agent follows this rule; keep it when you edit by hand.
The browser calls POST /api/summarize; only the server holds the key. Validate and rate-limit that route as you would any endpoint that spends money.

Attribute usage to the project

Send x-predev-project-id: <projectId> on each gateway call, as the examples above do, and the call is attributed to that project. Only the workspace’s own projects count; other ids are ignored. GET /v1/usage reports the attributed totals.

Local development

Outside the sandbox, copy the key from Integrations → API Keys into your local environment as PREDEV_API_KEY and set PREDEV_API_URL=https://api.pre.dev. See API key and environment variables.