Other APIs / open-api-llm-bill.md

Model (LLM) query API## Overview

Model query API query first Model () data, provide endpoint:

-localized example text:localized example text「/ hours / Model /」and ( supported ).
- localized example text:localized example text「API Key / Model / localized example text」and ( return, data).

endpoint data and「localized example text」localized example text.

endpoint-endpoint: `GET /api/v2/open/llm/bill/details - endpoint: GET /api/v2/open/llm/bill/summary` - Authentication: Bearer Token (API Key)

Request Parameters### Headers

Parameterlocalized example textTypeRequiredDescription
AuthorizationstringYesBearer {API_KEY}

Query Parameters (endpoint)| Parameterlocalized example text| Type | Required | Description | |--------|------|------|------| | from | string | No | when.supported seconds when orYYYY-MM-DD (when, 00:00:00 ).as 30| | to | string | No | when.Formatlocalized example textfrom (23:59:59 ).as first when|

when range:from andto up to31 localized example text, will return ParameterError.query.

1. endpoint ()`GET /api/v2/open/llm/bill/details`

Query Parameters| Parameterlocalized example text| Type | Required | Description | |--------|------|------|------| | page | int | No |, 1, default 1| | pageSize | int | No |, default 50, maximum 100|

Successlocalized example text```json { "code": 0, "msg": "success", "data": { "list": [ { "apiKeyName": "my-key", "apiKeySecret": "sk-xxxx", "modelName": "claude-sonnet-4-6", "packageUuid": "pkg-xxxx", "date": "2026-08-20", "hour": "14", "usageType": "inputs", "usageDetailType": "claude-sonnet-4-6[inputs]", "statValue": 12000, "unitPrice": 0.003, "priceScale": 1000, "totalPrice": 0.036, "discountValue": 1, "currencyScale": 1 } ], "total": 128, "page": 1, "pageSize": 50 } }


### fieldDescription| fieldlocalized example text| Type | Description |
|--------|------|------|
| list | array | first list|
| total | int | when range|
| page | int | first|
| pageSize | int | first|

`list` field:| fieldlocalized example text| Type | Description |
|--------|------|------|
| apiKeyName | string | API Key localized example text|
| apiKeySecret | string | API Key |
| modelName | string | Model name |
| packageUuid | string | localized example text|
| date | string | (`YYYY-MM-DD`) |
| hour | string | hours (`00`~`23`) |
| usageType | string | ( inputs / outputs / thinkings / cache_reads / cache_writes / multi_modal_images / reqCnt / total_amount) |
| usageDetailType | string | localized example text|
| statValue | number | localized example text|
| unitPrice | number | ()|
| priceScale | int | localized example text|
| totalPrice | number | localized example text= statValue × unitPrice ÷ priceScale |
| discountValue | number | localized example text|
| currencyScale | number | localized example text|

---

## 2. endpoint ()`GET /api/v2/open/llm/bill/summary`

### Successlocalized example text```json
{
 "code": 0,
 "msg": "success",
 "data": {
 "list": [
 {
 "apiKeyName": "my-key",
 "apiKeySecret": "sk-xxxx",
 "modelName": "claude-sonnet-4-6",
 "packageUuid": "pkg-xxxx",
 "reqCnt": 320,
 "inputs": 1200000,
 "thinkings": 45000,
 "outputs": 380000,
 "multiModalImages": 12,
 "cacheReads": 90000,
 "cacheWrites": 30000,
 "totalAmount": 12.85
 }
 ]
 }
}

fieldDescriptionlist field:| fieldlocalized example text| Type | Description | |--------|------|------| | apiKeyName | string | API Key localized example text| | apiKeySecret | string | API Key | | modelName | string | Model name | | packageUuid | string | localized example text| | reqCnt | int | Requestlocalized example text| | inputs | int | input token| | thinkings | int | token| | outputs | int | output token| | multiModalImages | int | image| | cacheReads | int | token| | cacheWrites | int | token| | totalAmount | number | localized example text|


Errorlocalized example text```json { "code": 10002, "msg": "when range:up to supported 31, from/to", "data": null }


```json

{
"code": 10005,
"msg": "not",
"data": null
}


```json

{
"code": 90003,
"msg": "Failure",
"data": null
}


## Request Example

### cURL

```bash

curl -X GET"https://mm-internal-cn.leonecloud.com/api/v2/open/llm/bill/summary?from=2026-08-01&to=2026-08-20" \ -H "Authorization: Bearer your_api_key_here"

() curl -X GET"https://mm-internal-cn.leonecloud.com/api/v2/open/llm/bill/details?from=2026-08-01&to=2026-08-20&page=1&pageSize=50" \ -H "Authorization: Bearer your_api_key_here"


### Python

```python

import requests

base = "https://mm-internal-cn.leonecloud.com/api/v2/open"
headers = {"Authorization": "Bearer your_api_key_here"}

r= requests.get(f"{base}/llm/bill/summary", params={"from": "2026-08-01", "to": "2026-08-20"}, headers=headers) print(r.json())

() page= 1 while True: r = requests.get(f"{base}/llm/bill/details", params={"from": "2026-08-01", "to": "2026-08-20", "page": page, "pageSize": 100}, headers=headers) data = r.json()["data"] for row in data["list"]: print(row) if page * data["pageSize"] >= data["total"]: break page += 1


## Note1. API Key, only return Modeldata.
2. endpoint`page/pageSize`;`total` as when range, with.
3. when range as 31,.
4. endpoint return, data, no.
5. endpointonly in Model (LLM)Capability provide; not returned when applicableError.

## Error CodesDescription

| Error Codes | Description | localized example text|
|--------|------|----------|
| 10002 | ParameterError (when range /`to` localized example text`from`) | localized example text`from`/`to`, exceeds 31|
| 10005 | not| API Key|
| 90003 | Failure / can use| after or Technical Support|
Updated 2026-09-02