# Get usage summary

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Summarize the current user’s calls, tokens, costs, and success rate.

```text
GET https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/summary
```

## Before you begin

Prepare a personal access token. For creation and management, see [Manage personal access tokens](../../../../../guides/billing/credentials.md#personal-access-token).

Results are scoped to data accessible to the current user.

## Query parameters

Replace `$MOI_PERSONAL_ACCESS_TOKEN` in the example with your personal access token.

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/summary" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
```

:::::
:::::{tab-item} Parameters

::::{div} mo-api-parameter-table

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `start_time` | integer | No | Start time in nonnegative Unix seconds; must not exceed `end_time`. |
| `end_time` | integer | No | End time in nonnegative Unix seconds. |
| `model_id` | string | No | Catalog model object ID. |
| `model_type` | string | No | Model type. |
| `requested_model` | string | No | Model name submitted in the inference request. |
| `status` | string | No | Call status, such as `success` or `failed`. |
| `error_type` | string | No | Call error category. |
| `caller_ip` | string | No | Caller IP address. |
| `token_key_id` | string | No | TaaS local token key ID. |
| `token_key_ids` | string | No | TaaS local key IDs; repeat the parameter or comma-separate values. |
| `credential_type` | string | Required with `credential_id` | Credential type: `taas_token_key`, `personal_access_token`, or `service_account_api_key`; requires `credential_id`. |
| `credential_id` | string | Required with `credential_type` | Credential object ID; requires `credential_type`. |
| `billing_event_id` | string | No | Billing usage-event ID. |
| `billing_record_id` | string | No | Billing record ID. |
| `pricing_mode` | string | No | Pricing mode. |
| `settlement_method` | string | No | Settlement method: genesis or `ai_service`. |
| `enterprise_plan_id` | string | No | Enterprise plan ID. |
| `enterprise_contract_no` | string | No | Enterprise contract number. |
| `enterprise_plan_model_id` | string | No | Enterprise plan model ID. |
| `response_id` | string | No | Responses response ID. |
| `conversation_id` | string | No | Conversation ID. |
| `ids` | string | No | Usage log IDs; repeat the parameter or comma-separate values. |
| `usage_ids` | string | No | Alias for ids; values are combined. |
| `provider_id` | string | No | Provider ID; results remain scoped to the current user. |

::::

:::::
::::::
:::::::

## Successful response

Returns HTTP `200` with call counts, token usage, and cost totals matching the filters.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "total_calls": 2,
  "total_input_tokens": 12,
  "total_output_tokens": 8,
  "cache_read_tokens": 0,
  "cache_creation_tokens": 0,
  "total_cost": "0.0001",
  "total_channel_cost": "0.00005",
  "total_channel_tokens": 20,
  "success_calls": 2,
  "failed_calls": 0,
  "success_rate": 1,
  "active_users": 1
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `total_calls` | integer | Total call count. |
| `total_input_tokens` | integer | Total input tokens. |
| `total_output_tokens` | integer | Total output tokens. |
| `cache_read_tokens` | integer | Total cache-read tokens. |
| `cache_creation_tokens` | integer | Total cache-creation tokens. |
| `total_cost` | string | Total call cost as a decimal string. |
| `total_channel_cost` | string | Total cost of associated upstream requests. |
| `total_channel_tokens` | integer | Input, output, and cache tokens across associated upstream requests. |
| `success_calls` | integer | Successful call count. |
| `failed_calls` | integer | Non-successful call count. |
| `success_rate` | number | Successful calls divided by total calls; 0 when there are no calls. |
| `active_users` | integer | Number of users with matching calls. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 400,
  "message": "credential_type and credential_id must be provided together"
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | HTTP error status. |
| `message` | string | Error description. |

:::::
::::::
:::::::
