AI in your app
Text and structured answers, web-grounded answers, reading uploaded files, extracting fields and generating images, billed to you, or run through your own key.
Last updated September 17, 2026
On this page
Your app can call AI directly, with no keys to manage and no accounts to set up: categorise a support message, summarise a document, draft a reply, read a receipt, generate a poster. These are runtime features your app's users trigger, distinct from the builder that writes the app.
What it can do
import { ai, files } from "@praxivara/sdk";
const text = await ai.invokeLLM({ prompt }); // plain text
const data = await ai.invokeLLM({ prompt, response_json_schema: { ... } }); // JSON matching the schema
const web = await ai.invokeLLM({ prompt, add_context_from_internet: true }); // grounded on live web results
const read = await ai.invokeLLM({ prompt, file_urls: [up.file_url] }); // reads an uploaded PDF or image
const { url } = await ai.generateImage({ prompt, size: "1024x1024" }); // an image for the app
const { output } = await ai.extractDataFromUploadedFile({ file_url: up.file_url, json_schema });- Structured answers: pass a JSON schema and get back an object your app can rely on, a category, a priority, parsed fields, instead of free text to parse.
- Web grounding: lets the answer draw on live web results when the question is about the world rather than your data.
- Reading files: only files your app stored through its own upload, never an arbitrary outside address.
- Extraction: pull named fields out of a receipt, an invoice or a form scan.
- Images: a generated image is stored with the app and referenced like any other asset.
Who can call it
AI calls need a signed-in user by default, so put them behind a login or on an admin screen. They should be deliberate, labelled features with a loading state, never something that runs every time a page renders.
Billing
AI features are billed to you, the owner, in credits, never to your app's users. Each app has its own line on the Usage page so you can see what a feature costs. If a call cannot run, for example because your balance is spent, the app receives a clear error to show instead of retrying.
Using your own key
If you would rather pay your AI provider directly, store your own key as a secret named OPENAI_API_KEY or ANTHROPIC_API_KEY. Calls then route through your key and no credits are charged for them. See Secrets.
Long outputs
For a long document, a full article or a report, the builder generates it section by section rather than in one call, so each part arrives complete.
Asking for it
When a support message arrives, categorise it and set a priority. Let admins generate a poster for a class from its description. Read the uploaded receipt and fill in the amount and date. The builder writes the call, the loading state and the error state.