cmind/metering/v1/usage_service.proto
Package: cmind.metering.v1
Messages
GetTokenUsageRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantIds | repeated string | 1 | Tenants to include in the aggregate. Empty means all tenants. |
start | google.protobuf.Timestamp | 2 | |
end | google.protobuf.Timestamp | 3 | |
step | string | 4 | step is the bucket width as a short code (e.g. "5m", "1h", "1d"). The server maps it from a closed set to a ClickHouse interval; unknown codes are rejected. |
TokenUsagePoint
TokenUsagePoint is one time bucket's token totals across the selected tenants.
| Field | Type | Number | Description |
|---|---|---|---|
bucket | google.protobuf.Timestamp | 1 | |
inputTokens | uint64 | 2 | |
outputTokens | uint64 | 3 | |
embeddingTokens | uint64 | 4 | |
rerankTokens | uint64 | 5 |
GetTokenUsageResponse
| Field | Type | Number | Description |
|---|---|---|---|
points | repeated TokenUsagePoint | 1 |
GetModelTokenUsageRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantIds | repeated string | 1 | Tenants to include in the aggregate. Empty means all tenants. |
start | google.protobuf.Timestamp | 2 | |
end | google.protobuf.Timestamp | 3 | |
limit | uint32 | 4 | Cap on the number of models returned (highest total first). 0 = no cap. |
ModelTokenUsage
ModelTokenUsage is one model's token totals over the range.
| Field | Type | Number | Description |
|---|---|---|---|
model | string | 1 | The metered model identifier (the usage target). |
inputTokens | uint64 | 2 | |
outputTokens | uint64 | 3 | |
embeddingTokens | uint64 | 4 | |
rerankTokens | uint64 | 5 |
GetModelTokenUsageResponse
| Field | Type | Number | Description |
|---|---|---|---|
models | repeated ModelTokenUsage | 1 |
GetRequestVolumeRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantIds | repeated string | 1 | Tenants to include in the aggregate. Empty means all tenants. |
start | google.protobuf.Timestamp | 2 | |
end | google.protobuf.Timestamp | 3 | |
step | string | 4 |
RequestVolumePoint
RequestVolumePoint is one time bucket's metered-request count.
| Field | Type | Number | Description |
|---|---|---|---|
bucket | google.protobuf.Timestamp | 1 | |
requests | uint64 | 2 |
GetRequestVolumeResponse
| Field | Type | Number | Description |
|---|---|---|---|
points | repeated RequestVolumePoint | 1 |
GetApiKeyTokenUsageRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantId | string | 1 | |
apiKeyId | string | 2 | |
start | google.protobuf.Timestamp | 3 | |
end | google.protobuf.Timestamp | 4 | |
step | string | 5 | step is the bucket width as a short code (e.g. "5m", "1h", "1d"). |
GetApiKeyTokenUsageResponse
| Field | Type | Number | Description |
|---|---|---|---|
points | repeated TokenUsagePoint | 1 |
ExportApiKeyTokenUsageRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantId | string | 1 | |
start | google.protobuf.Timestamp | 2 | |
end | google.protobuf.Timestamp | 3 |
ExportApiKeyTokenUsageResponse
| Field | Type | Number | Description |
|---|---|---|---|
filename | string | 1 | |
csv | bytes | 2 |
GetApiTrafficRequest
| Field | Type | Number | Description |
|---|---|---|---|
start | google.protobuf.Timestamp | 1 | |
end | google.protobuf.Timestamp | 2 | |
step | string | 3 | |
service | string | 4 | Restrict to one service (the access log's service name). Empty = all. |
ApiTrafficPoint
ApiTrafficPoint is one time bucket of access-log traffic: total requests, client/server error counts and latency percentiles (milliseconds).
| Field | Type | Number | Description |
|---|---|---|---|
bucket | google.protobuf.Timestamp | 1 | |
total | uint64 | 2 | |
clientErrors | uint64 | 3 | |
serverErrors | uint64 | 4 | |
p50Ms | double | 5 | |
p90Ms | double | 6 | |
p99Ms | double | 7 |
GetApiTrafficResponse
| Field | Type | Number | Description |
|---|---|---|---|
points | repeated ApiTrafficPoint | 1 | |
services | repeated string | 2 | Distinct service names seen in the window (unfiltered), for the picker. |
GetPerTenantTokenUsageRequest
| Field | Type | Number | Description |
|---|---|---|---|
tenantIds | repeated string | 1 | Tenants to include. Empty means all tenants. |
start | google.protobuf.Timestamp | 2 | |
end | google.protobuf.Timestamp | 3 |
TenantTokenUsage
TenantTokenUsage is one tenant's token totals over the range.
| Field | Type | Number | Description |
|---|---|---|---|
tenantId | string | 1 | |
inputTokens | uint64 | 2 | |
outputTokens | uint64 | 3 | |
embeddingTokens | uint64 | 4 | |
rerankTokens | uint64 | 5 |
GetPerTenantTokenUsageResponse
| Field | Type | Number | Description |
|---|---|---|---|
tenants | repeated TenantTokenUsage | 1 |
Services
UsageService
UsageService is the read side of the metered usage data. The write side is cmind.cluster.metering.v1.InternalUsageService (cluster-internal ingest); this service serves platform-admin analytics over what was ingested.
GetTokenUsage
GetTokenUsage returns token usage bucketed over a time range, summed across the selected tenants (all tenants when tenant_ids is empty). Platform operation.
Request: GetTokenUsageRequest
Response: GetTokenUsageResponse
GetModelTokenUsage
GetModelTokenUsage returns per-model token totals over a time range, summed across the selected tenants (all tenants when tenant_ids is empty) and ordered by total tokens descending. Platform operation.
Request: GetModelTokenUsageRequest
Response: GetModelTokenUsageResponse
GetRequestVolume
GetRequestVolume returns the count of metered inference requests bucketed over a time range (distinct trace ids in the usage data), summed across the selected tenants (all tenants when tenant_ids is empty). Platform operation.
Request: GetRequestVolumeRequest
Response: GetRequestVolumeResponse
GetApiKeyTokenUsage
GetApiKeyTokenUsage returns token usage bucketed over a time range for one API key. Authorization follows the key so its owner can inspect usage.
Request: GetApiKeyTokenUsageRequest
Response: GetApiKeyTokenUsageResponse
ExportApiKeyTokenUsage
ExportApiKeyTokenUsage returns a backend-generated CSV containing one aggregate row per API key for a tenant and time range.
Request: ExportApiKeyTokenUsageRequest
Response: ExportApiKeyTokenUsageResponse
GetApiTraffic
GetApiTraffic returns API request volume, error counts and latency percentiles bucketed over a time range, from the gateway/service access logs across the whole platform (no tenant dimension). Platform operation.
Request: GetApiTrafficRequest
Response: GetApiTrafficResponse
GetPerTenantTokenUsage
GetPerTenantTokenUsage returns per-tenant token totals over a time range (no bucketing — flat totals, one row per tenant). Tenants to include are selected by tenant_ids (empty means all tenants). Platform operation.
Request: GetPerTenantTokenUsageRequest
Response: GetPerTenantTokenUsageResponse