Next.js starter for Wiro AI
Images, video, audio and chat in one Next.js app
Run any of the 1,000+ models in the Wiro AI catalog from a form built from the model’s own inputs, and see the price before each run. Every call goes through a route handler, so your API key stays on the server.
pruna/p-image
google/nano-banana-2
openai/gpt-image-2
pruna/p-image
@wiro-ai/wiro-llm, with the cost of each reply.HistoryYour recent runs with their outputs and costs, kept in this browser. Runs still going update on their own.How it works
The browser only talks to this app. Route handlers call Wiro AI with the key from WIRO_API_KEY.
app/api/modelsLists a category of the Wiro AI catalog (Tool/List).app/api/models/[owner]/[project]Reads one model’s inputs and price list (Tool/Detail).app/api/runsChecks the form against the model’s inputs, prices the run and starts it (POST /Run).app/api/tasks/[token]Reads the task’s stage, outputs and cost (Task/Detail).app/api/uploadsStores a file from the browser for a run (File/Upload).app/api/chatStreams a reply from the Wiro LLM gateway with streamText.
// app/api/runs/route.ts, shortened
const model = await getModel('pruna/p-image'); // Tool/Detail
const built = buildParams(model.params, values); // checked against the schema
const price = quote(model.pricing, built.params); // as Wiro bills it
const { token } = await runModel(model.id, built.params); // POST /Run
// The browser then polls /api/tasks/{token} for the stage and the outputs.