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

# Router Cost Aggregation API

> Retrieve cost aggregation data from the Aria Compute ROUTER, broken out by user, model, entrypoint, and time range.

The Cost endpoint returns aggregated inference cost metrics from the Aria Compute ROUTER. Use it to analyze spending patterns across users, models, and entrypoints over a selected time window.

Results can be grouped by dimensions you choose via query parameters. All authenticated callers may access this endpoint.

## Endpoint

```http theme={null}
GET /v1/router/cost
```

## Authentication

Authenticate with a session cookie or pass `Authorization: Bearer <api-key>`.

## Query Parameters

<ParamField query="from" type="string">
  Start of the time range in ISO 8601 format.
</ParamField>

<ParamField query="to" type="string">
  End of the time range in ISO 8601 format.
</ParamField>

<ParamField query="group_by" type="string">
  Comma-separated grouping dimensions. Supported values: `user`, `model`, `entrypoint`.
</ParamField>

## Response

<ResponseField name="items" type="array">
  Cost aggregation rows.

  <Expandable title="items">
    <ResponseField name="user" type="string">
      User identifier, present when grouped by user.
    </ResponseField>

    <ResponseField name="model" type="string">
      Model identifier, present when grouped by model.
    </ResponseField>

    <ResponseField name="entrypoint" type="string">
      Entrypoint identifier, present when grouped by entrypoint.
    </ResponseField>

    <ResponseField name="cost_usd" type="number">
      Aggregated cost in USD.
    </ResponseField>

    <ResponseField name="tokens" type="integer">
      Total tokens consumed in the grouping.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://router.example.com/v1/router/cost?from=2024-06-01T00:00:00Z&to=2024-06-30T23:59:59Z&group_by=user,model" \
    -H "Authorization: Bearer <api-key>"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "items": [
      {
        "user": "user_a",
        "model": "gpt-4o",
        "cost_usd": 12.45,
        "tokens": 41500
      },
      {
        "user": "user_a",
        "model": "claude-3-5-sonnet-20241022",
        "cost_usd": 8.20,
        "tokens": 27300
      }
    ]
  }
  ```
</ResponseExample>


## Related topics

- [List Replayable Router Requests API](/api-reference/router/replay/list.md)
- [Revoke ROUTER API Key API](/api-reference/router/keys/revoke.md)
- [List ROUTER API Keys API](/api-reference/router/keys/list.md)
- [Create ROUTER API Key API](/api-reference/router/keys/create.md)
- [Reroute Captured Router Request API](/api-reference/router/replay/reroute.md)
