Skip to content

Commit 07e4750

Browse files
committed
feat: add rateLimited and retryAfterMs to ProviderUsageData
New optional fields on ProviderUsageData allow providers to signal rate-limit responses (e.g. HTTP 429) with a recommended backoff period. The host app can use these to implement backoff scheduling and cache stale data instead of showing errors during rate-limit windows. Supports tokentopapp/tokentop#58
1 parent d97d0e3 commit 07e4750

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/types/provider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export interface ProviderUsageData {
141141
};
142142
fetchedAt: number;
143143
error?: string;
144+
/** When true, the provider's API returned a rate-limit response (e.g. HTTP 429). */
145+
rateLimited?: boolean;
146+
/** Milliseconds the caller should wait before retrying. Parsed from Retry-After or a sensible default. */
147+
retryAfterMs?: number;
144148
}
145149

146150
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)