import { LanguageModelV1, ProviderV1, TranscriptionModelV1, SpeechModelV1 } from '@catnose99/provider'; import { FetchFunction } from '@catnose99/provider-utils'; import { z } from 'zod'; type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {}); interface OpenAIChatSettings { /** Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated. */ logitBias?: Record; /** Return the log probabilities of the tokens. Including logprobs will increase the response size and can slow down response times. However, it can be useful to better understand how the model is behaving. Setting to true will return the log probabilities of the tokens that were generated. Setting to a number will return the log probabilities of the top n tokens that were generated. */ logprobs?: boolean | number; /** Whether to use structured outputs. Defaults to false. When enabled, tool calls and object generation will be strict and follow the provided schema. */ structuredOutputs?: boolean; /** A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more. */ user?: string; /** Automatically download images and pass the image as data to the model. OpenAI supports image URLs for public models, so this is only needed for private models or when the images are not publicly accessible. Defaults to `false`. */ downloadImages?: boolean; /** Simulates streaming by using a normal generate call and returning it as a stream. Enable this if the model that you are using does not support streaming. Defaults to `false`. @deprecated Use `simulateStreamingMiddleware` instead. */ simulateStreaming?: boolean; /** Reasoning effort for reasoning models. Defaults to `medium`. */ reasoningEffort?: 'low' | 'medium' | 'high'; } type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {}); interface OpenAICompletionSettings { /** Echo back the prompt in addition to the completion. */ echo?: boolean; /** Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated. */ logitBias?: Record; /** Return the log probabilities of the tokens. Including logprobs will increase the response size and can slow down response times. However, it can be useful to better understand how the model is behaving. Setting to true will return the log probabilities of the tokens that were generated. Setting to a number will return the log probabilities of the top n tokens that were generated. */ logprobs?: boolean | number; /** The suffix that comes after a completion of inserted text. */ suffix?: string; /** A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more. */ user?: string; } type OpenAICompletionConfig = { provider: string; compatibility: 'strict' | 'compatible'; headers: () => Record; url: (options: { modelId: string; path: string; }) => string; fetch?: FetchFunction; }; declare class OpenAICompletionLanguageModel implements LanguageModelV1 { readonly specificationVersion = "v1"; readonly defaultObjectGenerationMode: undefined; readonly modelId: OpenAICompletionModelId; readonly settings: OpenAICompletionSettings; private readonly config; constructor(modelId: OpenAICompletionModelId, settings: OpenAICompletionSettings, config: OpenAICompletionConfig); get provider(): string; private getArgs; doGenerate(options: Parameters[0]): Promise>>; doStream(options: Parameters[0]): Promise>>; } type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {}); type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {}); type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {}); interface OpenAIProvider extends ProviderV1 { (modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel; (modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV1; /** Creates an OpenAI model for text generation. */ languageModel(modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel; languageModel(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV1; /** Creates an OpenAI chat model for text generation. */ chat(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV1; /** Creates an OpenAI responses API model for text generation. */ responses(modelId: OpenAIResponsesModelId): LanguageModelV1; /** Creates an OpenAI completion model for text generation. */ completion(modelId: OpenAICompletionModelId, settings?: OpenAICompletionSettings): LanguageModelV1; /** Creates a model for transcription. */ transcription(modelId: OpenAITranscriptionModelId): TranscriptionModelV1; /** Creates a model for speech generation. */ speech(modelId: OpenAISpeechModelId): SpeechModelV1; } interface OpenAIProviderSettings { /** Base URL for the OpenAI API calls. */ baseURL?: string; /** API key for authenticating requests. */ apiKey?: string; /** OpenAI Organization. */ organization?: string; /** OpenAI project. */ project?: string; /** Custom headers to include in the requests. */ headers?: Record; /** OpenAI compatibility mode. Should be set to `strict` when using the OpenAI API, and `compatible` when using 3rd party providers. In `compatible` mode, newer information such as streamOptions are not being sent. Defaults to 'compatible'. */ compatibility?: 'strict' | 'compatible'; /** Provider name. Overrides the `openai` default name for 3rd party providers. */ name?: string; /** Custom fetch implementation. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing. */ fetch?: FetchFunction; } /** Create an OpenAI provider instance. */ declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider; /** Default OpenAI provider instance. It uses 'strict' compatibility mode. */ declare const openai: OpenAIProvider; declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{ metadata: z.ZodOptional>; previousResponseId: z.ZodOptional>; store: z.ZodOptional>; user: z.ZodOptional>; reasoningEffort: z.ZodOptional>; strictSchemas: z.ZodOptional>; instructions: z.ZodOptional>; reasoningSummary: z.ZodOptional>; }, "strip", z.ZodTypeAny, { user?: string | null | undefined; store?: boolean | null | undefined; metadata?: any; reasoningEffort?: string | null | undefined; previousResponseId?: string | null | undefined; strictSchemas?: boolean | null | undefined; instructions?: string | null | undefined; reasoningSummary?: string | null | undefined; }, { user?: string | null | undefined; store?: boolean | null | undefined; metadata?: any; reasoningEffort?: string | null | undefined; previousResponseId?: string | null | undefined; strictSchemas?: boolean | null | undefined; instructions?: string | null | undefined; reasoningSummary?: string | null | undefined; }>; type OpenAIResponsesProviderOptions = z.infer; export { type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, createOpenAI, openai };