---
title: "My Usage"
method: GET
path: "/myapi/usage"
---

# My Usage

`GET /myapi/usage`

## Request

- Base URL: `https://api.twtapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.twtapi.com/myapi/usage`
- Auth: none declared

Return usage trends without mixing credits, calls, and rate limits.

中文：按时间窗口返回用量趋势（/usage），供前端的图表页使用。

参数:
    period: 统计窗口，24h / 7d / 30d / current（当前配额周期），
            由 Query 的 pattern 约束；未知值不会走到这里。

返回:
    period/period_start/period_end、总量与成功率、消耗额度、平均耗时、
    按天与按接口的两组明细，以及 limits 子对象（余额、配额、限速、有效期）。

为什么要把 credits / calls / rate limits 分开放在不同区块：三者的语义和
量纲完全不同（额度是货币化的，调用次数是计数，限速是速率），混在一个
指标里会让前端无法正确表达，也容易让用户误以为「调用次数 = 余额」。

副作用:
    只读数据库；共 3 条聚合查询（汇总、按天、按接口）。

## Query parameters

- `period` string

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/twtapi/apis/twtapi-backend.md) · [All operations](https://skmtc.dev/twtapi/apis/twtapi-backend/llms.txt) · [OpenAPI document](https://skmtc.dev/twtapi/apis/twtapi-backend/revisions/5295976febaf?raw)
