Add whoopsie to your AI app.
Pick where you build. Copy the prompt. Paste it into your AI builder's chat. It edits the code for you. No terminal needed.
Open your Lovable project, click the chat with the AI, paste the prompt below.
Add "whoopsie" failure observability to my AI app.
What it does: catches when my chatbot loops, hallucinates, or burns through tokens, and shows the failures live at https://whoopsie.dev/live/ws_b9oPiKAACu4GwjKY
Steps to follow exactly:
1. Add the dependency: `@whoopsie/sdk`.
2. Find the file in my project that calls `streamText` or `generateText` from the `ai` package. It's usually `app/api/chat/route.ts`. If there are multiple, pick the main chat one.
3. At the top of that file, make sure these two imports exist (add the second one):
```ts
import { wrapLanguageModel } from "ai";
import { whoopsieMiddleware } from "@whoopsie/sdk";
```
4. Find the line that passes a model. It looks something like `model: openai("gpt-4o")` or `model: anthropic("claude-sonnet-4-6")`. Wrap the existing model expression with `wrapLanguageModel`:
```ts
model: wrapLanguageModel({
model: <whatever was there before>,
middleware: whoopsieMiddleware(),
})
```
5. Add this environment variable to Lovable → Project Settings → Environment Variables:
```
WHOOPSIE_PROJECT_ID=ws_b9oPiKAACu4GwjKY
```
6. After you've made the changes, reply to me with one sentence:
"Whoopsie is wired up. Open your live dashboard at https://whoopsie.dev/live/ws_b9oPiKAACu4GwjKY and hit your chat once."
Do not skip step 5 (the env var) or step 6 (the confirmation message).your live dashboard
https://whoopsie.dev/live/ws_b9oPiKAACu4GwjKYOpen this in another tab. Once Lovable confirms whoopsie is wired up and you hit your chat, the first event lands here.
project id: ws_b9oPiKAACu4GwjKY
Why this works
Lovable, Replit, Bolt, Cursor, and v0 all let you talk to an AI that edits your code. The prompt above tells that AI exactly what to do: install the SDK, find the model call, wrap it. The wrap is one line of TypeScript that catches loops, hallucinations, and cost spikes and streams them to your dashboard.
You don't have to read the code, write the code, or run anything in a terminal. If your AI builder gets stuck, paste the same prompt again — it's self-contained.