> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meshai.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cost Intelligence

> Query token spend by agent, team, and model

## get\_cost\_summary()

Get an aggregate cost summary for your tenant over a time period.

```python theme={null}
summary = client.get_cost_summary(
    start="2026-03-01",
    end="2026-03-17",
)
```

<ParamField path="start" type="string">
  Start date (ISO 8601). Defaults to start of current month.
</ParamField>

<ParamField path="end" type="string">
  End date (ISO 8601). Defaults to today.
</ParamField>

**Returns**:

```json theme={null}
{
  "total_cost_usd": 1245.67,
  "total_input_tokens": 15234000,
  "total_output_tokens": 4567000,
  "total_requests": 8923,
  "start": "2026-03-01T00:00:00Z",
  "end": "2026-03-17T23:59:59Z"
}
```

## get\_cost\_by\_agent()

Break down costs by individual agent.

```python theme={null}
by_agent = client.get_cost_by_agent(
    start="2026-03-01",
    end="2026-03-17",
)
```

<ParamField path="start" type="string">
  Start date (ISO 8601)
</ParamField>

<ParamField path="end" type="string">
  End date (ISO 8601)
</ParamField>

**Returns**:

```json theme={null}
[
  {
    "agent_id": "agt_abc123",
    "agent_name": "production-summarizer",
    "team": "support-team",
    "total_cost_usd": 456.78,
    "input_tokens": 5600000,
    "output_tokens": 1200000,
    "requests": 3400
  },
  {
    "agent_id": "agt_def456",
    "agent_name": "lead-qualifier",
    "team": "sales-team",
    "total_cost_usd": 312.45,
    "input_tokens": 4100000,
    "output_tokens": 980000,
    "requests": 2100
  }
]
```

## get\_cost\_by\_model()

Break down costs by model.

```python theme={null}
by_model = client.get_cost_by_model(
    start="2026-03-01",
    end="2026-03-17",
)
```

<ParamField path="start" type="string">
  Start date (ISO 8601)
</ParamField>

<ParamField path="end" type="string">
  End date (ISO 8601)
</ParamField>

**Returns**:

```json theme={null}
[
  {
    "model_provider": "openai",
    "model_name": "gpt-4o",
    "total_cost_usd": 890.12,
    "input_tokens": 10200000,
    "output_tokens": 3100000,
    "requests": 5800
  },
  {
    "model_provider": "anthropic",
    "model_name": "claude-sonnet-4-20250514",
    "total_cost_usd": 355.55,
    "input_tokens": 5034000,
    "output_tokens": 1467000,
    "requests": 3123
  }
]
```
