Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): show usage limits for every Claude instance #13224

Closedmacodev00(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/13224/headopened View on GitHub

Showing 8 changed files with 138 additions and 42 deletions (loading 6).

x
0 of 8 viewed, 8 left
91 additions and 42 deletionsapps/server/src/provider/Layers/ClaudeProvider.tsModified
View file
@@ -36,10 +36,9 @@
import { resolveClaudeSdkExecutablePath } from "../Drivers/ClaudeExecutable.ts";
import { makeClaudeEnvironment } from "../Drivers/ClaudeHome.ts";
import { discoverClaudeSkills } from "../Drivers/ClaudeSkills.ts";
-import { makeUnavailableUsageLimits } from "../providerUsageLimits.ts";
import {
type ClaudeScopedLimitNames,
- claudeUsageResponseToLimits,
+ claudeProbeUsageLimits,
recordClaudeUsageResponse,
} from "./claudeUsageLimits.ts";
import {
@@ -238,8 +237,9 @@
readonly slashCommands: ReadonlyArray<ServerProviderSlashCommand>;
/**
* Subscription windows from the SDK's `get_usage` control request, or
- * `undefined` when the request itself failed. Absent windows on an
- * otherwise successful response mean the account has none (API key).
+ * `undefined` when the request itself failed. A present body with
+ * `rate_limits_available: false` is an account that cannot report, except
+ * a subscription login, which is classified as a failed read instead.
readonly usage?: Pick<SDKControlGetUsageResponse, "rate_limits_available" | "rate_limits">;
@@ -316,6 +316,74 @@
});
​