# Monitor AI calls in your app

> Once Relia is set up, every call your product makes to OpenAI, Anthropic, Gemini and other AI models, and every call to your MCP server's tools, shows up in Relia with no code change.

Section: Set up your stack · Page: https://tryrelia.com/docs/ai-calls-setup · Last checked against the product: 2026-11-01
Video walkthrough: https://youtu.be/xcQ2aAHnrRM

If your product uses AI, Relia watches it with nothing new to add: model calls become **AI runs**, and if your product has its own MCP server, each tool call is recorded too. You only need Relia set up on the server or edge code that makes the calls.

## Before you start

- Relia set up where your AI calls happen: [Node.js](https://tryrelia.com/docs/node-express-setup.md), [Next.js](https://tryrelia.com/docs/nextjs-setup.md), [Python](https://tryrelia.com/docs/python-setup.md) or [edge runtimes](https://tryrelia.com/docs/edge-runtimes-setup.md).
- The newest Relia SDK: version 0.8 or later on npm, 0.6 or later for Python.

## Steps

1. **Update the SDK** in your app's folder:

   ```bash
   npm i relia-sdk@latest
   ```

   For Python:

   ```bash
   pip install -U relia-sdk
   ```

2. **Restart your app and use its AI feature once.** That's all: your code stays the same.

## Which model calls are recorded

Every call to OpenAI, Anthropic, Google Gemini, OpenRouter, Groq, Mistral, DeepSeek, Together, xAI, Perplexity, Fireworks or Cohere becomes an AI run, streamed answers included. Each run shows the model, tokens, estimated cost, how long it took and whether it failed.

| Where | What is covered |
|---|---|
| Node.js | The official `openai` and `@anthropic-ai/sdk` packages, plain `fetch`, and the Vercel AI SDK (`streamText`, `generateText`) |
| Python | The `openai` and `anthropic` packages, and anything using `httpx` or `requests` |
| Edge (Supabase Edge Functions, Deno, Cloudflare Workers) | Calls made with `fetch` inside `withRelia` |

A model call followed by a tool and another model call is one run, with the tool as a step in between. A request that is retried after a rate limit or server error counts as one run. A run made during a request joins that request, so if the request fails, the run is part of the same incident.

Costs are estimates from public list prices. A model Relia doesn't know shows no cost rather than a guess.

## Your MCP server

Does your product offer tools to AI assistants (Claude, Cursor, ChatGPT and others) through an MCP server built with the official MCP SDK, in Node.js or Python? Then every tool call is recorded: which tool, which assistant called it, how long it took and whether it failed.

What the assistant asked and what the tool answered are never recorded. MCP tool calls cost no extra units; each AI run counts as 5 units of your monthly pool.

## Where to see it

In Relia, open **AI in your product** in the menu:

- **Runs** lists your model calls.
- **Tool calls** shows the tools your AI uses, and below them, **Your MCP server** with each of its tools.

Relia raises a finding when runs fail or get slow, when your AI's spend jumps well above its usual level, and when one of your MCP tools starts failing or slowing down.

> **Tip:** watch [AI feature failing or costing too much? Monitor LLM calls and MCP tools](https://youtu.be/OCDIWdXLIQs) (2 min).

## Turn it off

| Setting | What it does |
|---|---|
| `RELIA_AI_CAPTURE=0` | Stops recording model calls |
| `RELIA_DISABLE_INSTRUMENTATIONS=mcp` | Stops recording MCP tool calls |

Prompts and answers of model calls are kept with e-mail addresses masked. If you'd rather not keep them, turn model-call capture off.

## Check it worked

Use your product's AI feature once. On your project's **Setup** tab, **AI agent runs** changes from *Optional* to *Arriving*, and the run appears under **AI in your product** → **Runs**.

## If something's wrong

- **No runs:** check the SDK version (0.8 or later on npm, 0.6 or later for Python) and restart the app after updating.
- **No runs from an edge function:** the model call must happen inside the handler wrapped with `withRelia`.
- **Looking for Claude Code or Cursor themselves?** Those are your own AI assistants, connected to Relia from your profile. They don't appear here. See [Connect your AI assistant](https://tryrelia.com/docs/connect-ai-assistant.md).

## Next

- [AI in your product](https://tryrelia.com/docs/ai-in-your-product.md)
- [AI feature failing or costing too much?](https://tryrelia.com/docs/ai-feature-failing.md)
- [Privacy in Relia](https://tryrelia.com/docs/privacy.md)

---
All Relia docs for AI assistants: https://tryrelia.com/llms.txt (index) · https://tryrelia.com/llms-full.txt (everything in one file)
