import { type IOpenAiChatGptReadAccess } from './smartai.chatgpt.openai.js'; /** * The OpenAI Codex release whose model catalog contract this package implements, sent as the catalog's * `client_version` and `version`. The backend shapes the catalog by it, so a stale value withholds newer * models. It names the same release as the catalog entry of `third-party-notices.md`: move both together, * after checking the catalog fields this module reads against that release. */ export declare const OPENAI_CHATGPT_CATALOG_CLIENT_VERSION = "0.170.0"; export type TOpenAiChatGptInputModality = 'text' | 'image' | 'audio'; export interface IOpenAiChatGptModelReasoningEffort { effort: string; description: string; } export interface IOpenAiChatGptModelServiceTier { id: string; name: string; description: string; } /** One model of a ChatGPT account's Codex catalog, in the catalog's own priority order. */ export interface IOpenAiChatGptModel { providerId: 'openai'; modelId: string; wireModel: string; displayName: string; description: string; hidden: boolean; /** The Responses API reasoning efforts the model accepts; Codex client modes such as `ultra` are left out. */ reasoningEfforts: IOpenAiChatGptModelReasoningEffort[]; /** The catalog's default effort; a Codex client mode is stated as the effort Codex sends for it. */ defaultReasoningEffort: string; inputModalities: TOpenAiChatGptInputModality[]; supportsPersonality: boolean; serviceTiers: IOpenAiChatGptModelServiceTier[]; defaultServiceTier?: string; /** * The served context window in tokens, as the catalog states it (`context_window`); absent when the * catalog states none. Never the extended `max_context_window`. */ contextWindow?: number; /** * The catalog's automatic compaction point in tokens (`auto_compact_token_limit`); absent when the * catalog states none. */ autoCompactTokenLimit?: number; /** The first listed model, or the first model when none is listed. */ isDefault: boolean; } /** * Why a catalog read failed, other than a rejected access token or an abort. * * - `NETWORK_FAILED`: the request did not complete. * - `HTTP_ERROR`: the backend answered with an error status other than 401; `status` names it. * - `PROTOCOL_ERROR`: the answer was oversized or not a catalog this package can read. */ export type TOpenAiChatGptModelListErrorCode = 'NETWORK_FAILED' | 'HTTP_ERROR' | 'PROTOCOL_ERROR'; export declare class OpenAiChatGptModelListError extends Error { readonly code: TOpenAiChatGptModelListErrorCode; readonly status?: number; constructor(codeArg: TOpenAiChatGptModelListErrorCode, statusArg?: number); } export interface IOpenAiChatGptModelListOptions { signal?: AbortSignal; /** Stable provider originator header. Defaults to `smartai`. */ originator?: string; /** Optional underlying transport. Defaults to the current global fetch. */ fetch?: typeof fetch; /** * The Codex release to read the catalog as, sent as `client_version` and `version`; defaults to * `OPENAI_CHATGPT_CATALOG_CLIENT_VERSION`. A gateway serving a Codex client passes that client's version, so it * routes by the same catalog the client was offered. The entries are still read by this package's contract. */ clientVersion?: string; } /** * Reads a JSON body of at most `maximumBytesArg` bytes; an oversized or unparsable body fails with * `protocolErrorArg()`, and an abort with the signal's reason. Shared by the OpenAI model reads. */ export declare const readOpenAiBoundedJson: (responseArg: Response, signalArg: AbortSignal | undefined, maximumBytesArg: number, protocolErrorArg: () => Error) => Promise; /** * Reads the Codex model catalog of one ChatGPT account with access alone. * * It returns every model, hidden ones included, in the catalog's priority order. A rejected access token * fails with an `OpenAiChatGptAuthError` whose `status` is 401, so a caller that holds a renewable access * resolves it again and repeats the read. An abort rejects with the signal's reason; every other failure * is an `OpenAiChatGptModelListError`. */ export declare function listOpenAiChatGptModels(accessArg: IOpenAiChatGptReadAccess, optionsArg?: IOpenAiChatGptModelListOptions): Promise;