> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpaygent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpaygent.com/_mcp/server.

# Scan

> Find AI provider calls that are not reporting usage.

`paygent scan` walks a codebase, finds every AI provider call that is not yet metered, and writes an integration plan for them.

## `paygent scan`

```bash
paygent scan .
```

```text
FILE          LINE  PROVIDER       KIND  FUNCTION
generator.py  340   Google Gemini  LLM   _generate_structured
research.py   47    Google Gemini  LLM   research_topic

  2 call(s) to instrument across 2 file(s).

  Integration plan written to:
    paygent_module/paygent_integration_prompt.md
```

| Flag                 | Description                                        |
| -------------------- | -------------------------------------------------- |
| `--copy`             | Copy the integration plan to the clipboard.        |
| `--print-prompt`     | Write the plan to stdout instead of the table.     |
| `--dynamic-customer` | Thread a per-request customer ID through the plan. |
| `--provider <name>`  | Only report this provider.                         |
| `--no-write`         | Report without writing `paygent_module/`.          |
| `--quiet`            | Print only the count.                              |
| `--out-dir <path>`   | Write results somewhere else.                      |

> **Info**
>
> The scan is read-only. Nothing is sent anywhere, no credentials are needed, and no source file is modified.

## What It Detects

121 detectors across Python, JavaScript, TypeScript, and Go.

| Category         | Providers                                                                                                              |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------- |
| LLM              | OpenAI, Anthropic, Gemini, Vertex AI, Groq, Cohere, Mistral, Together, Replicate, Ollama, OpenRouter, DeepInfra        |
| Frameworks       | LangChain, LangGraph, LlamaIndex                                                                                       |
| Speech-to-text   | Deepgram, AssemblyAI, Whisper, Google Cloud, Azure, Rev AI, Speechmatics, Amazon Transcribe, Gladia, Soniox, Vosk      |
| Text-to-speech   | ElevenLabs, Cartesia, Amazon Polly, PlayHT, OpenAI, Google Cloud, Azure, Murf, Resemble, LMNT, Kokoro, Rime, Speechify |
| Speech-to-speech | LiveKit, Vapi, OpenAI Realtime, Gemini Live                                                                            |
| Video            | OpenAI Sora, Google Veo, RunwayML                                                                                      |

Files already reporting usage are skipped, as are `node_modules`, `.venv`, `dist`, and `build`.

## Getting the Plan

#### Clipboard

```bash
paygent scan . --copy
```

#### Pipe

```bash
paygent scan . --print-prompt | pbcopy
paygent scan . --print-prompt > PLAN.md
```

#### File

```bash
open paygent_module/paygent_integration_prompt.md
```

The plan proposes agents, asks the questions that cannot be inferred from source code, then gives the exact commands to create everything and instrument the calls.

## Multi-Tenant Apps

On a terminal the scan asks whether your customer ID is resolved per request. Skip the question with the flag:

```bash
paygent scan . --dynamic-customer
```

The plan then asks which variable holds the customer ID and threads it through every usage call.

## In CI

Fail a build that introduces an unmetered call:

```bash
if [ "$(paygent scan . --no-write --output json | jq '.total_detections')" -gt 0 ]; then
  echo "Unmetered AI calls introduced"
  exit 1
fi
```