import { openai as _openai } from "@ai-sdk/openai"; import { AISDKLanguageModel } from "../language-model.js"; import type { OpenAIOAuthCredentials } from "../oauth/types.js"; /** * OpenAI model IDs (derived from @ai-sdk/openai). */ export type OpenAIModelId = Parameters[0]; /** * Options for creating a custom OpenAI provider. */ export interface OpenAIProviderOptions { /** API key for standard authentication */ apiKey?: string; /** OAuth credentials for ChatGPT Plus/Pro (Codex) authentication */ oauth?: OpenAIOAuthCredentials; /** Custom base URL (ignored for OAuth - uses Codex endpoint) */ baseURL?: string; /** Custom headers */ headers?: Record; } /** * Create a custom OpenAI provider with explicit credentials. * * @example API key auth * ```ts * const openai = createOpenAI({ apiKey: "sk-..." }); * const model = openai("gpt-4o"); * ``` * * @example OAuth auth (ChatGPT Plus/Pro via Codex) * ```ts * const openai = createOpenAI({ * oauth: { * accessToken: "...", * refreshToken: "...", * expiresAt: Date.now() + 3600000, * accountId: "...", // for org subscriptions * onRefresh: (tokens) => saveTokens(tokens), * } * }); * const model = openai("gpt-4o"); * ``` */ export declare function createOpenAI(options?: OpenAIProviderOptions): (modelId: OpenAIModelId) => AISDKLanguageModel; /** * Create a kernl-compatible OpenAI language model. * Uses OPENAI_API_KEY environment variable. * * @example * ```ts * import { openai } from '@kernl-sdk/ai/openai'; * * const gpt4 = openai('gpt-4o'); * const response = await gpt4.generate([...], {}); * ``` */ export declare function openai(modelId: OpenAIModelId): AISDKLanguageModel; export type { OpenAIOAuthCredentials } from "../oauth/types.js"; //# sourceMappingURL=openai.d.ts.map