/** Host-only Codex usage lookup over the account-scoped ChatGPT endpoint. */ import type { AuthResult, CredentialStore } from '@earendil-works/pi-ai'; import type { CodexUsageSnapshot } from './types.ts'; /** OpenAI's account usage endpoint used by Codex clients. */ export declare const CODEX_USAGE_URL = "https://chatgpt.com/backend-api/wham/usage"; /** Narrow pi-ai surface needed to refresh and resolve one Codex bearer token. */ export interface CodexUsageModels { getAuth(providerId: string): Promise; } /** Injectable fetch surface for deterministic tests. */ export type CodexUsageFetch = (input: string, init: RequestInit) => Promise; /** Validate and redact one untrusted OpenAI usage response. */ export declare function parseCodexUsagePayload(value: unknown, fetchedAt?: number): CodexUsageSnapshot; /** Resolve the non-secret ChatGPT account id of one stored OAuth credential. */ export declare function codexAccountIdOf(credential: Awaited>): string | undefined; /** Build the account-scoped WHAM request headers for one resolved access token. */ export declare function codexWhamHeaders(access: string, accountId: string | undefined): Headers; /** Fetch usage with a fresh pi-ai bearer while keeping all secrets on the Host. */ export declare class CodexUsageService { private readonly models; private readonly credentials; private readonly fetcher; constructor(models: CodexUsageModels, credentials: CredentialStore, fetcher?: CodexUsageFetch); /** Return null when disconnected; otherwise return a validated usage snapshot. */ load(): Promise; }