salim8898 opened a new pull request, #8978: URL: https://github.com/apache/devlake/pull/8978
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 require `read:analytics` scope. 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) → calls `v1/organizations/usage_report/claude_code` with `starting_at` query param, parses the Console response schema - `sk-ant-api01-...` (Enterprise) → existing behavior unchanged For Console orgs, `CollectActivitySummary` and `CollectConnectorUsage` are 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 existing `ClaudeCodeUserActivity` model. Chat metrics are 0 for Console users. Does this close any open issues: https://github.com/apache/devlake/issues/8977 Other Information: Anthropic documentation references: - Console API: https://docs.anthropic.com/en/api/claude-code-analytics-api - Admin API key types: https://docs.anthropic.com/en/docs/manage-claude/admin-api-keys -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
