Skip to content

light-tokenmeter 1.0.0

Choose a tag to compare

@github-actions github-actions released this 23 Oct 17:38
· 10 commits to main since this release
9127bdf

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_tokens and cache_write_tokens on usage events (usage.v1 fields 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 of tokens_input.
    Stored in Postgres and ClickHouse; events from older callers carry 0.
  • Authentication: bearer tokens with write and read scopes, configured as SHA-256 hashes in
    TOKENMETER_TOKENS or TOKENMETER_TOKENS_FILE, several at once for rotation. Refusals are
    401/403 over HTTP and UNAUTHENTICATED/PERMISSION_DENIED over 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, and tokenmeter_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 breaking and a generated-code check on every pull request; govulncheck on
    every pull request and release.
  • Releases: vX.Y.Z tags, 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_class up to 256 characters (longer used to fail with a
    500), meta up to 16 KiB of keys and values with no empty keys, requests up to 16 MiB (413 request_too_large over HTTP), and occurred_at between 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 status unless 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.