# lg_activity: Usage by model, key, app or day

Measure usage over a window by model, key, provider or day: requests, errors, tokens, list cost and what was charged.

- **Changes data:** no (read only)
- **Credential scope:** `gateway:read` (an API key's scopes, or what you allowed when connecting with OAuth)
- **Assistant level:** any connected assistant (Read only and up)

## Inputs

| Field | Type | Required | Notes |
|---|---|---|---|
| `query` | object (model, key_id, status, from, to, group_by) | no |  |
| `query.model` | string | no |  |
| `query.key_id` | string | no |  |
| `query.status` | "ok" \\| "error" \\| "aborted" | no |  |
| `query.from` | string or string | no |  |
| `query.to` | string or string | no |  |
| `query.group_by` | "model" \\| "key" \\| "provider" \\| "day" | no |  |

## Example MCP call

A `tools/call` request to `https://manage.restolayer.com/mcp`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lg_activity",
    "arguments": {
      "query": {
        "group_by": "model"
      }
    }
  }
}
```

## Example REST call

The same thing over REST (`GET /v1/activity`):

```bash
curl -s -X GET "https://manage.restolayer.com/v1/activity?group_by=model" \
  -H "Authorization: Bearer $LG_API_KEY"
```

All tools: [MCP tools](https://www.restolayer.com/docs/mcp/tools). Connecting: [connect your assistant](https://www.restolayer.com/docs/connect).
