feat(claude_code): support Claude Console organizations via usage_report/claude_code endpoint#8978
Open
salim8898 wants to merge 1 commit into
Open
feat(claude_code): support Claude Console organizations via usage_report/claude_code endpoint#8978salim8898 wants to merge 1 commit into
salim8898 wants to merge 1 commit into
Conversation
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.
Support Claude Console organizations in the Claude Code plugin.
Claude Console (
platform.claude.com) Admin API keys (sk-ant-admin01-...) use a different analytics endpoint than Claude Enterprise (claude.ai) keys. Previously, the plugin only called the Enterprise endpoints (/v1/organizations/analytics/users,/v1/organizations/analytics/summaries,/v1/organizations/analytics/connectors), which requireread:analyticsscope. Console Admin keys have full access but to a different endpoint:/v1/organizations/usage_report/claude_code.This PR detects the key type from its prefix at runtime:
sk-ant-admin01-...(Console) → callsv1/organizations/usage_report/claude_codewithstarting_atquery param, parses the Console response schemask-ant-api01-...(Enterprise) → existing behavior unchangedFor Console orgs,
CollectActivitySummaryandCollectConnectorUsageare skipped gracefully since those endpoints have no Console equivalent. All Claude Code core metrics (sessions, commits, PRs, lines of code, tool actions) are available in the Console API and mapped to the existingClaudeCodeUserActivitymodel. Chat metrics are 0 for Console users.Does this close any open issues: #8977
Other Information:
Anthropic documentation references: