Repository navigation
tokenmeter CLI and Go client - #23
Merged
Merged
Conversation
usage summary, top, by-meta and export with totals in USD, fetching windows the server caps in parts; token new and hash for TOKENMETER_TOKENS; event send; health, now with the version in /healthz. Contexts keep the token in the environment, a 0600 file or the system keychain. pkg/client wraps the gRPC API. Released as archives with signed checksums, the coyl/tokenmeter-cli image and a Homebrew formula; an end-to-end job runs the CLI against a built service with and without ClickHouse.
Private files are written through a fresh temporary file; a context named on the command line beats the environment; keychain writes are read back, as security -i exits 0 on failure; capped windows are fetched with up to eight calls in flight; long durations are refused, not wrapped; exports to a file are renamed into place only when complete; TOKENMETER_TLS must be a boolean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes ai-process/docs#132 (epic ai-process/docs#137), except
tokenmeter mcp(#133).cmd/tokenmeter:usage summary|top|by-meta|export,token new|hash,event send,health,context set|use|list|delete|store-token,completion,version.--last 7dor--from/--to(RFC 3339 orYYYY-MM-DD, UTC). Atruncatedwindow is split in halves down to an hour and merged, so totals are complete.-o json(protojson fields),-o csvwith exact dollars (cost_nanousd / 1e9without float rounding).--token-file,TOKENMETER_TOKENor the context (env, 0600 file, macOS Keychain /secret-tool); never from a flag value.ktms: 2 usage, 4 auth, 5 not found, 6 rejected, 7 retry.pkg/client:New,Record(batches of 500),Summary(window splitting),ByMeta,Merge,ParseDuration./healthzreportsversion..goreleaser.yamlputs CLI archives, SBOMs and a cosign-signedchecksums.txton the draft release (binariesjob, beforepublish);coyl/tokenmeter-cliimage in the docker matrix; Homebrew formula skipped untilHOMEBREW_TAP_TOKENexists. SECURITY.md covers verifying the archives.scripts/cli-e2e.sh(CI jobcli-e2e) against a built image on Postgres alone and with ClickHouse, checking USD againstcost_nanousd.pkg/clientand CLI marked Experimental until 1.2.