/** * Host-only Codex banked rate-limit resets ("resets"): list the credits * granted to the account and redeem one to restore eligible limit windows. */ import type { CredentialStore } from '@earendil-works/pi-ai'; import type { CodexResetCreditsSnapshot, CodexResetRedeemOutcome } from './types.ts'; import type { CodexUsageFetch, CodexUsageModels } from './usage-service.ts'; /** OpenAI's banked-reset listing endpoint used by Codex clients. */ export declare const CODEX_RESET_CREDITS_URL = "https://chatgpt.com/backend-api/wham/rate-limit-reset-credits"; /** OpenAI's banked-reset redemption endpoint used by Codex clients. */ export declare const CODEX_RESET_CONSUME_URL = "https://chatgpt.com/backend-api/wham/rate-limit-reset-credits/consume"; /** Validate and redact one untrusted rate-limit-reset-credits listing. */ export declare function parseCodexResetCreditsPayload(value: unknown, fetchedAt?: number): CodexResetCreditsSnapshot; /** Validate one untrusted consume response into a browser-safe outcome. */ export declare function parseCodexResetRedeemPayload(value: unknown): CodexResetRedeemOutcome; /** * List and redeem banked resets with a fresh pi-ai bearer while keeping all * secrets on the Host. `availableCount` is authoritative; the backend may cap * the number of listed entries, so `credits.length` is not a substitute. */ export declare class CodexResetService { private readonly models; private readonly credentials; private readonly fetcher; private readonly newRequestId; constructor(models: CodexUsageModels, credentials: CredentialStore, fetcher?: CodexUsageFetch, newRequestId?: () => string); /** Return null when disconnected; otherwise return a validated credit listing. */ list(): Promise; /** * Redeem one banked reset. `creditId` omitted lets OpenAI choose; each call * spends a fresh idempotency key and is never retried automatically, so an * ambiguous network failure never consumes a second credit. */ redeem(creditId?: string | null): Promise; /** Fresh account-scoped headers, or null while disconnected. */ private authHeaders; }