You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standardize provider documentation to minimal format (#52)
Restructure Claude, Codex, and Cursor provider docs to follow a consistent template with Overview, Endpoints, and Authentication sections. Consolidate field documentation into jsonc comments. Remove code examples and redundant field tables to reduce noise while preserving all technical details.
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Claude Code uses Anthropic's OAuth-based API to fetch usage data. The usage endpoint returns rate limit windows and optional extra credits information as JSON.
3
+
> Reverse-engineered, undocumented API. May change without notice.
4
4
5
-
**Note:** This is a reverse-engineered, undocumented API. It may change without notice.
"refreshToken":"<token>",// used to obtain new access tokens
89
-
"expiresAt":1738300000000, // unix ms -- token expiration
90
-
"scopes": ["..."],// granted OAuth scopes
91
-
"subscriptionType":"pro",// plan tier
92
-
"rateLimitTier":"..."// rate limit tier
68
+
"refreshToken":"<token>",
69
+
"expiresAt":1738300000000, // unix ms
70
+
"scopes": ["..."],
71
+
"subscriptionType":"pro",
72
+
"rateLimitTier":"..."
93
73
}
94
74
}
95
75
```
96
76
97
-
**Fallback: macOS Keychain**
98
-
99
-
Service name: `Claude Code-credentials`
100
-
101
-
The keychain entry contains the same JSON structure as the credentials file.
77
+
**Fallback:** macOS Keychain, service name `Claude Code-credentials` (same JSON structure).
102
78
103
79
### Token Refresh
104
80
105
-
Access tokens are short-lived JWTs. The `expiresAt` field indicates when the token expires (unix milliseconds). If expired, the plugin will automatically refresh using the `refreshToken`.
106
-
107
-
**Refresh endpoint:**
81
+
Access tokens are short-lived JWTs. Refreshed proactively 5 minutes before expiration, or reactively on 401/403.
"refresh_token":"<new_refresh_token>",// may be same as previous
101
+
"expires_in":3600// seconds
132
102
}
133
103
```
134
-
135
-
| Field | Type | Description |
136
-
|---|---|---|
137
-
|`access_token`| string | New OAuth access token |
138
-
|`refresh_token`| string | New refresh token (may be same as previous) |
139
-
|`expires_in`| number | Token lifetime in seconds |
140
-
141
-
The plugin refreshes proactively when the token is within 5 minutes of expiration, or reactively on 401/403 responses. Updated credentials are persisted back to the original source (file or keychain).
-**Credits are in cents** (divide by 100 for dollars)
222
-
-**Timestamps are ISO 8601** (not unix)
223
-
-**Expiration times are unix milliseconds** (in credentials file)
224
-
-**Token refresh:** JSON body (not form-encoded)
225
-
226
-
## Open Questions
227
-
228
-
-[x] What OAuth refresh endpoint does Claude Code use? → `https://platform.claude.com/v1/oauth/token`
229
-
-[ ] Is `seven_day_opus` always present, or only for certain plans?
230
-
-[ ] Are there additional rate limit windows for different plan tiers (e.g. Max)?
231
-
-[x] What scopes are required for the usage endpoint? → `user:inference` (minimum), full set: `user:profile user:inference user:sessions:claude_code user:mcp_servers`
0 commit comments