Repository navigation
light-tokenmeter 1.0.0
The first stable release, together with Keystone. The Model Switchboard. (KTMS) 1.0 and
ktms-admin 1.0. From here on, what API stability lists changes
incompatibly only in a new major version. Upgrade from 0.1.x in one step.
Added
cache_read_tokensandcache_write_tokenson usage events (usage.v1fields 17 and 18) and
summed in summary and by-meta rows: the input tokens read from and written to the vendor's
prompt cache, which vendors bill apart from plain input. They are part oftokens_input.
Stored in Postgres and ClickHouse; events from older callers carry 0.- Authentication: bearer tokens with
writeandreadscopes, configured as SHA-256 hashes in
TOKENMETER_TOKENSorTOKENMETER_TOKENS_FILE, several at once for rotation. Refusals are
401/403over HTTP andUNAUTHENTICATED/PERMISSION_DENIEDover gRPC. Without tokens the
service runs open and warns at startup. gRPC health is registered; reflection needs a token. - Prometheus metrics on
METRICS_ADDR(:9091): events, requests and their duration, storage
errors, ClickHouse copying, outbox size and age, andtokenmeter_build_info. The README lists
them with suggested alerts. - README "API stability" and "Versions and upgrades": what 1.x keeps compatible, one-step and
rolling upgrades, no downgrades. - An upgrade test (
scripts/upgrade-test.sh) from the previous release and the oldest of the
same major, with Postgres and ClickHouse, on every pull request and before each release. buf lint,buf breakingand a generated-code check on every pull request;govulncheckon
every pull request and release.- Releases:
vX.Y.Ztags, a GitHub Release with this changelog's section, and multi-arch images
signed with cosign, with SBOM and provenance (see SECURITY.md).
Changed
- ClickHouse no longer loses events. Events reach it through a Postgres outbox written in the same
statement as the event, copied in leased batches under a deduplication token, so a full buffer,
a ClickHouse outage or a crash neither drops nor double-counts them. The service starts and
stays ready without ClickHouse, and reads fall back to Postgres when it fails. - The first start with an empty ClickHouse copies the last 90 days of Postgres history to it;
reports stay on Postgres until that is done. - Validation before the freeze:
error_classup to 256 characters (longer used to fail with a
500),metaup to 16 KiB of keys and values with no empty keys, requests up to 16 MiB (413 request_too_largeover HTTP), andoccurred_atbetween 1900 and 2262-04-10; the zero time means
unset. - HTTP batch errors name the bad event as
invalid event at index N, like gRPC. - Summary rows leave out
statusunless grouped by it, like the other grouping fields. - Relicensed under Apache 2.0.
Security
- The startup log no longer contains the Postgres password: it named the whole
DATABASE_URL. - clickhouse-go v2.49.0 with ch-go v0.74.0, fixing GO-2025-3603 in the ClickHouse protocol reader.
Image: coyl/light-tokenmeter:1.0.0 (linux/amd64, linux/arm64), signed with cosign; see Verifying a release.