Skip to content

Lịch sử usage — nền tảng Gommo (preview) ​

Sắp có trên nền tảng Gommo

Tính năng chưa có trên Gommo public API. Tài liệu và portal trên site này là xem trước qua dev proxy. Khi Gommo ship chính thức, endpoint và SDK sẽ nằm trên Gommo — không phụ thuộc repo self-host.

→ Roadmap nền tảng Gommo

Portal Activity hub (và preview usage trên Profile) đọc POST /api/v2/usage-history qua gateway — cùng nguồn Gommo upstream.

Endpoints ​

MethodPathAuth
POST/gateway/usage/statsAuthorization: Bearer
GET/gateway/usage/statsBearer (query)
POST/gateway/usage/logsBearer
GET/gateway/usage/logsBearer (query)
POST/gateway/usage/aggregateBearer
GET/gateway/usage/aggregateBearer (query)

Upstream: action=stats hoặc action=logs trên https://api.gommo.net/api/v2/usage-history.

POST stats ​

Gửi device trong form body (device_id, device_name, device_info). Trang docs tự điền.

bash
curl.exe -X POST "http://localhost:3001/gateway/usage/stats" ^
  -H "Authorization: Bearer USER_TOKEN" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "domain=%REGISTRATION_DOMAIN%&period=30d&type=all&language=vi&device_id=UUID&device_name=Chrome%%201&device_info={...}"
FieldGiá trị
period7d, 30d, 90d
typeall, image, video, audio, music
languagevi (stats)

Response data.summary: total, credit_net, by_type, …

POST logs ​

bash
curl.exe -X POST "http://localhost:3001/gateway/usage/logs" ^
  -H "Authorization: Bearer USER_TOKEN" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "domain=%REGISTRATION_DOMAIN%&period=30d&type=all&language=VI&page=1&limit=30"

language=VI cho logs. Phân trang: page, limit, has_more.

POST aggregate (top models) ​

Gateway paginate action=logs và gom theo model (tối đa 50 trang × 100 dòng).

FieldGhi chú
groupBymodel (bắt buộc)
top1–20, mặc định 5
maxPages1–100, mặc định 50
refresh1 / true — bỏ qua cache bộ nhớ, quét lại logs

Response: scanned_jobs, truncated, items[] (model, count, credit, percent), from_cache tùy chọn khi gateway trả từ cache bộ nhớ (TTL mặc định 10 phút, USAGE_AGGREGATE_CACHE_TTL_MS).

Map UI ​

UINguồn
KPI Overview (Activity)action=stats → summary
Top models (Overview)POST /gateway/usage/aggregate
Biểu đồ / bảng ngày (Trends)action=stats → chart, table[]
Danh sách job (Explore)action=logs
Credit thựcsummary.credit_net
Credits khả dụng/vi/ai/me → balancesInfo.credits_ai

Xem Activity hub, OpenAPI và Authentication.