The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 19:30 UTC
fix(server): restore Claude subscription usage through proxies (#12069)
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Nand committed
Oct 23, 2026 at 07:35 UTC
7e52513a13d972c6c3f9685a263e09fcefa2769e
2 files changed
+9
-3
apps/server/src/usage/cliproxyApi.test.ts
+3
-2
@@ -317,8 +317,9 @@ describe("CLIProxyAPI built-in management API", () => {
317
Effect.gen(function* () {
318
const test = fixture({
319
accounts: [{ ...accounts[0]!, provider: "claude" }],
320
- upstream: () => ({
321
- status: 200,
320
+ // The usage endpoint answers 429 to requests without a Claude Code user agent.
321
+ upstream: (request) => ({
322
+ status: request.header?.["User-Agent"]?.startsWith("claude-code/") ? 200 : 429,
323
body: {
324
five_hour: { utilization: 10, resets_at: null },
325
seven_day: { utilization: 50, resets_at: "2099-01-01T00:00:00Z" },
apps/server/src/usage/cliproxyApi.ts
+6
-1
@@ -214,7 +214,12 @@ export const makeCliproxyApi = Effect.gen(function* () {
214
? { "Chatgpt-Account-Id": account.id_token.chatgpt_account_id }
215
: {}),
216
}
217
- : { Authorization: "Bearer $TOKEN$", "anthropic-beta": "oauth-2025-04-20" };
217
+ : {
218
+ Authorization: "Bearer $TOKEN$",
219
+ "anthropic-beta": "oauth-2025-04-20",
220
+ // The OAuth usage endpoint can return 429 without a Claude Code user agent.
221
+ "User-Agent": "claude-code/2.1.273",
222
+ };
223
const raw = yield* management(config, "api-call", {
224
auth_index: account.auth_index,
225
method: data === undefined ? "GET" : "POST",