> 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.

# Cost-Only & Revenue-Only Tracking

Most integrations track both provider cost *and* customer revenue by sending usage with an indicator. Paygent also supports tracking **cost only** (no billing) or **revenue only** (no usage payload) when that better matches your product.

## Tracking Modes

| Feature                                | Cost-Only                                                           | Revenue-Only                                                          |
| -------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------- |
| Use when                               | You need LLM/provider cost visibility without charging the customer | You bill from indicator pricing and do not send token/usage telemetry |
| SDK method (Python)                    | `send_usage()` without an indicator                                 | `send_indicator()`                                                    |
| Requires usage\_data                   | Yes — tokens, model, provider                                       | No                                                                    |
| Requires indicator                     | No — omit or pass empty string                                      | Yes                                                                   |
| Writes cp\_data (cost table)           | Yes                                                                 | No                                                                    |
| Writes billing\_events (revenue table) | No                                                                  | Yes                                                                   |
| Dashboard analytics                    | Cost metrics only                                                   | Revenue metrics only                                                  |

---

## Cost-Only (no indicator)

Send usage telemetry with `agent_id`, `customer_id`, and `usage_data`, but leave the indicator empty. Paygent records provider cost in `cp_data` and does **not** create `billing_events`.

### Manual tracking (Python)

**`cost_only_manual.py`**

```python title="cost_only_manual.py"
from paygent_sdk import Client, UsageData
import os

paygent = Client(api_key=os.environ["PAYGENT_API_KEY"])

usage_data = UsageData(
    service_provider="OpenAI",
    model="gpt-4o",
    prompt_tokens=1200,
    completion_tokens=400,
    total_tokens=1600,
)

# No indicator → cost tracking only (no billing_events)
paygent.send_usage(
    agent_id="internal-qa-agent",
    customer_id="acme-corp",
    usage_data=usage_data,
)

# Equivalent 3-arg style (indicator position holds usage_data):
# paygent.send_usage("internal-qa-agent", "acme-corp", usage_data)
```

### Automatic tracking (Python)

With `paygent_sdk.init()`, omit `paygent_indicator` on the LLM call. Usage is still captured; revenue billing is skipped.

**`cost_only_automatic.py`**

```python title="cost_only_automatic.py"
import paygent_sdk
from openai import OpenAI

paygent_sdk.init(api_key=os.environ["PAYGENT_API_KEY"])
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Summarize this document"}],
    paygent_agent_id="doc-summarizer",
    paygent_customer_id="acme-corp",
    # paygent_indicator omitted → cost-only
)
```

> **Tip**
>
> **When to use cost-only:**
>
> * Internal agents where you want margin visibility but no customer billing
> * Shadow / evaluation traffic before you enable priced indicators
> * Cost observability for free-tier or pilot customers

---

## Revenue-Only (no usage payload)

Use `send_indicator()` when you want to bill from dashboard indicator pricing without sending tokens, model, or provider usage. Paygent creates `billing_events` directly and does **not** write a `cp_data` row.

**`revenue_only.py`**

```python title="revenue_only.py"
from paygent_sdk import Client
import os

paygent = Client(api_key=os.environ["PAYGENT_API_KEY"])

# Fire-and-forget: customer upsert + revenue event run on a background thread
paygent.send_indicator(
    agent_id="sales-agent",
    customer_id="acme-corp",
    indicator="meeting-booked",
    meta_tags={"source": "crm_webhook"}
    )
```

> **Warning**
>
> **Prerequisites:**
>
> * The agent must exist in Paygent and have pricing configured for the indicator
> * `agent_id`, `customer_id`, and `indicator` are all required
> * `send_indicator()` is available in the Python SDK today

> **Tip**
>
> **When to use revenue-only:**
>
> * Outcome billing from your app (webhooks, CRM events, human approvals)
> * Fixed-fee actions where provider token cost is irrelevant or tracked elsewhere
> * Voice-style indicator billing without attaching LLM usage to the same event

---

## Full tracking (cost + revenue)

This is the default path: send usage *with* an indicator. Paygent records provider cost and applies your indicator pricing for revenue.

**`full_tracking.py`**

```python title="full_tracking.py"
paygent.send_usage(
    agent_id="support-agent",
    customer_id="acme-corp",
    indicator="ticket-resolved",
    usage_data=usage_data,
)
```

---

## What you will see in the dashboard

Agent and customer analytics adapt to the data you send:

* **Cost-only** — cost breakdowns and usage; no revenue, profit, or margin cards
* **Revenue-only** — revenue breakdowns and indicator totals; no cost or margin cards
* **Both** — full profitability view (cost, revenue, net profit, margin)

> **Success**
>
> **Mixed environments.** An organization can run all three modes at once — for example, internal agents on cost-only, customer-facing agents on full tracking, and CRM webhooks on revenue-only. The UI shows the relevant metrics per agent or customer based on what was actually recorded.