# Attribution

> Every model call is attributed to a person, a team, a product and, for coding agents, a session.

Every model call through Nexus carries who made it and what it was for, so spend can be read by person, team, model
or product.

| Recorded | From |
| --- | --- |
| Person | The token that made the call, or the person who started the product run |
| Team | The team named on the call, else the person's default team, else none ("Unassigned") |
| Product and capability | The product that made the call (for example `robustness › review`), `chat` for chats, `agents › claude` or `agents › codex` for coding agents, or `core` for direct API calls. A cloud machine's running time is `cloud › compute` |
| Session | For `nexus claude` and `nexus codex`, the session the call belongs to |

## Choosing the team

The team is, in order:

1. the one the caller names: the `x-nexus-team` header, or a `team` field in the request. The caller must be in that
   team (else `403` `not_in_team`); an unknown team is `404`.
2. else the caller's default team;
3. else none, shown as "Unassigned".

From the CLI, `--team <slug>` or `NEXUS_TEAM` names the team for product runs and coding-agent sessions:

```sh
NEXUS_TEAM=platform nexus claude
```

Each spend record keeps the team's id and its slug at the time, so a renamed or deleted team's history still reads.

## Reading it back

```sh
nexus spend                                  # budget and spend by product and capability
nexus analytics --by team --days 7           # usage by team, person, model, product or day
nexus analytics --by team --depth 1          # each top-level team with everything under it
nexus analytics --by team --under engineering
```

By team, spend rolls up the tree: each group counts its own spend and that of every team under it, and spend on a
parent team itself appears as its own "(direct)" row. The API is
[`GET /v1/analytics/usage`](/docs/api/analytics#usage).

Owners and admins see the whole organization. Everyone else sees their own calls and those of the teams they are in
and every team under those; grouped by person, other people in those teams appear as one "Others in your teams" row.
