import type { LLMProvider, ChatRequest, ChatResponse, ProviderEmbeddingRequest, ProviderEmbeddingResult, ProviderBatchAdapter, ProviderModelSource, ProviderRuntimeMetadata, ProviderRuntimeMetadataDeps } from './interface.js'; import { type LiveModelDiscoveryResult } from './live-model-discovery.js'; import type { CacheHitTracker } from './cache-strategy.js'; /** * Dated fallback model list, used when no API key is configured (so a live * /v1/models call isn't possible) and as the offline baseline when a live * call fails with no prior cache. Docs-verified (no OPENAI_API_KEY was * available in the environment to live-verify against /v1/models) against * developers.openai.com model pages on 2026-07-12; update this list (and the * date below) whenever it is re-verified against a live key or current docs. */ export declare const OPENAI_DATED_STATIC_MODELS: readonly string[]; export declare const OPENAI_DATED_STATIC_MODELS_AS_OF = "2026-07-12"; /** * OpenAIProvider, wraps the official `openai` npm package. * Supports GPT-5 family models with full function/tool calling. */ export declare class OpenAIProvider implements LLMProvider { readonly name = "openai"; readonly credentialAuthority: "resolver"; readonly modelSource: ProviderModelSource; /** * Populated synchronously with the dated-static baseline at construction * (never empty), then replaced by `refreshModels()` with the live * /v1/models result. See `modelSource`. */ private _models; get models(): string[]; readonly batch: ProviderBatchAdapter; /** * The `openai` client, resolved on first use rather than at construction. * * `openai` is an optionalDependency, and this class used to build its client * in the constructor from a static import, which put the specifier on the * module graph of everything that reaches the provider registry, the daemon * included. One memoised promise per provider instance keeps the single * construction this class always did; every method that needs the client * already runs inside an async request path, so awaiting it changes no * public signature. When the package is absent the await throws an error * whose message names it, and each method's existing catch turns that into * the provider error the caller already handles. */ private openaiClient; private readonly apiKey; private readonly embeddingModel; private readonly cacheHitTracker; private readonly modelsCachePath; constructor(apiKey: string, cacheHitTracker?: Pick, modelsCachePath?: string); /** * The `openai` client for this provider, built once. `isConfigured()` * derives from `this.apiKey` (the ORIGINAL value, possibly empty); the * client itself needs a non-empty placeholder because openai's constructor * throws "Missing credentials..." on a falsy key. */ private client; chat(params: ChatRequest): Promise; embed(request: ProviderEmbeddingRequest): Promise; isConfigured(): boolean; /** * Re-check OpenAI's live model list. Called at boot (background, respects * the on-disk TTL cache) and on-demand for a picker-open re-check or an * explicit user refresh (`force: true`, bypasses the TTL cache). Always * resolves, falls back to the on-disk cache, then to the dated-static * list, and reports the honest reason when live discovery fails rather * than silently keeping stale data with no explanation. */ refreshModels(force?: boolean): Promise; describeRuntime(deps: ProviderRuntimeMetadataDeps): Promise; private createChatBatch; private retrieveBatch; private cancelBatch; private getBatchResults; private toOpenAIBatchChatBody; private mapOpenAIBatchStatus; private readOpenAIBatchResultFile; private parseOpenAIBatchResult; private openAIBatchBodyToChatResponse; } //# sourceMappingURL=openai.d.ts.map