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

# User Logs & Usage Statistics

> Query usage logs, dashboard insights and billing information via the /api/log/self and /api/log/self/stat endpoints.

## Introduction

The MixRoute Console provides two endpoints to query usage and billing information for your account, covering the following needs:

* View Usage Logs
* View Dashboard insights (Model Analytics, Request Count, Token Statistics, etc.)
* View billing information (which models an API Key used, the corresponding input/output tokens, and each model's usage share)
* Understand actual consumption by model

## Authentication

All requests must include two headers:

| Header | Description |
| - | - |
| `Authorization` | `Bearer <you-api-key>`, your system access API key |
| `New-Api-User` | `<you-user-id>`, your account user ID |

## Get User Logs GET `/api/log/self`

Returns the usage logs for your account, sorted newest first. Pagination parameters control the output.

### Request Parameters

<ParamField query="p" type="integer">
  Page number, starting from 1.
</ParamField>

<ParamField query="page_size" type="integer">
  Number of log entries per page.
</ParamField>

For example, `/api/log/self?p=1&page_size=20` returns the first page with 20 log entries per page.

### Request Example

```bash cURL theme={null}
curl --request GET \
  --url 'https://console.mixroute.ai/api/log/self?p=1&page_size=20' \
  --header 'authorization: Bearer <you-api-key>' \
  --header 'new-api-user: <you-user-id>'
```

### Response Example

```json Response theme={null}
{
  "data": {
    "page": 1,
    "page_size": 20,
    "total": 2821,
    "items": [
      {
        "id": 1,
        "user_id": 81,
        "created_at": 1787215542,
        "type": 2,
        "content": "",
        "username": "<you-user-name>",
        "token_name": "<your-token-name>",
        "model_name": "deepseek-v4-flash-0731",
        "quota": 768,
        "prompt_tokens": 23144,
        "completion_tokens": 2948,
        "use_time": 38,
        "is_stream": true,
        "channel": 239,
        "channel_name": "",
        "token_id": 202,
        "group": "default",
        "ip": "",
        "request_id": "202608200845041208627278268d9d63W55TNWu",
        "other": "{\"billing_source\":\"wallet\",\"cache_ratio\":0.02,\"cache_tokens\":18432,\"completion_ratio\":2,\"frt\":1245,\"group_ratio\":1,\"model_price\":-1,\"model_ratio\":0.07,\"reasoning_effort\":\"max\",\"request_conversion\":[\"OpenAI Responses\"],\"request_path\":\"/v1/responses\",\"user_group_ratio\":-1}"
      }
    ]
  },
  "message": "",
  "success": true
}
```

### Log Field Reference

| Field | Type | Description |
| - | - | - |
| `data.page` | integer | Current page number |
| `data.page_size` | integer | Number of entries per page |
| `data.total` | integer | Total number of log entries |
| `data.items[]` | array | List of log entries |
| `data.items[].id` | integer | Log ID |
| `data.items[].user_id` | integer | User ID |
| `data.items[].created_at` | integer | Creation time (Unix timestamp in seconds) |
| `data.items[].type` | integer | Record type |
| `data.items[].content` | string | Notes or error message, usually empty |
| `data.items[].username` | string | Username |
| `data.items[].token_name` | string | API Key name used |
| `data.items[].model_name` | string | Model name |
| `data.items[].quota` | integer | Quota consumed for this request (**1 USD = 500,000 quota (5 × 10⁵)**) |
| `data.items[].prompt_tokens` | integer | Number of input tokens |
| `data.items[].completion_tokens` | integer | Number of output tokens |
| `data.items[].use_time` | integer | Request duration (seconds) |
| `data.items[].is_stream` | boolean | Whether the request was streamed |
| `data.items[].channel` | integer | Channel ID |
| `data.items[].channel_name` | string | Channel name, may be empty |
| `data.items[].token_id` | integer | API Key ID |
| `data.items[].group` | string | Group name |
| `data.items[].ip` | string | Request IP |
| `data.items[].request_id` | string | Request ID |
| `data.items[].other` | string | Billing metadata as a JSON string, see below |

`data.items[].other` is a JSON string that mainly contains the following billing and request information:

| Field | Description |
| - | - |
| `billing_source` | Billing source, e.g. `wallet` |
| `model_price` | Model unit price, `-1` when not specified |
| `model_ratio` | Model multiplier |
| `cache_ratio` | Cache multiplier |
| `cache_tokens` | Number of cached tokens |
| `completion_ratio` | Output multiplier |
| `group_ratio` | Group multiplier |
| `user_group_ratio` | User group multiplier |
| `reasoning_effort` | Reasoning effort setting |
| `request_conversion` | Request conversion method, e.g. `OpenAI Responses` |
| `request_path` | Actual request path, e.g. `/v1/responses` |
| `frt` | Time to first token (milliseconds) |

## Get Total Usage Statistics GET `/api/log/self/stat`

Returns the cumulative spending and rate-limit status for your account. This endpoint has no request parameters.

### Request Example

```bash cURL theme={null}
curl --request GET \
  --url 'https://console.mixroute.ai/api/log/self/stat' \
  --header 'authorization: Bearer <you-api-key>' \
  --header 'new-api-user: <you-user-id>'
```

### Response Example

```json Response theme={null}
{
  "data": {
    "quota": 32892251,
    "rpm": 0,
    "tpm": 0
  },
  "message": "",
  "success": true
}
```

### Field Reference

| Field | Type | Description |
| - | - | - |
| `data.quota` | integer | Cumulative quota consumed |
| `data.rpm` | integer | Requests-per-minute limit status |
| `data.tpm` | integer | Tokens-per-minute limit status |
| `message` | string | Error message, empty on success |
| `success` | boolean | Whether the request succeeded |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.