Repository navigation
v0.1.0
First release of vgi-anthropic, a VGI worker that exposes the Anthropic Admin, Usage & Cost, and Claude Code Analytics APIs as a read-only SQL catalog. You can query your organization's members, workspaces, API keys, rate limits, token usage, spend and Claude Code activity from DuckDB/Haybarn.
What's in it
- Tables:
organization,users,invites,workspaces(archived included),workspace_members,api_keys,rate_limits,workspace_rate_limits. Each one is backed by a pagedall_<table>()scan. - Reports:
messages_usage(starting_at),cost_report(starting_at)andclaude_code_usage(starting_date). They stream one API page per tick, so aLIMITstops early. Withoutgroup_by, they group by the dimension columns your query references. - Lookups:
user_by_id,workspace_by_idandapi_key_by_id. They compose underLATERAL. - Exact money: cost comes back as
DECIMAL, in cents and in dollars. - Filter pushdown, plus retries with backoff on 429/529/5xx that honour
retry-afterandx-should-retry. - Credentials come from a redacted
anthropic_adminDuckDB secret: an Admin API key, an organization-scoped key, or anorg:adminOAuth token. There is no environment-variable fallback.
Composed examples
- Claude Code sessions, lines added and estimated cost over the last week, by organization role (
claude_code_usage+users) - Members with no Claude Code activity in the last 30 days (
users+claude_code_usage) - Today's peak output tokens per minute per model group, compared with that group's OTPM limit (
messages_usage+rate_limits) - Month-to-date spend, tokens and blended dollars per million tokens by model (
cost_report+messages_usage)
Install
ATTACH 'anthropic' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-anthropic@v0.1.0 vgi-anthropic');From a clone, run uv run anthropic_worker.py (stdio) or uv run serve.py --port 8000 (HTTP).
This release speaks VGI protocol 3.3 (vgi-python >= 0.51.1).
Known limits
- It only reads. Nothing writes to the Admin API.
- It needs an admin-capable credential. A workspace-scoped or non-admin key is refused with a 401, and the error message names the credentials that would work.
- CI tests run against a local fake of the Admin API. The live test workflow only runs when the repository has API key secrets configured.