Branch #16 docs/api/16-llm-activity.md

18. LLM Activity Rollup

Branch #16 — Meter usage theo ngày và breakdown theo loại tác vụ.

Endpoints

GET
https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=30d

Rollup hoạt động theo ngày

Auth: Bearer

GET
https://bizgpt.vn/wp-json/bizcity/v1/master/usage-stats

Alias legacy usage stats

Auth: Bearer

GET
https://bizgpt.vn/wp-json/bizcity/v1/master/activity/health

Health endpoint

Auth: Public

Method Path Auth Mô tả
GET https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=30d Bearer Rollup hoạt động theo ngày
GET https://bizgpt.vn/wp-json/bizcity/v1/master/usage-stats Bearer Alias legacy usage stats
GET https://bizgpt.vn/wp-json/bizcity/v1/master/activity/health Public Health endpoint

Query Examples

GET Rollup hoạt động theo ngày
curl -X GET "https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=30d" -H "Authorization: Bearer biz-YOUR_KEY"
const res = await fetch('https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=30d', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer biz-YOUR_KEY',
  },
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=30d"
headers = {'Authorization': 'Bearer biz-YOUR_KEY'}
res = requests.get(url, headers=headers)
print(res.json())
GET Alias legacy usage stats
curl -X GET "https://bizgpt.vn/wp-json/bizcity/v1/master/usage-stats" -H "Authorization: Bearer biz-YOUR_KEY"
const res = await fetch('https://bizgpt.vn/wp-json/bizcity/v1/master/usage-stats', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer biz-YOUR_KEY',
  },
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/bizcity/v1/master/usage-stats"
headers = {'Authorization': 'Bearer biz-YOUR_KEY'}
res = requests.get(url, headers=headers)
print(res.json())
GET Health endpoint
curl -X GET "https://bizgpt.vn/wp-json/bizcity/v1/master/activity/health"
const res = await fetch('https://bizgpt.vn/wp-json/bizcity/v1/master/activity/health', {
  method: 'GET',
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/bizcity/v1/master/activity/health"
headers = {}
res = requests.get(url, headers=headers)
print(res.json())

Use Cases

  • Theo dõi request cap theo user/team theo kỳ.
  • Phân tích cost theo loại branch (chat/video/astro/search).
  • Làm cơ sở cảnh báo và tối ưu chi phí vận hành.

Implementation Steps

  1. Gọi activity theo period (7d/30d/custom).
  2. Vẽ dashboard theo by_day, by_type, by_model.
  3. So sánh usage với entitlement để điều chỉnh workflow.

Quick Start cURL

bash
curl -X GET "https://bizgpt.vn/wp-json/bizcity/v1/master/activity?period=7d" -H "Authorization: Bearer biz-YOUR_KEY"
Canonical Spec

docs/api/16-llm-activity.md