openclaw - 💡(How to fix) Fix Feature request: Add OAuth usage quota endpoint to session_status or new tool [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59773Fetched 2026-04-08 02:40:43
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

OpenClaw agents running on Anthropic OAuth (e.g., Claude Max subscription) currently have no way to programmatically check their usage quota. The agent has to ask the user for screenshots of the usage UI.

Root Cause

OpenClaw agents running on Anthropic OAuth (e.g., Claude Max subscription) currently have no way to programmatically check their usage quota. The agent has to ask the user for screenshots of the usage UI.

Code Example

{
  "five_hour": { "utilization": 54.0, "resets_at": "2026-04-02T17:00:00Z" },
  "seven_day": { "utilization": 53.0, "resets_at": "2026-04-03T03:00:00Z" }
}
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw agents running on Anthropic OAuth (e.g., Claude Max subscription) currently have no way to programmatically check their usage quota. The agent has to ask the user for screenshots of the usage UI.

The Endpoint Exists

Anthropic exposes GET https://api.anthropic.com/api/oauth/usage with the OAuth Bearer token and anthropic-beta: oauth-2025-04-20 header. Response:

{
  "five_hour": { "utilization": 54.0, "resets_at": "2026-04-02T17:00:00Z" },
  "seven_day": { "utilization": 53.0, "resets_at": "2026-04-03T03:00:00Z" }
}

Request

Add this to OpenClaw, either:

  1. Extend session_status to include OAuth usage when available
  2. Add a new usage or quota tool

The agent should NOT have direct access to the Bearer token (security). OpenClaw should call the endpoint internally and return the utilization data.

Use Case

Agents doing batch work (like Zettelkasten synthesis) need to pace themselves against the 4-hour and 7-day quotas. Currently requires manual screenshot requests to the user.

References

extent analysis

TL;DR

Implement a secure internal call to the Anthropic OAuth usage endpoint within OpenClaw to fetch and return utilization data without exposing the Bearer token.

Guidance

  • Extend the session_status endpoint to include OAuth usage data when available, ensuring the Bearer token is handled securely within OpenClaw.
  • Consider adding a new usage or quota tool as an alternative, with the same security considerations for token handling.
  • Verify the implementation by checking the response from the GET https://api.anthropic.com/api/oauth/usage endpoint and ensuring the utilization data is correctly returned to the agent without exposing the Bearer token.
  • Ensure the solution adheres to security principles by not granting the agent direct access to the OAuth Bearer token.

Example

import requests

def get_usage_data(bearer_token):
    headers = {
        'Authorization': f'Bearer {bearer_token}',
        'anthropic-beta': 'oauth-2025-04-20'
    }
    response = requests.get('https://api.anthropic.com/api/oauth/usage', headers=headers)
    return response.json()

# Example usage within OpenClaw, assuming secure token storage and handling
usage_data = get_usage_data(securely_stored_bearer_token)
print(usage_data)

Notes

The solution must ensure the security of the OAuth Bearer token, handling it internally within OpenClaw without exposing it to the agent. The choice between extending session_status and adding a new tool should consider the existing architecture and future scalability needs.

Recommendation

Apply a workaround by extending the session_status endpoint to include OAuth usage data, as this seems to be the most straightforward approach to provide agents with the necessary quota information without compromising security.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature request: Add OAuth usage quota endpoint to session_status or new tool [1 participants]