← Back to Kontasks
Claude Account Usage API - Available via OAuth
Research on getting Claude account usage limits programmatically
Output
✅ Yes - OAuth Usage API Available!
Live Test Result (Current Account)
{
"five_hour": { "utilization": 20%, "resets_at": "05:00 UTC" },
"seven_day": { "utilization": 2%, "resets_at": "Jan 15" },
"seven_day_sonnet": { "utilization": 0% },
"extra_usage": { "is_enabled": false }
}
API Endpoint
GET https://api.anthropic.com/api/oauth/usage
Headers:
Authorization: Bearer {accessToken}
anthropic-beta: oauth-2025-04-20
User-Agent: claude-code/2.1.0
Token Location
OAuth credentials are stored locally:
~/.claude/.credentials.json
{
"claudeAiOauth": {
"accessToken": "...",
"refreshToken": "...",
"expiresAt": "...",
"subscriptionType": "pro|max"
}
}
Implementation Options
- Add to konui navbar - Show usage % next to account selector
- Add MCP tool -
konui_get_account_usage - Add to session briefing - Show usage at start of each session
- Create shell script -
claude-usagefor quick CLI check
⚠️ Multi-Account Consideration
The credentials file stores one account at a time. To show both accounts, we'd need to:
- Store multiple OAuth tokens (after each account login)
- Or switch accounts and query each one
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
usageapiresearch
Created
8 Jan 2026, 11:39 am
Updated
8 Jan 2026, 11:39 am
Timing
⏱️ 277.6s
0 tools
● TTFE 0%
● Thinking 100%
● Tools 0%
Created By
claude
Raw Data
{
"id": "5108ca7e-8c82-4ff0-94a2-5d61b6ce399a",
"type": "general",
"status": "completed",
"title": "Claude Account Usage API - Available via OAuth",
"description": "Research on getting Claude account usage limits programmatically",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;\">\n<h2 style=\"color:#22c55e;margin:0 0 16px 0;\">✅ Yes - OAuth Usage API Available!</h2>\n\n<div style=\"background:#16a34a20;border:1px solid #22c55e;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#22c55e;margin:0 0 8px 0;\">Live Test Result (Current Account)</h3>\n<pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;overflow-x:auto;color:#e5c07b;font-size:0.85rem;margin:0;\">\n{\n \"five_hour\": { \"utilization\": <span style=\"color:#22c55e;\">20%</span>, \"resets_at\": \"05:00 UTC\" },\n \"seven_day\": { \"utilization\": <span style=\"color:#22c55e;\">2%</span>, \"resets_at\": \"Jan 15\" },\n \"seven_day_sonnet\": { \"utilization\": <span style=\"color:#22c55e;\">0%</span> },\n \"extra_usage\": { \"is_enabled\": false }\n}\n</pre>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#3b82f6;margin:0 0 12px 0;\">API Endpoint</h3>\n<pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;overflow-x:auto;color:#98c379;font-size:0.85rem;margin:0;\">\nGET https://api.anthropic.com/api/oauth/usage\n\nHeaders:\n Authorization: Bearer {accessToken}\n anthropic-beta: oauth-2025-04-20\n User-Agent: claude-code/2.1.0\n</pre>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#f59e0b;margin:0 0 12px 0;\">Token Location</h3>\n<p style=\"color:#9ca3af;margin:0 0 8px 0;\">OAuth credentials are stored locally:</p>\n<code style=\"background:#1a1a1a;padding:8px 12px;border-radius:4px;display:block;color:#e5c07b;\">~/.claude/.credentials.json</code>\n<pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;margin-top:8px;color:#7f848e;font-size:0.8rem;\">\n{\n \"claudeAiOauth\": {\n \"accessToken\": \"...\",\n \"refreshToken\": \"...\",\n \"expiresAt\": \"...\",\n \"subscriptionType\": \"pro|max\"\n }\n}\n</pre>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#8b5cf6;margin:0 0 12px 0;\">Implementation Options</h3>\n<ol style=\"margin:0;padding-left:20px;color:#e0e0e0;line-height:1.8;\">\n<li><strong>Add to konui navbar</strong> - Show usage % next to account selector</li>\n<li><strong>Add MCP tool</strong> - <code style=\"background:#1a1a1a;padding:2px 6px;border-radius:3px;\">konui_get_account_usage</code></li>\n<li><strong>Add to session briefing</strong> - Show usage at start of each session</li>\n<li><strong>Create shell script</strong> - <code style=\"background:#1a1a1a;padding:2px 6px;border-radius:3px;\">claude-usage</code> for quick CLI check</li>\n</ol>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#06b6d4;margin:0 0 12px 0;\">⚠️ Multi-Account Consideration</h3>\n<p style=\"color:#9ca3af;margin:0;\">The credentials file stores <strong>one account at a time</strong>. To show both accounts, we'd need to:</p>\n<ul style=\"margin:8px 0 0 0;padding-left:20px;color:#e0e0e0;\">\n<li>Store multiple OAuth tokens (after each account login)</li>\n<li>Or switch accounts and query each one</li>\n</ul>\n</div>\n\n<div style=\"background:#1e3a5f;border:1px solid #3b82f6;padding:12px;border-radius:6px;\">\n<strong style=\"color:#3b82f6;\">Sources:</strong>\n<ul style=\"margin:4px 0 0 0;padding-left:20px;color:#9ca3af;font-size:0.85rem;\">\n<li><a href=\"https://codelynx.dev/posts/claude-code-usage-limits-statusline\" style=\"color:#60a5fa;\">Claude Code Usage Limits in Statusline</a></li>\n<li><a href=\"https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan\" style=\"color:#60a5fa;\">Claude Help Center - Pro/Max Plans</a></li>\n</ul>\n</div>\n</div>",
"requestedAt": "2026-01-08T01:35:00.000Z",
"requestId": "cc552a5b-83c5-413e-8c32-9ae1d2c84fa3",
"choices": [
{
"label": "Add to navbar",
"value": "Add account usage percentage to the konui navbar next to the account selector",
"primary": true
},
{
"label": "Create MCP tool",
"value": "Create a konui_get_account_usage MCP tool to query usage from Claude"
},
{
"label": "Shell script",
"value": "Create a simple claude-usage shell script to check usage from command line"
}
],
"turnTiming": {
"totalMs": 277634,
"ttfeMs": 93,
"thinkingMs": 277541,
"toolExecutionMs": 0,
"toolCallCount": 0,
"thinkingPct": 100,
"toolsPct": 0,
"ttfePct": 0
}
},
"createdBy": "claude",
"createdAt": "2026-01-08T01:39:38.428Z",
"updatedAt": "2026-01-08T01:39:43.179Z",
"requestId": "cc552a5b-83c5-413e-8c32-9ae1d2c84fa3",
"scope": "vibetools",
"tags": [
"usage",
"api",
"research"
],
"targetUser": "claude"
}