[Feature Request] Add API endpoint for retrieving weekly token usage statistics

Resolved 💬 3 comments Opened Oct 17, 2025 by tyleradams Closed Jan 10, 2026

Bug Description
I need a way to programatically get claude's weekly usage so I can track it outside the website

Environment Info

  • Platform: linux
  • Terminal: tmux
  • Version: 2.0.20
  • Feedback ID: 84cc100f-1e2d-4183-ae46-5022bcd64261

Errors

[{"error":"SyntaxError: Unexpected token '`', \"```json\n{\n\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:62:719\n    at Q (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:15093)\n    at Bn2 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1056:20444)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-10-16T22:49:11.008Z"},{"error":"SyntaxError: Unexpected token '`', \"```json\n{\n\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:62:719\n    at Q (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:15093)\n    at Bn2 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1056:20444)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-10-16T23:02:13.803Z"},{"error":"SyntaxError: Unexpected token '`', \"```json\n{\n\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:62:719\n    at Q (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:15093)\n    at Bn2 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1056:20444)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-10-16T23:03:07.430Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:190\n    at Object.useMemo (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:25927)\n    at RmQ.useMemo (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:11:7725)\n    at Bw (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:81)\n    at m$ (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:19414)\n    at ls (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:42814)\n    at y9 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38355)\n    at Kd (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38283)\n    at t$ (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38137)\n    at bC (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:35216)","timestamp":"2025-10-16T23:07:39.140Z"},{"error":"SyntaxError: Unexpected token '`', \"```json\n{\n\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:62:719\n    at Q (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:15093)\n    at Bn2 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1056:20444)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-10-16T23:12:42.278Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:190\n    at Object.useMemo (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:25927)\n    at RmQ.useMemo (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:11:7725)\n    at Bw (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:81)\n    at m$ (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:19414)\n    at ls (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:42814)\n    at y9 (file:///home/cowboy/.nvm/versions/node/v21.0.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38355)\n    at Kd (file:///ho

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗