/**
 * OpenAI-specific type definitions
 */
interface ChatCompletionToolCallFunctionChunk {
    name: string | null;
    arguments: string;
    provider_specific_fields?: Record<string, any>;
}
interface ChatCompletionAssistantToolCall {
    id: string | null;
    type: 'function';
    function: ChatCompletionToolCallFunctionChunk;
}
interface ChatCompletionToolCallChunk {
    id: string | null;
    type: 'function';
    function: ChatCompletionToolCallFunctionChunk;
    index: number;
    /**
     * Optional caller metadata for programmatic tool calling (Anthropic extension).
     * Opaque to most consumers; forwarded through by downstream transformation.
     */
    caller?: Record<string, unknown>;
}
interface ChatCompletionCachedContent {
    type: 'ephemeral';
}
interface ChatCompletionThinkingBlock {
    type: 'thinking';
    thinking: string;
    signature?: string;
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
interface ChatCompletionRedactedThinkingBlock {
    type: 'redacted_thinking';
    data: string;
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
interface ChatCompletionAnnotationURLCitation {
    end_index: number;
    start_index: number;
    title?: string;
    url: string;
}
interface ChatCompletionAnnotation {
    type: 'url_citation';
    url_citation: ChatCompletionAnnotationURLCitation;
}
interface OpenAIChatCompletionTextObject {
    type: 'text';
    text: string;
}
interface ChatCompletionTextObject extends OpenAIChatCompletionTextObject {
    cache_control?: ChatCompletionCachedContent;
}
interface ChatCompletionImageUrlObject {
    url: string;
    detail?: string;
    format?: string;
}
interface ChatCompletionImageObject {
    type: 'image_url';
    image_url: string | ChatCompletionImageUrlObject;
}
interface ChatCompletionVideoUrlObject {
    url: string;
    detail?: string;
}
interface ChatCompletionVideoObject {
    type: 'video_url';
    video_url: string | ChatCompletionVideoUrlObject;
}
interface ChatCompletionAudioObject {
    type: 'input_audio';
    input_audio: {
        data: string;
        format: 'wav' | 'mp3';
    };
}
interface DocumentObject {
    type: 'text';
    media_type: string;
    data: string;
}
interface CitationsObject {
    enabled: boolean;
}
interface ChatCompletionDocumentObject {
    type: 'document';
    source: DocumentObject;
    title: string;
    context: string;
    citations?: CitationsObject;
}
interface ChatCompletionFileObjectFile {
    file_data?: string;
    file_id?: string;
    filename?: string;
    format?: string;
}
interface ChatCompletionFileObject {
    type: 'file';
    file: ChatCompletionFileObjectFile;
}
type OpenAIMessageContentListBlock = ChatCompletionTextObject | ChatCompletionImageObject | ChatCompletionAudioObject | ChatCompletionDocumentObject | ChatCompletionVideoObject | ChatCompletionFileObject;
type OpenAIMessageContent = string | OpenAIMessageContentListBlock[];
interface OpenAIChatCompletionUserMessage {
    role: 'user';
    content: OpenAIMessageContent;
}
interface ChatCompletionUserMessage extends OpenAIChatCompletionUserMessage {
    cache_control?: ChatCompletionCachedContent;
}
interface OpenAIChatCompletionAssistantMessage {
    role: 'assistant';
    content?: string | (ChatCompletionTextObject | ChatCompletionThinkingBlock)[] | null;
    name?: string;
    tool_calls?: ChatCompletionAssistantToolCall[];
    function_call?: ChatCompletionToolCallFunctionChunk;
    reasoning_content?: string;
}
interface ChatCompletionAssistantMessage extends OpenAIChatCompletionAssistantMessage {
    cache_control?: ChatCompletionCachedContent;
    thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
}
interface ChatCompletionToolMessage {
    role: 'tool';
    content: string | ChatCompletionTextObject[];
    tool_call_id: string;
}
interface ChatCompletionFunctionMessage {
    role: 'function';
    content?: string | ChatCompletionTextObject[] | null;
    name: string;
    tool_call_id?: string;
}
interface OpenAIChatCompletionSystemMessage {
    role: 'system';
    content: string | any[];
    name?: string;
}
interface OpenAIChatCompletionDeveloperMessage {
    role: 'developer';
    content: string | any[];
    name?: string;
}
interface ChatCompletionSystemMessage extends OpenAIChatCompletionSystemMessage {
    cache_control?: ChatCompletionCachedContent;
}
interface ChatCompletionDeveloperMessage extends OpenAIChatCompletionDeveloperMessage {
    cache_control?: ChatCompletionCachedContent;
}
type AllMessageValues = ChatCompletionUserMessage | ChatCompletionAssistantMessage | ChatCompletionToolMessage | ChatCompletionSystemMessage | ChatCompletionFunctionMessage | ChatCompletionDeveloperMessage;
interface ChatCompletionToolChoiceFunctionParam {
    name: string;
}
interface ChatCompletionToolChoiceObjectParam {
    type: 'function';
    function: ChatCompletionToolChoiceFunctionParam;
}
type ChatCompletionToolChoiceStringValues = 'none' | 'auto' | 'required';
type ChatCompletionToolChoiceValues = ChatCompletionToolChoiceStringValues | ChatCompletionToolChoiceObjectParam;
interface ChatCompletionToolParamFunctionChunk {
    name: string;
    description?: string;
    parameters?: Record<string, any>;
    strict?: boolean;
}
interface OpenAIChatCompletionToolParam {
    type: 'function' | string;
    function: ChatCompletionToolParamFunctionChunk;
}
interface ChatCompletionToolParam extends OpenAIChatCompletionToolParam {
    cache_control?: ChatCompletionCachedContent;
}
type OpenAIImageGenerationOptionalParams = 'background' | 'moderation' | 'n' | 'output_compression' | 'output_format' | 'quality' | 'response_format' | 'size' | 'style' | 'user';

/**
 * Completion types for chat completions
 *
 * This module contains message parameter types for chat completion requests.
 */

interface ChatCompletionSystemMessageParam {
    content: string;
    role: 'system';
    name?: string;
}
interface ChatCompletionContentPartTextParam {
    text: string;
    type: 'text';
}
interface ImageURL {
    url: string;
    detail?: 'auto' | 'low' | 'high';
}
interface ChatCompletionContentPartImageParam {
    image_url: ImageURL;
    type: 'image_url';
}
type ChatCompletionContentPartParam = ChatCompletionContentPartTextParam | ChatCompletionContentPartImageParam;
interface ChatCompletionUserMessageParam {
    content: string | ChatCompletionContentPartParam[];
    role: 'user';
    name?: string;
}
interface FunctionCall {
    arguments: string;
    name: string;
}
interface Function {
    arguments: string;
    name: string;
}
interface ChatCompletionToolMessageParam {
    content: string | ChatCompletionContentPartParam[];
    role: 'tool';
    tool_call_id: string;
}
interface ChatCompletionFunctionMessageParam {
    content: string | ChatCompletionContentPartParam[];
    name: string;
    role: 'function';
}
interface ChatCompletionMessageToolCallParam {
    id: string;
    function: Function;
    type: 'function';
}
interface ChatCompletionAssistantMessageParam {
    role: 'assistant';
    content?: string | null;
    function_call?: FunctionCall;
    name?: string;
    tool_calls?: ChatCompletionMessageToolCallParam[];
}
interface ChatCompletionDeveloperMessageParam {
    content: string;
    role: 'developer';
    name?: string;
}
type ChatCompletionMessageParam = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionFunctionMessageParam | ChatCompletionToolMessageParam | ChatCompletionDeveloperMessageParam;
interface CompletionRequest {
    model: string;
    messages: ChatCompletionMessageParam[];
    timeout?: number;
    temperature?: number;
    top_p?: number;
    n?: number;
    stream?: boolean;
    stop?: string | string[];
    max_tokens?: number;
    max_completion_tokens?: number;
    presence_penalty?: number;
    frequency_penalty?: number;
    logit_bias?: Record<string, any>;
    user?: string;
    response_format?: Record<string, any>;
    seed?: number;
    tools?: ChatCompletionToolParam[];
    tool_choice?: ChatCompletionToolChoiceValues;
    parallel_tool_calls?: boolean;
    logprobs?: boolean;
    top_logprobs?: number;
    functions?: any[];
    function_call?: string | Record<string, any>;
    api_base?: string;
    api_key?: string;
}
/**
 * Message interface for SDK input
 * This is the message format users pass to the completion function
 */
interface Message {
    role: 'system' | 'user' | 'assistant' | 'tool' | 'function' | 'developer';
    content: string | ContentBlock[];
    tool_call_id?: string;
    name?: string;
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
    tool_calls?: ChatCompletionToolCallChunk[];
    thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
    reasoning_content?: string;
}
/**
 * Content block types
 */
type ContentBlock = TextContentBlock | ImageURLContentBlock | FileContentBlock | ThinkingContentBlock | DocumentContentBlock;
/**
 * Text content block with optional cache control
 */
interface TextContentBlock {
    type: 'text';
    text: string;
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
/**
 * Image URL content block with optional cache control
 */
interface ImageURLContentBlock {
    type: 'image_url';
    image_url: string | {
        url: string;
        detail?: 'auto' | 'low' | 'high';
        format?: string;
    };
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
/**
 * File content block with optional cache control
 */
interface FileContentBlock {
    type: 'file';
    file: {
        file_id?: string;
        file_data?: string;
        filename?: string;
        format?: string;
    };
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
/**
 * Thinking content block with optional cache control
 */
interface ThinkingContentBlock {
    type: 'thinking';
    thinking: string;
    signature?: string;
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
/**
 * Document content block with optional cache control
 */
interface DocumentContentBlock {
    type: 'document';
    source: {
        type: string;
        media_type: string;
        data: string;
    };
    title?: string;
    context?: string;
    citations?: {
        enabled: boolean;
    };
    cache_control?: ChatCompletionCachedContent | Record<string, any>;
}
interface ResponseFormat {
    type: 'json_object' | 'json_schema' | 'text';
    json_schema?: {
        name?: string;
        schema: Record<string, any>;
        strict?: boolean;
    };
    response_schema?: Record<string, any>;
}
interface ChatCompletionRequest {
    model: string;
    messages: Message[];
    temperature?: number;
    max_tokens?: number;
    max_completion_tokens?: number;
    top_p?: number;
    stream?: boolean;
    stream_options?: Record<string, any>;
    stop?: string | string[];
    tools?: ChatCompletionToolParam[];
    tool_choice?: ChatCompletionToolChoiceValues;
    parallel_tool_calls?: boolean;
    response_format?: ResponseFormat;
    thinking?: {
        type: 'enabled' | 'disabled';
        budget_tokens?: number;
    };
    reasoning_effort?: 'minimal' | 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'default';
    verbosity?: 'low' | 'medium' | 'high';
    web_search_options?: {
        search_context_size?: 'low' | 'medium' | 'high';
        user_location?: {
            type: 'approximate';
            approximate?: {
                city?: string;
                country?: string;
                region?: string;
                timezone?: string;
            };
        };
    };
    audio?: {
        voice?: string;
        format?: string;
    };
    modalities?: string[];
    seed?: number;
    logprobs?: boolean;
    top_logprobs?: number;
    frequency_penalty?: number;
    presence_penalty?: number;
    api_key?: string;
    api_base?: string;
    base_url?: string;
    api_version?: string;
    timeout?: number;
    request_timeout?: number;
    max_retries?: number;
    organization?: string;
    user?: string;
    headers?: Record<string, string>;
    extra_headers?: Record<string, string>;
    custom_llm_provider?: string;
    provider_specific_header?: any;
    functions?: any[];
    function_call?: string | Record<string, any>;
    prediction?: any;
    logit_bias?: Record<string, number>;
    safety_identifier?: string;
    service_tier?: string;
    n?: number;
    ensure_alternating_roles?: boolean;
    user_continue_message?: ChatCompletionUserMessage;
    assistant_continue_message?: ChatCompletionAssistantMessage;
    supports_system_message?: boolean;
    drop_params?: boolean;
    allowed_openai_params?: string[];
}
type ChatCompletionRequestNonStreaming = ChatCompletionRequest & {
    stream?: false | never;
};
type ChatCompletionRequestStreaming = ChatCompletionRequest & {
    stream: true;
};

/**
 * Type utility functions and centralized Usage class
 *
 * This module provides centralized usage handling for all providers.
 * All providers should use the Usage class for consistent usage normalization.
 */

/**
 * FileTypes — Binary file input for endpoints that accept uploads
 * (audio transcription, image edit, and any future multipart uploads).
 *
 * Accepted shapes:
 *  - `Buffer` / `Uint8Array`: raw bytes. When no filename metadata is
 *     available, endpoints fall back to a sensible default (e.g.
 *     `audio.wav` for transcription, `image.png` for image edit) so the
 *     multipart request is well-formed.
 *  - `File`: carries its own `name` and MIME `type`; used as-is.
 *  - `Blob`: used as-is when it has a `name` attached; otherwise treated
 *     like raw bytes with the per-endpoint filename default.
 *  - `Array<...>`: multi-file endpoints (currently: image edit with
 *     multiple input images). Each element follows the rules above.
 *
 * Providers that drive their own multipart serialization (for example,
 * ElevenLabs transcription and the OpenAI image-edit path) normalize
 * this value internally. The OpenAI transcription path forwards the
 * input to the provider client and applies the default-filename
 * fallback just before the wire call.
 */
type FileTypes = Buffer | Uint8Array | File | Blob | Array<Buffer | Uint8Array | File | Blob>;
/**
 * RequestFiles - Represents files for multipart/form-data requests
 * Array of [fieldName, fileData] tuples
 */
type RequestFiles = Array<[string, any]>;
/**
 * GenericRocketLLMParams - Generic parameters for RocketLLM calls
 */
interface GenericRocketLLMParams {
    customLlmProvider?: string;
    tpm?: number;
    rpm?: number;
    timeout?: number | string;
    streamTimeout?: number | string;
    maxRetries?: number;
    organization?: string;
    rocketllmTraceId?: string;
    [key: string]: any;
}
/**
 * Generate a unique response ID (private helper function)
 */
declare function generateId(): string;
/**
 * Cache creation token details for Anthropic prompt caching
 */
interface CacheCreationTokenDetails {
    ephemeral_5m_input_tokens?: number;
    ephemeral_1h_input_tokens?: number;
}
/**
 * Completion tokens details wrapper
 * Extended version that includes text_tokens, image_tokens, audio_tokens
 */
interface CompletionTokensDetailsWrapper {
    reasoning_tokens?: number;
    text_tokens?: number;
    image_tokens?: number;
    audio_tokens?: number;
    accepted_prediction_tokens?: number;
    rejected_prediction_tokens?: number;
}
/**
 * Prompt tokens details wrapper
 * Extended version that includes text_tokens, image_tokens, and provider-specific fields
 */
interface PromptTokensDetailsWrapper {
    cached_tokens?: number;
    text_tokens?: number;
    image_tokens?: number;
    audio_tokens?: number;
    web_search_requests?: number;
    cache_creation_tokens?: number;
    cache_creation_token_details?: CacheCreationTokenDetails;
}
/**
 * Server tool use tracking
 */
interface ServerToolUse {
    web_search_requests?: number;
    tool_search_requests?: number;
}
/**
 * Usage constructor parameters
 */
interface UsageParams {
    prompt_tokens?: number;
    completion_tokens?: number;
    total_tokens?: number;
    reasoning_tokens?: number;
    prompt_tokens_details?: PromptTokensDetailsWrapper | null;
    completion_tokens_details?: CompletionTokensDetailsWrapper | null;
    server_tool_use?: ServerToolUse | null;
    cost?: number;
    cache_creation_input_tokens?: number;
    cache_read_input_tokens?: number;
    prompt_cache_hit_tokens?: number;
    [key: string]: any;
}
/**
 * Centralized Usage class
 *
 * All providers should use this class for consistent usage handling.
 * Handles:
 * - completion_tokens_details normalization
 * - Auto-calculation of text_tokens when reasoning_tokens is present
 * - prompt_tokens_details normalization
 * - Provider-specific mappings (DeepSeek, Anthropic)
 */
declare class Usage {
    prompt_tokens: number;
    completion_tokens: number;
    total_tokens: number;
    completion_tokens_details?: CompletionTokensDetailsWrapper;
    prompt_tokens_details?: PromptTokensDetailsWrapper;
    server_tool_use?: ServerToolUse;
    cost?: number;
    private _cache_creation_input_tokens;
    private _cache_read_input_tokens;
    constructor(params: UsageParams);
    /**
     * Check if a key exists (for 'in' operator compatibility)
     */
    has(key: string): boolean;
    /**
     * Get a value with default (for .get() compatibility)
     */
    get<T = any>(key: string, defaultValue?: T): T | undefined;
    /**
     * Convert to plain object for JSON serialization
     */
    toJSON(): Record<string, any>;
}
interface ResponseFunctionCall {
    name: string;
    arguments: string;
}
interface ResponseMessage {
    content: string | null;
    role: 'assistant' | 'user' | 'system' | 'tool' | 'function';
    tool_calls?: ChatCompletionToolCallChunk[];
    function_call?: ResponseFunctionCall;
    audio?: Record<string, any>;
    images?: Array<{
        image_url: {
            url: string;
            detail?: string;
        };
        index: number;
        type: 'image_url';
    }>;
    reasoning_content?: string;
    thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
    provider_specific_fields?: Record<string, any>;
    annotations?: ChatCompletionAnnotation[];
}
interface Delta {
    content?: string | null;
    role?: string;
    tool_calls?: ChatCompletionToolCallChunk[];
    function_call?: ResponseFunctionCall;
    audio?: Record<string, any>;
    images?: Array<{
        image_url: {
            url: string;
            detail?: string;
        };
        index: number;
        type: 'image_url';
    }>;
    reasoning_content?: string;
    thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
    provider_specific_fields?: Record<string, any>;
    annotations?: ChatCompletionAnnotation[];
}
interface TopLogprob {
    bytes?: number[];
    logprob: number;
    token: string;
}
interface ChatCompletionTokenLogprob {
    bytes?: number[];
    logprob: number;
    token: string;
    top_logprobs?: TopLogprob[];
}
interface ChoiceLogprobs {
    content?: ChatCompletionTokenLogprob[];
    refusal?: ChatCompletionTokenLogprob[];
}
interface Choices {
    finish_reason: string;
    index: number;
    message: ResponseMessage;
    logprobs?: ChoiceLogprobs;
    provider_specific_fields?: Record<string, any>;
}
interface StreamingChoices {
    finish_reason: string | null;
    index: number;
    delta: Delta;
    logprobs?: ChoiceLogprobs;
}
interface ModelResponseBase {
    id: string;
    created: number;
    model: string | null;
    object: string;
    system_fingerprint?: string;
}
interface ModelResponseStream extends ModelResponseBase {
    choices: StreamingChoices[];
    usage?: Usage;
    provider_specific_fields?: Record<string, any>;
}
interface ModelResponse extends ModelResponseBase {
    choices: (Choices | StreamingChoices)[];
    usage?: Usage;
}
interface GenericStreamingChunk {
    text?: string;
    is_finished?: boolean;
    finish_reason?: string;
    usage?: UsageParams;
    index?: number;
    tool_use?: {
        id?: string;
        name?: string;
        input?: string;
    };
    provider_specific_fields?: Record<string, any>;
}
interface GenericImageParsingChunk {
    type: string;
    media_type: string;
    data: string;
}
interface ResponseFormatChunk {
    type?: string;
    json_schema?: Record<string, any>;
}
type LLMProvider = 'anthropic' | 'openai' | 'gemini' | 'cohere' | 'mistral' | 'perplexity' | 'rocketllm_proxy';
/**
 * RocketLLMProviders - Enum of all supported LLM providers
 *
 * Used by ProviderConfigManager to determine which config class to use
 * for request transformation.
 */
declare enum RocketLLMProviders {
    OPENAI = "openai",
    ANTHROPIC = "anthropic",
    GEMINI = "gemini",
    PERPLEXITY = "perplexity",
    ELEVENLABS = "elevenlabs",
    ROCKETLLM_PROXY = "rocketllm_proxy"
}
/**
 * Completion tokens details
 */
interface CompletionTokensDetails {
    reasoning_tokens?: number;
    text_tokens?: number;
    audio_tokens?: number;
    image_tokens?: number;
    accepted_prediction_tokens?: number;
    rejected_prediction_tokens?: number;
}
/**
 * Prompt tokens details
 */
interface PromptTokensDetails {
    cached_tokens?: number;
    text_tokens?: number;
    audio_tokens?: number;
    cache_creation_tokens?: number;
    cache_creation_token_details?: {
        ephemeral_5m_input_tokens?: number;
        ephemeral_1h_input_tokens?: number;
    };
    web_search_requests?: number;
}
/**
 * Usage object with detailed token information
 */
interface UsageInfo {
    prompt_tokens: number;
    completion_tokens: number;
    total_tokens: number;
    cache_creation_input_tokens?: number;
    cache_read_input_tokens?: number;
    completion_tokens_details?: CompletionTokensDetails;
    prompt_tokens_details?: PromptTokensDetails;
    server_tool_use?: {
        web_search_requests?: number;
        tool_search_requests?: number;
    };
}
interface ChatCompletionResponse {
    id: string;
    object: 'chat.completion';
    created: number;
    model: string;
    choices: Array<{
        index: number;
        message: {
            role: string;
            content: string | null;
            tool_calls?: ChatCompletionToolCallChunk[];
            thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
            reasoning_content?: string;
        };
        finish_reason: string;
        provider_specific_fields?: Record<string, any>;
    }>;
    usage: UsageInfo;
}
interface StreamChunk {
    id: string;
    object: 'chat.completion.chunk';
    created: number;
    model: string;
    choices: Array<{
        index: number;
        delta: {
            role?: string;
            content?: string;
            tool_calls?: ChatCompletionToolCallChunk[];
            provider_specific_fields?: Record<string, any>;
            thinking_blocks?: (ChatCompletionThinkingBlock | ChatCompletionRedactedThinkingBlock)[];
            reasoning_content?: string;
        };
        finish_reason: string | null;
    }>;
    usage?: UsageInfo;
}
interface RocketLLMOptions {
    baseURL?: string;
    apiKey?: string;
    anthropicApiKey?: string;
    openaiApiKey?: string;
    geminiApiKey?: string;
    cohereApiKey?: string;
    mistralApiKey?: string;
    dangerouslyAllowBrowser?: boolean;
    timeout?: number;
    defaultHeaders?: Record<string, string>;
}
interface ProviderSpecificHeader {
    custom_llm_provider: string;
    extra_headers: Record<string, string>;
}
interface TranscriptionUsageDurationObject {
    type: 'duration';
    seconds: number;
}
interface TranscriptionUsageInputTokenDetailsObject {
    audio_tokens: number;
    text_tokens: number;
}
interface TranscriptionUsageTokensObject {
    type: 'tokens';
    input_tokens: number;
    output_tokens: number;
    total_tokens: number;
    input_token_details: TranscriptionUsageInputTokenDetailsObject;
}
interface TranscriptionResponse {
    text: string | null;
    usage?: TranscriptionUsageDurationObject | TranscriptionUsageTokensObject;
    language?: string;
    task?: string;
    duration?: number;
    words?: any[];
    segments?: any[];
    _hidden_params?: Record<string, any>;
}

/**
 * Perplexity Search Configuration
 * Handles web search via Perplexity API
 */
interface SearchResult {
    title: string;
    url: string;
    snippet: string;
    date?: string;
    last_updated?: string;
}
interface SearchResponse {
    object: 'search';
    results: SearchResult[];
}

/**
 * Binary response wrapper for endpoints that return raw audio/video/image
 * bytes (TTS today; extensible to other binary-returning endpoints).
 *
 * Wraps a Fetch `Response` so callers can:
 *   - read the raw bytes via `content()` / `read()`
 *   - decode as text or JSON via `text()` / `json()`
 *   - stream bytes without buffering the whole body via `iterBytes()` /
 *     `iterText()` / `iterLines()` / `streamToFile()`
 *   - persist the full body via `writeToFile()`
 *   - inspect response metadata (`status`, `headers`, `encoding`) without
 *     re-wiring the underlying HTTP response
 *
 * Method names are JS-idiomatic camelCase. `read()` is provided as an
 * alias for `content()` to match the naming that upstream clients of the
 * underlying HTTP libraries conventionally use.
 */
declare class BinaryResponseContent {
    #private;
    /**
     * Underlying Fetch Response. Public so advanced callers can drop down
     * to the raw response if a method surface is missing.
     */
    readonly response: Response;
    /**
     * Free-form metadata bag used to attach attribution fields (model,
     * custom_llm_provider, etc.) that downstream tooling may read. Mutable
     * by design — callers are expected to append to it.
     */
    hiddenParams: Record<string, unknown>;
    constructor(response: Response);
    get status(): number;
    get headers(): Headers;
    /**
     * Charset parsed from the `content-type` header (e.g. `utf-8` for
     * `text/plain; charset=utf-8`). Null if no charset is present.
     */
    get encoding(): string | null;
    get charsetEncoding(): string | null;
    /**
     * Read the full body as a `Uint8Array`. Caches the result so repeat
     * calls do not attempt to drain an already-consumed body stream.
     */
    content(): Promise<Uint8Array>;
    /**
     * Alias of `content()` for API symmetry with common binary-response
     * wrappers in other HTTP clients.
     */
    read(): Promise<Uint8Array>;
    /**
     * Decode the full body using the response's charset (defaults to
     * `utf-8`).
     */
    text(): Promise<string>;
    json<T = unknown>(): Promise<T>;
    /**
     * Async byte iterator. If `content()` has already been called, yields
     * slices of the cached buffer sized by `chunkSize`. Otherwise streams
     * directly from the live response body — which is drained as a side
     * effect, so subsequent `content()` calls on the same instance will
     * return an empty cache.
     */
    iterBytes(chunkSize?: number): AsyncIterable<Uint8Array>;
    /**
     * Iterate decoded text chunks. Uses a streaming TextDecoder so
     * multi-byte sequences that straddle chunk boundaries are handled
     * correctly.
     */
    iterText(chunkSize?: number): AsyncIterable<string>;
    /**
     * Iterate decoded lines. Splits on `\n` and strips trailing `\r` for
     * CR-LF inputs. The last partial line (no trailing newline) is yielded
     * on stream end.
     */
    iterLines(): AsyncIterable<string>;
    /**
     * Buffer the entire body and write it to disk in one shot.
     */
    writeToFile(path: string | URL): Promise<void>;
    /**
     * Stream body chunks to disk. Preferred over `writeToFile()` for large
     * outputs where materializing the full buffer in memory is undesirable.
     */
    streamToFile(path: string | URL, opts?: {
        chunkSize?: number;
    }): Promise<void>;
    /**
     * Cancel the underlying stream. Safe to call multiple times; swallows
     * any error thrown by the already-consumed or already-aborted stream.
     */
    close(): Promise<void>;
}

/**
 * Main completion function - Entry point for all LLM completion requests
 * Supports multiple LLM providers with a unified OpenAI-compatible interface
 */

/**
 * Perform a completion using any supported LLM provider
 * Parameters match OpenAI's chat completion API specification
 */
declare function completion(request: ChatCompletionRequestNonStreaming): Promise<ChatCompletionResponse>;
declare function completion(request: ChatCompletionRequestStreaming): Promise<AsyncGenerator<StreamChunk, void, unknown>>;
declare function completion(request: ChatCompletionRequest): Promise<ChatCompletionResponse | AsyncGenerator<StreamChunk, void, unknown>>;
/**
 * Text-to-Speech: Convert text to spoken audio
 */
declare function speech(request: {
    model: string;
    input: string;
    voice?: string | Record<string, any>;
    api_key?: string;
    api_base?: string;
    api_version?: string;
    organization?: string;
    project?: string;
    max_retries?: number;
    timeout?: number;
    custom_llm_provider?: string;
    response_format?: string;
    speed?: number;
    instructions?: string;
    headers?: Record<string, string>;
    extra_headers?: Record<string, string>;
    metadata?: Record<string, any>;
    [key: string]: any;
}): Promise<BinaryResponseContent>;
/**
 * Speech-to-Text: Transcribe audio to text
 */
declare function transcription(request: {
    model: string;
    file: FileTypes;
    language?: string;
    prompt?: string;
    response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
    timestamp_granularities?: Array<'word' | 'segment'>;
    temperature?: number;
    include?: string[];
    user?: string;
    timeout?: number;
    api_key?: string;
    api_base?: string;
    api_version?: string;
    max_retries?: number;
    custom_llm_provider?: string;
    drop_params?: boolean;
    extra_headers?: Record<string, string>;
    headers?: Record<string, string>;
    metadata?: Record<string, any>;
    [key: string]: any;
}): Promise<TranscriptionResponse>;
/**
 * Web Search: Search the web using Perplexity
 */
declare function search(request: {
    query: string | string[];
    search_provider: string;
    max_results?: number;
    search_domain_filter?: string[];
    max_tokens_per_page?: number;
    country?: string;
    api_key?: string;
    api_base?: string;
    timeout?: number;
}): Promise<SearchResponse>;

/**
 * Image API Types
 * Interfaces for image generation and editing
 */

/**
 * ImageEditInput - Accepted binary input shapes for image-edit `image` / `mask`.
 *
 * Intentionally excludes `string`: the image-edits endpoint uses
 * multipart/form-data and requires raw bytes on the wire. Base64 / data: URIs
 * must be decoded to a Buffer (or Uint8Array / Blob / File) by the caller
 * before reaching this boundary. This mirrors Python's `FileTypes` contract.
 */
type ImageEditInput = Buffer | Uint8Array | Blob | File | Array<Buffer | Uint8Array | Blob | File>;
/**
 * ImageEditOptionalRequestParams
 * Optional parameters supported by OpenAI's image edit API.
 * Params here: https://platform.openai.com/docs/api-reference/images/createEdit
 */
interface ImageEditOptionalRequestParams {
    background?: 'transparent' | 'opaque' | 'auto';
    mask?: ImageEditInput;
    n?: number;
    quality?: 'high' | 'medium' | 'low' | 'standard' | 'auto';
    response_format?: 'url' | 'b64_json';
    size?: string;
    user?: string;
}
/**
 * ImageEditRequestParams
 * Request parameters supported by OpenAI's image edit API.
 * Params here: https://platform.openai.com/docs/api-reference/images/createEdit
 */
interface ImageEditRequestParams extends ImageEditOptionalRequestParams {
    image: FileTypes;
    prompt: string;
    model?: string;
}
/**
 * Image generation request parameters
 * For gpt-image-1, gpt-image-1-mini, gpt-image-1.5, and future gpt-image-* / chatgpt-image-* models.
 *
 * `response_format` is DALL-E-only and is intentionally omitted (DALL-E series
 * is out of scope). `gpt-image-1` family uses `output_format` instead.
 */
interface ImageGenerationRequest {
    prompt: string;
    model?: string;
    n?: number;
    quality?: 'low' | 'medium' | 'high' | 'auto' | 'standard';
    size?: string;
    background?: string;
    moderation?: boolean;
    output_compression?: number;
    output_format?: string;
    user?: string;
    api_key?: string;
    api_base?: string;
    timeout?: number;
    max_retries?: number;
    organization?: string;
    drop_params?: boolean;
    extra_headers?: Record<string, string>;
    headers?: Record<string, string>;
    custom_llm_provider?: string;
}
/**
 * Image edit request parameters
 * For gpt-image-1 family and any future gpt-image-* / chatgpt-image-* models.
 *
 * `response_format` is kept here (unlike ImageGenerationRequest) because the
 * image-edits endpoint supports it on gpt-image-1.
 *
 * `image` and `mask` MUST be binary (Buffer | Uint8Array | Blob | File).
 * Strings (base64 / data: URIs) are rejected at the `imageEdit()` boundary
 * because the endpoint uses multipart/form-data and requires raw bytes —
 * sending a string would be uploaded as literal ASCII bytes and the provider
 * rejects it as an invalid image.
 */
interface ImageEditRequest {
    image: ImageEditInput;
    prompt: string;
    mask?: ImageEditInput;
    background?: string;
    input_fidelity?: string;
    model?: string;
    n?: number;
    quality?: 'low' | 'medium' | 'high' | 'auto' | 'standard';
    size?: string;
    response_format?: 'url' | 'b64_json';
    user?: string;
    api_key?: string;
    api_base?: string;
    timeout?: number;
    max_retries?: number;
    organization?: string;
    drop_params?: boolean;
    extra_headers?: Record<string, string>;
    headers?: Record<string, string>;
    custom_llm_provider?: string;
}
/**
 * Single image data in response
 */
interface ImageData {
    url?: string;
    b64_json?: string;
    revised_prompt?: string;
    provider_specific_fields?: Record<string, any>;
}
/**
 * Image usage input tokens details
 * Contains breakdown of input tokens by type
 */
interface ImageUsageInputTokensDetails {
    image_tokens: number;
    text_tokens: number;
}
/**
 * Image API usage information
 * Tracks token usage for image generation requests
 */
interface ImageUsage {
    input_tokens: number;
    /**The number of tokens (images and text) in the input prompt.*/
    input_tokens_details: ImageUsageInputTokensDetails;
    /**The input tokens detailed information for the image generation.*/
    output_tokens: number;
    /**The number of image tokens in the output image.*/
    total_tokens: number;
}
/**
 * Image API response
 */
interface ImageResponse {
    created: number;
    data: ImageData[];
    usage?: ImageUsage;
    size?: string;
    quality?: string;
    output_format?: string;
}
/**
 * Create an ImageResponse with proper defaults.
 * - `created` defaults to current Unix time when absent.
 * - `usage` null fields are zero-filled and `total_tokens` is computed when missing.
 */
declare function createImageResponse(params: {
    created?: number;
    data?: ImageData[];
    usage?: ImageUsage | Record<string, any>;
    quality?: string;
    output_format?: string;
    size?: string;
}): ImageResponse;

/**
 * Generate images from text prompts.
 * Supports OpenAI (gpt-image-1 family) and Gemini image-generation models.
 * Dispatch resolves via `ProviderConfigManager.getProviderImageGenerationConfig`
 * so any registry-backed model routes to its correct config with no per-model
 * branching here.
 */
declare function imageGeneration(request: ImageGenerationRequest): Promise<ImageResponse>;
/**
 * Edit images with text prompts.
 * Supports gpt-image-1 (OpenAI) and Gemini image models.
 * OpenAI uses multipart/form-data, Gemini uses JSON (selected via
 * `useMultipartFormData()` on the provider's config).
 */
declare function imageEdit(request: ImageEditRequest): Promise<ImageResponse>;

/**
 * Common base config for all LLM providers
 *
 * This module defines the base classes and interfaces that all provider
 * transformations must inherit from. It provides a consistent contract
 * for request/response transformation across all LLM providers.
 */

/**
 * Base exception class for all LLM provider errors
 *
 * All provider-specific exceptions should extend this class.
 */
declare class BaseLLMException extends Error {
    statusCode: number;
    message: string;
    headers?: Record<string, string>;
    request?: Request;
    response?: Response;
    body?: Record<string, any>;
    constructor(options: {
        statusCode: number;
        message: string;
        headers?: Record<string, string>;
        request?: Request;
        response?: Response;
        body?: Record<string, any>;
    });
}
/**
 * Base configuration class for all LLM providers
 *
 * This abstract class defines the contract that all provider configs must implement.
 * It provides default implementations for common functionality and requires
 * subclasses to implement provider-specific transformation logic.
 *
 * Key responsibilities:
 * - Transform requests from OpenAI format to provider format
 * - Transform responses from provider format to OpenAI format
 * - Validate environment (API keys, headers)
 * - Map OpenAI parameters to provider parameters
 * - Handle provider-specific error classes
 */
declare abstract class BaseConfig {
    constructor();
    /**
     * Get configuration as a dictionary
     *
     * Returns all non-private, non-function class attributes.
     */
    static getConfig(): Record<string, any>;
    /**
     * Get JSON schema from response format
     *
     * Converts a response format object to the appropriate JSON schema format.
     */
    getJsonSchemaFromResponseFormat(responseFormat: Record<string, any> | null | undefined): Record<string, any> | null;
    /**
     * Check if thinking/reasoning is enabled in the parameters
     */
    isThinkingEnabled(nonDefaultParams: Record<string, any>): boolean;
    /**
     * Check if max_tokens is specified in the request
     *
     * OpenAI spec allows max_tokens or max_completion_tokens to be specified.
     */
    isMaxTokensInRequest(nonDefaultParams: Record<string, any>): boolean;
    /**
     * Update optional params with thinking tokens
     *
     * Handles scenario where max tokens is not specified. For anthropic models,
     * this requires having the max tokens being set and being greater than
     * the thinking token budget.
     *
     * If 'thinking' is enabled and 'max_tokens' is not specified,
     * set 'max_tokens' to the thinking token budget + DEFAULT_MAX_TOKENS
     */
    updateOptionalParamsWithThinkingTokens(nonDefaultParams: Record<string, any>, optionalParams: Record<string, any>): void;
    /**
     * Returns True if the model/provider should fake stream
     *
     * Some providers don't support native streaming, so we need to
     * simulate it by making a non-streaming request and yielding chunks.
     */
    shouldFakeStream(model: string | null, stream: boolean | null, customLLMProvider?: string): boolean;
    /**
     * Helper util to add tools to optional_params
     */
    protected addToolsToOptionalParams(optionalParams: Record<string, any>, tools: any[]): Record<string, any>;
    /**
     * Translate `developer` role to `system` role for non-OpenAI providers.
     *
     * Overridden by OpenAI/Azure to preserve the developer role.
     */
    translateDeveloperRoleToSystemRole(messages: AllMessageValues[]): AllMessageValues[];
    /**
     * Returns True if the model/provider should retry the LLM API on HTTP error
     *
     * Overridden by providers where different models support different parameters.
     */
    shouldRetryLLMApiInsideLLMTranslationOnHttpError(error: Error, rocketllmParams: Record<string, any>): boolean;
    /**
     * Transform the request data on UnprocessableEntityError
     */
    transformRequestOnUnprocessableEntityError(error: Error, requestData: Record<string, any>): Record<string, any>;
    /**
     * Returns the max retry count for UnprocessableEntityError
     *
     * Used if `shouldRetryLLMApiInsideLLMTranslationOnHttpError` returns true.
     */
    get maxRetryOnUnprocessableEntityError(): number;
    /**
     * Get supported OpenAI parameters for this provider
     *
     * Returns a list of parameter names that this provider supports.
     * Used for parameter validation and filtering.
     */
    abstract getSupportedOpenAIParams(model: string): string[];
    /**
     * Add response format to tools
     *
     * Follow similar approach to anthropic - translate to a single tool call.
     * This is used to translate response_format to a tool call, for models/APIs
     * that don't support response_format directly.
     */
    protected addResponseFormatToTools(optionalParams: Record<string, any>, value: Record<string, any>, isResponseFormatSupported: boolean, enforceToolChoice?: boolean): Record<string, any>;
    /**
     * Map OpenAI parameters to provider-specific parameters
     *
     * Converts OpenAI-format parameters to the format expected by this provider.
     */
    abstract mapOpenAIParams(nonDefaultParams: Record<string, any>, optionalParams: Record<string, any>, model: string, dropParams: boolean): Record<string, any>;
    /**
     * Validate environment and return headers
     *
     * Validates API keys and other environment settings, and returns
     * the headers to be used in the HTTP request.
     */
    abstract validateEnvironment(headers: Record<string, string>, model: string, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, apiKey?: string, apiBase?: string | null): Record<string, string>;
    /**
     * Sign the request
     *
     * Some providers like Bedrock require signing the request.
     * The sign request function needs access to `requestData` and `completeUrl`.
     *
     * @returns Tuple of [signed headers, signed body (if any)]
     */
    signRequest(headers: Record<string, string>, optionalParams: Record<string, any>, requestData: Record<string, any>, apiBase: string, apiKey?: string, model?: string, stream?: boolean, fakeStream?: boolean): [Record<string, string>, Uint8Array | undefined];
    /**
     * Get the complete URL for the request
     *
     * Some providers need `model` in `api_base`.
     */
    getCompleteUrl(apiBase: string | null, apiKey: string | null | undefined, model: string, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, stream?: boolean): string;
    /**
     * Transform request from OpenAI format to provider format
     *
     * This is the main transformation method that converts an OpenAI-compatible
     * request to the format expected by this provider.
     */
    abstract transformRequest(model: string, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, headers: Record<string, string>): Record<string, any> | Promise<Record<string, any>>;
    /**
     * Async version of transform request
     *
     * Override to allow for http requests on async calls - e.g. converting url to base64.
     */
    asyncTransformRequest(model: string, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, headers: Record<string, string>): Promise<Record<string, any>>;
    /**
     * Transform response from provider format to OpenAI format
     *
     * Converts the provider's response to the standard OpenAI-compatible format.
     */
    abstract transformResponse(model: string, rawResponse: Response, modelResponse: ModelResponse, requestData: Record<string, any>, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, apiKey?: string, jsonMode?: boolean): ModelResponse | Promise<ModelResponse>;
    /**
     * Get the error class for this provider
     *
     * Returns a provider-specific exception instance for the given error.
     */
    abstract getErrorClass(errorMessage: string, statusCode: number, headers: Record<string, string>): BaseLLMException;
    /**
     * Get model response iterator for streaming
     *
     * Returns an iterator that yields streaming chunks from the response.
     */
    getModelResponseIterator(streamingResponse: ReadableStream<Uint8Array> | AsyncIterable<string> | ModelResponse, syncStream: boolean, jsonMode?: boolean): AsyncIterable<any> | null;
    /**
     * Custom LLM provider identifier
     */
    get customLLMProvider(): string | null;
    /**
     * Whether this provider has a custom stream wrapper
     */
    get hasCustomStreamWrapper(): boolean;
    /**
     * Whether this provider supports the stream parameter in the request body
     *
     * Some providers like Bedrock invoke do not support the stream parameter
     * in the request body. By default, this is true for almost all providers.
     */
    get supportsStreamParamInRequestBody(): boolean;
}

/**
 * Base configuration for image generation providers
 * All image generation providers must extend this class
 */

declare abstract class BaseImageGenerationConfig {
    /**
     * Get supported OpenAI parameters for the provider
     */
    abstract getSupportedOpenAIParams(model: string): string[];
    /**
     * Map OpenAI parameters to provider-specific parameters
     */
    abstract mapOpenAIParams(nonDefaultParams: Record<string, any>, optionalParams: Record<string, any>, model: string, dropParams: boolean): Record<string, any>;
    /**
     * Get complete URL for the request
     * Optional method - providers can override if needed
     */
    getCompleteUrl(apiBase: string | undefined, apiKey: string | undefined, model: string, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, stream?: boolean): string;
    /**
     * Validate environment and return headers
     * Optional method - providers can override
     */
    validateEnvironment(headers: Record<string, string>, model: string, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, apiKey?: string, apiBase?: string): Record<string, string>;
    /**
     * Get error class for provider errors
     * Returns BaseLLMException for all providers
     */
    getErrorClass(errorMessage: string, statusCode: number, headers: Record<string, string>): BaseLLMException;
    /**
     * Transform image generation request to provider format
     */
    transformImageGenerationRequest(model: string, prompt: string, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, headers: Record<string, string>): any;
    /**
     * Transform provider response to ImageResponse format
     */
    transformImageGenerationResponse(model: string, rawResponse: Response, modelResponse: any, optionalParams: Record<string, any>): Promise<any>;
}

/**
 * GPT Image Generation Transformation (gpt-image-1, gpt-image-1-mini)
 * Handles parameter mapping and validation for OpenAI image models
 */

/**
 * Configuration for gpt-image-1 and gpt-image-1-mini image generation
 */
declare class GPTImageGenerationConfig extends BaseImageGenerationConfig {
    readonly customLLMProvider = "openai";
    /**
     * Get supported OpenAI params for gpt-image-1 models
     */
    getSupportedOpenAIParams(model: string): OpenAIImageGenerationOptionalParams[];
    /**
     * Map and validate OpenAI parameters
     */
    mapOpenAIParams(nonDefaultParams: Record<string, any>, optionalParams: Record<string, any>, model: string, dropParams: boolean): Record<string, any>;
    /**
     * Transform image generation response
     * Converts raw API response to ImageResponse
     */
    transformImageGenerationResponse(model: string, rawResponse: Response, modelResponse: any, optionalParams: Record<string, any>): Promise<any>;
}

/**
 * Base Image Edit Configuration
 * Abstract base class for image edit transformations
 */

/**
 * Abstract base class for image edit configurations.
 * All provider-specific image edit configs should extend this class.
 */
declare abstract class BaseImageEditConfig {
    constructor();
    /**
     * Get configuration as a dictionary
     */
    static getConfig(): Record<string, any>;
    /**
     * Get supported OpenAI params for image edit
     */
    abstract getSupportedOpenAIParams(model: string): string[];
    /**
     * Map OpenAI params to provider-specific params
     */
    abstract mapOpenAIParams(imageEditOptionalParams: ImageEditOptionalRequestParams, model: string, dropParams: boolean): Record<string, any>;
    /**
     * Validate environment and return headers with auth
     */
    abstract validateEnvironment(headers: Record<string, string>, model: string, apiKey?: string): Record<string, string>;
    /**
     * Get complete URL for the request
     */
    abstract getCompleteUrl(model: string, apiBase: string | undefined, rocketllmParams: Record<string, any>): string;
    /**
     * Transform image edit request to provider format
     * Returns [data, files] tuple
     */
    abstract transformImageEditRequest(model: string, prompt: string, image: FileTypes, imageEditOptionalRequestParams: Record<string, any>, rocketllmParams: GenericRocketLLMParams, headers: Record<string, string>): [Record<string, any>, RequestFiles];
    /**
     * Transform raw response to ImageResponse
     */
    abstract transformImageEditResponse(model: string, rawResponse: Response): Promise<ImageResponse>;
    /**
     * Return True if the provider uses multipart/form-data for image edit requests.
     * Return False if the provider uses JSON requests.
     * Default is True for backwards compatibility with OpenAI-style providers.
     */
    useMultipartFormData(): boolean;
    /**
     * Get error class for this provider
     */
    getErrorClass(errorMessage: string, statusCode: number, headers: Record<string, string>): BaseLLMException;
}

/**
 * OpenAI Image Edit Transformation
 * Base configuration for OpenAI image edit API.
 * Used for models like gpt-image-1 that support multiple images.
 */

/**
 * OpenAI Image Edit Configuration
 * Implements BaseImageEditConfig for OpenAI gpt-image-1 and similar models
 */
declare class OpenAIImageEditConfig extends BaseImageEditConfig {
    readonly customLlmProvider = "openai";
    /**
     * All OpenAI Image Edits params are supported
     */
    getSupportedOpenAIParams(model: string): string[];
    /**
     * No mapping applied since inputs are in OpenAI spec already
     */
    mapOpenAIParams(imageEditOptionalParams: ImageEditOptionalRequestParams, model: string, dropParams: boolean): Record<string, any>;
    /**
     * Add an image to the files list with appropriate content type
     */
    private _addImageToFiles;
    /**
     * Transform image edit request to OpenAI API format.
     *
     * Handles multipart/form-data for images. Uses "image[]" field name
     * to support multiple images (e.g., for gpt-image-1).
     */
    transformImageEditRequest(model: string, prompt: string, image: FileTypes, imageEditOptionalRequestParams: Record<string, any>, rocketllmParams: GenericRocketLLMParams, headers: Record<string, string>): [Record<string, any>, RequestFiles];
    /**
     * No transform applied since outputs are in OpenAI spec already
     */
    transformImageEditResponse(model: string, rawResponse: Response): Promise<ImageResponse>;
    /**
     * Validate environment and return headers with auth
     */
    validateEnvironment(headers: Record<string, string>, model: string, apiKey?: string): Record<string, string>;
    /**
     * Get the endpoint for OpenAI image edits API
     */
    getCompleteUrl(model: string, apiBase: string | undefined, rocketllmParams: Record<string, any>): string;
}

/**
 * Google AI Imagen Configuration
 * Handles image generation for both Gemini and Imagen models
 *
 * Reference: https://ai.google.dev/gemini-api/docs/imagen
 */

declare class GoogleImageGenConfig extends BaseImageGenerationConfig {
    DEFAULT_BASE_URL: string;
    getSupportedOpenAIParams(model: string): OpenAIImageGenerationOptionalParams[];
    mapOpenAIParams(nonDefaultParams: Record<string, any>, optionalParams: Record<string, any>, model: string, dropParams: boolean): Record<string, any>;
    _mapSizeToAspectRatio(size: string): string;
    _transformImageUsage(usageMetadata: any): any;
    getCompleteUrl(apiBase: string | undefined, apiKey: string | undefined, model: string, optionalParams: Record<string, any>, litellmParams: Record<string, any>, stream?: boolean): string;
    validateEnvironment(headers: Record<string, string>, model: string, optionalParams: Record<string, any>, litellmParams: Record<string, any>, apiKey?: string, apiBase?: string): Record<string, string>;
    transformImageGenerationRequest(model: string, prompt: string, optionalParams: Record<string, any>, litellmParams: Record<string, any>, headers: Record<string, string>): Record<string, any>;
    transformImageGenerationResponse(model: string, rawResponse: Response, modelResponse: ImageResponse, optionalParams: Record<string, any>): Promise<ImageResponse>;
    private _transformImageGenerationResponse;
}

/**
 * Gemini Image Edit Configuration
 * Handles image editing using Gemini models
 */

declare class GeminiImageEditConfig extends BaseImageEditConfig {
    static readonly DEFAULT_BASE_URL: string;
    static readonly SUPPORTED_PARAMS: string[];
    constructor();
    getSupportedOpenAIParams(model: string): string[];
    mapOpenAIParams(imageEditOptionalParams: ImageEditOptionalRequestParams, model: string, dropParams: boolean): Record<string, any>;
    validateEnvironment(headers: Record<string, string>, model: string, apiKey?: string): Record<string, string>;
    getCompleteUrl(model: string, apiBase: string | undefined, rocketllmParams: Record<string, any>): string;
    transformImageEditRequest(model: string, prompt: string, image: FileTypes, imageEditOptionalRequestParams: Record<string, any>, rocketllmParams: GenericRocketLLMParams, headers: Record<string, string>): [Record<string, any>, RequestFiles];
    /**
     * Transform Gemini usageMetadata to ImageUsage format
     * Matches Python SDK's _transform_image_usage method
     */
    _transformImageUsage(usageMetadata: Record<string, any>): Record<string, any>;
    _mapSizeToAspectRatio(size: string): string;
    _prepareInlineImageParts(image: FileTypes | FileTypes[]): Array<Record<string, any>>;
    _readAllBytes(image: FileTypes): Buffer;
    /**
     * Transform image edit response from Gemini API to standard format
     */
    transformImageEditResponse(model: string, rawResponse: Response): Promise<ImageResponse>;
    /**
     * Gemini uses JSON requests, not multipart/form-data
     */
    useMultipartFormData(): boolean;
}

/**
 * rocketLLM Client - High-level API for LLM completions
 */

declare class RocketLLM {
    private options;
    private originalEnvKeys;
    constructor(options: RocketLLMOptions);
    /**
     * Setup provider-specific API keys in environment
     * This ensures the completion() function can access them
     */
    private setupProviderKeys;
    chat(request: ChatCompletionRequest): Promise<ChatCompletionResponse | AsyncGenerator<StreamChunk>>;
    private validateOptions;
    private checkBrowserSafety;
}

/**
 * Base configuration for text-to-speech providers
 * All text-to-speech providers must extend this class
 *
 * Providers should set ONE of: dictBody, ssmlBody in TextToSpeechRequestData.
 */

/**
 * Structured return type for text-to-speech transformations.
 *
 * Ensures a consistent interface across all TTS providers.
 */
interface TextToSpeechRequestData {
    dictBody?: Record<string, any>;
    ssmlBody?: string;
    headers?: Record<string, string>;
}
declare abstract class BaseTextToSpeechConfig {
    constructor();
    static getConfig(): Record<string, any>;
    abstract getSupportedOpenAIParams(model: string): string[];
    abstract mapOpenAIParams(model: string, optionalParams: Record<string, any>, voice?: string | Record<string, any> | null, dropParams?: boolean, kwargs?: Record<string, any>): [string | null, Record<string, any>];
    abstract validateEnvironment(headers: Record<string, string>, model: string, apiKey?: string, apiBase?: string): Record<string, string>;
    abstract getCompleteUrl(model: string, apiBase: string | undefined, rocketllmParams: Record<string, any>): string;
    abstract transformTextToSpeechRequest(model: string, input: string, voice: string | undefined, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, headers: Record<string, string>): TextToSpeechRequestData;
    abstract transformTextToSpeechResponse(model: string, rawResponse: Response): Promise<BinaryResponseContent>;
    getErrorClass(errorMessage: string, statusCode: number, headers: Record<string, string>): BaseLLMException;
}

interface AudioTranscriptionRequestData {
    data: Record<string, any>;
    files?: Record<string, any>;
    contentType?: string;
}
declare abstract class BaseAudioTranscriptionConfig extends BaseConfig {
    abstract getSupportedOpenAIParams(model: string): string[];
    getCompleteUrl(apiBase: string | null, apiKey: string | null | undefined, model: string, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, stream?: boolean): string;
    abstract transformAudioTranscriptionRequest(model: string, audioFile: FileTypes, optionalParams: Record<string, any>, rocketllmParams: Record<string, any>): AudioTranscriptionRequestData;
    transformAudioTranscriptionResponse(rawResponse: any): TranscriptionResponse;
    transformRequest(model: string, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, headers: Record<string, string>): Record<string, any>;
    transformResponse(model: string, rawResponse: any, modelResponse: ModelResponse, requestData: Record<string, any>, messages: AllMessageValues[], optionalParams: Record<string, any>, rocketllmParams: Record<string, any>, apiKey?: string, jsonMode?: boolean): ModelResponse;
    getProviderSpecificParams(model: string, optionalParams: Record<string, any>, openaiParams: string[]): Record<string, any>;
    private _shouldExcludeParam;
}

/**
 * Global SDK behavior switches — `dropParams` and `modifyParams`.
 *
 * =============================================================================
 * WHY A NESTED CONFIG OBJECT AND NOT A BARE TOP-LEVEL GLOBAL?
 * =============================================================================
 *
 * The original design intent was to expose these flags as bare module-level
 * globals so users could write:
 *
 *   import * as rocketllm from '@rocketnew/llm-sdk';
 *   rocketllm.modifyParams = true;
 *
 * That pattern is idiomatic in Python (where module attributes are plain
 * mutable properties on the module object) but it does NOT work in ES
 * Modules. ESM specifies that `export let` bindings are one-way: live for
 * READS, but **read-only from outside the declaring module**. Attempting
 * `rocketllm.modifyParams = true` raises:
 *
 *   TypeError: Cannot set property modifyParams of [object Module]
 *              which has only a getter
 *
 * We therefore expose a single `config` object whose properties are plain
 * booleans. Users mutate it with ordinary property assignment:
 *
 *   import * as rocketllm from '@rocketnew/llm-sdk';
 *   rocketllm.config.modifyParams = true;
 *
 *   // or, shorter:
 *   import { config } from '@rocketnew/llm-sdk';
 *   config.modifyParams = true;
 *
 * This mirrors the pattern used by every other production ESM SDK that needs
 * mutable global config — `axios.defaults`, `mongoose.options`, etc. The
 * single extra nesting level (`.config.`) is the cost of ESM compliance; the
 * behavior is otherwise identical to direct attribute assignment.
 *
 * Internal reader code (in `utils.ts`, `transformation.ts`, `factory.ts`,
 * `common_utils.ts`, `images/utils.ts`) always goes through `config.xxx`, so
 * writes are observed on the next read with no caching or staleness issues.
 *
 * =============================================================================
 * INPUT PATHS
 * =============================================================================
 *
 * 1. Env vars read once at module load:
 *      ROCKETLLM_DROP_PARAMS=true
 *      ROCKETLLM_MODIFY_PARAMS=true
 *
 * 2. Runtime mutation (any time after import):
 *      config.dropParams = true;
 *      config.modifyParams = true;
 *
 * =============================================================================
 * CONCURRENCY NOTE
 * =============================================================================
 *
 * This is a process-wide object. In concurrent Node servers set the flags
 * once at boot rather than flipping them per-request — otherwise one
 * request's value can leak into another request that is waiting on I/O.
 * Callers who need per-request behavior should either run multiple isolated
 * worker processes or avoid mutating these flags at request time.
 */
/**
 * Shape of the shared global-config object.
 *
 * Keep field names in `snake_case`-equivalent camelCase so they match the
 * user-facing API we document (e.g. `config.modifyParams`, not
 * `config.modify_params`). Readers in the SDK read via `config.xxx`.
 */
interface RocketLLMConfig {
    /**
     * When `true`, unsupported OpenAI-shape params are silently dropped
     * instead of raising `UnsupportedParamsError`.
     */
    dropParams: boolean;
    /**
     * When `true`, the SDK may silently repair common message-shape issues
     * that would otherwise cause the provider API to reject the request:
     *   - insert a dummy user message when messages=[]
     *   - inject dummy tool_result blocks for orphaned tool_calls
     *   - drop orphaned tool_result blocks
     *   - replace empty/whitespace string content with a placeholder
     *   - de-duplicate tool_result messages sharing a tool_call_id
     *   - auto-inject a dummy tool when history has tool_use but caller did
     *     not pass `tools=`
     *   - drop `thinking` from requests that lack prior `thinking_blocks`
     */
    modifyParams: boolean;
}
/**
 * Process-wide SDK configuration.
 *
 * Mutate via ordinary property assignment:
 *   config.modifyParams = true;
 *
 * Initialized from env vars at module load. Pre-import env var changes have
 * no effect on an already-loaded module; mutate `config` directly at runtime
 * instead.
 */
declare const config: RocketLLMConfig;

/**
 * Utility functions for RocketLLM
 * Contains parameter processing and validation utilities
 */

/**
 * ProviderConfigManager - Centralized manager for provider configs
 *
 * Returns the appropriate config class based on provider and model.
 * Implements provider config management pattern.
 */
declare class ProviderConfigManager {
    /**
     * Dictionary mapping for O(1) provider lookup.
     * Stores tuples of [factoryFunction, needsModelParameter].
     * Lazy-initialized on first access to avoid circular import issues.
     */
    private static _PROVIDER_CONFIG_MAP;
    /**
     * Build the provider-to-config mapping dictionary.
     *
     * Format: each entry is [factoryFn, needsModelParameter].
     *   - factoryFn: () => BaseConfig, or (model) => BaseConfig when
     *     needsModelParameter is true (e.g. future Azure/Vertex configs).
     *   - needsModelParameter: all current providers are simple factories
     *     (needsModel=false). The flag is retained for future extension.
     */
    private static _buildProviderConfigMap;
    /**
     * Get the provider chat config for a given model and provider
     *
     * @param model - The model name
     * @param provider - The provider enum value
     * @returns The appropriate config instance or null if not found
     */
    static getProviderChatConfig(model: string, provider: RocketLLMProviders): BaseConfig | null;
    /**
     * Get the provider image edit config for a given model and provider
     *
     * @param model - The model name
     * @param provider - The provider enum value
     * @returns The appropriate image edit config instance or null if not found
     */
    static getProviderImageEditConfig(model: string, provider: RocketLLMProviders): any | null;
    /**
     * Get the provider image generation config for a given model and provider.
     *
     * OpenAI dispatch is intentionally a single catch-all: `GPTImageGenerationConfig`
     * covers gpt-image-1, gpt-image-1-mini, gpt-image-1.5, chatgpt-image-latest
     * and any future `gpt-image-N.N` or `chatgpt-image-*` entries. DALL-E is out of scope.
     *
     * @param model - The model name
     * @param provider - The provider enum value
     * @returns The appropriate image generation config instance or null if not found
     */
    static getProviderImageGenerationConfig(model: string, provider: RocketLLMProviders): any | null;
    static getProviderTextToSpeechConfig(model: string, provider: RocketLLMProviders): BaseTextToSpeechConfig | null;
    static getProviderAudioTranscriptionConfig(model: string, provider: RocketLLMProviders): BaseAudioTranscriptionConfig | null;
}
declare function getOptionalParamsTranscription(model: string, customLLMProvider: string, language?: string | null, prompt?: string | null, responseFormat?: string | null, temperature?: number | null, timestampGranularities?: Array<'word' | 'segment'> | null, dropParams?: boolean | null, kwargs?: Record<string, any>): Record<string, any>;
/**
 * Default values for chat completion parameters
 * Used to determine which params were explicitly set vs defaulted
 */
declare const DEFAULT_CHAT_COMPLETION_PARAM_VALUES: Record<string, any>;

/**
 * Pre-process non-default params to a standardized format
 * Filters out params that match default values
 */
declare function preProcessNonDefaultParams(passedParams: Record<string, any>, specialParams: Record<string, any>, customLLMProvider: string, additionalDropParams?: string[] | null): Record<string, any>;
/**
 * Pre-process optional params
 * Initializes the optional params dict that will be populated by map_openai_params
 */
declare function preProcessOptionalParams(passedParams: Record<string, any>, nonDefaultParams: Record<string, any>, customLLMProvider: string): Record<string, any>;
/**
 * Get optional params for completion requests
 * Maps OpenAI-style parameters to provider-specific parameters
 *
 * This is the main entry point for parameter processing
 */
declare function getOptionalParams(model: string, functions?: any, functionCall?: any, temperature?: number | null, topP?: number | null, n?: number | null, stream?: boolean, streamOptions?: any, stop?: string | string[] | null, maxTokens?: number | null, maxCompletionTokens?: number | null, modalities?: any, prediction?: any, audio?: any, presencePenalty?: number | null, frequencyPenalty?: number | null, logitBias?: Record<string, number> | null, user?: string | null, customLLMProvider?: string, responseFormat?: any, seed?: number | null, tools?: any[] | null, toolChoice?: any, maxRetries?: number | null, logprobs?: boolean | null, topLogprobs?: number | null, extraHeaders?: Record<string, string> | null, apiVersion?: string | null, parallelToolCalls?: boolean | null, dropParamsOverride?: boolean | null, allowedOpenAIParams?: string[] | null, reasoningEffort?: string | null, thinking?: any, webSearchOptions?: any, messages?: any[] | null, specialParams?: Record<string, any>): Record<string, any>;

/**
 * Get supported OpenAI params for different providers
 */
/**
 * Returns the supported OpenAI params for a given model + provider
 */
declare function getSupportedOpenAIParams(model: string, customLLMProvider?: string): string[] | null;

/**
 * RocketLLM Exception Types
 */
declare class AuthenticationError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class NotFoundError extends Error {
    statusCode: number;
    message: string;
    model: string;
    llmProvider: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, model: string, llmProvider: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class BadRequestError extends Error {
    statusCode: number;
    message: string;
    model: string;
    llmProvider: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    body?: Record<string, any>;
    constructor(message: string, model: string, llmProvider: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number, body?: Record<string, any>);
    toString(): string;
}
declare class ImageFetchError extends BadRequestError {
    constructor(message: string, model?: string, llmProvider?: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number, body?: Record<string, any>);
}
declare class UnprocessableEntityError extends Error {
    statusCode: number;
    message: string;
    model: string;
    llmProvider: string;
    response: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, model: string, llmProvider: string, response: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class Timeout extends Error {
    statusCode: number;
    message: string;
    model: string;
    llmProvider: string;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    headers?: Record<string, any>;
    constructor(message: string, model: string, llmProvider: string, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number, headers?: Record<string, any>, exceptionStatusCode?: number);
    toString(): string;
}
declare class PermissionDeniedError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class RateLimitError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class ContextWindowExceededError extends BadRequestError {
    constructor(message: string, model: string, llmProvider: string, response?: Response, rocketllmDebugInfo?: string);
}
declare class ContentPolicyViolationError extends BadRequestError {
    providerSpecificFields?: Record<string, any>;
    constructor(message: string, model: string, llmProvider: string, response?: Response, rocketllmDebugInfo?: string, providerSpecificFields?: Record<string, any>);
}
declare class ServiceUnavailableError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class BadGatewayError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class InternalServerError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    response?: Response;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class APIError extends Error {
    statusCode: number;
    message: string;
    llmProvider: string;
    model: string;
    request?: Request;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(statusCode: number, message: string, llmProvider: string, model: string, request?: Request, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class APIConnectionError extends Error {
    message: string;
    llmProvider: string;
    model: string;
    statusCode: number;
    request?: Request;
    rocketllmDebugInfo?: string;
    maxRetries?: number;
    numRetries?: number;
    constructor(message: string, llmProvider: string, model: string, request?: Request, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
    toString(): string;
}
declare class ConfigurationError extends Error {
    constructor(message: string);
}
declare class ProviderNotFoundError extends Error {
    constructor(model: string);
}
declare class UnsupportedParamsError extends BadRequestError {
    constructor(message: string, llmProvider?: string, model?: string, statusCode?: number, response?: Response, rocketllmDebugInfo?: string, maxRetries?: number, numRetries?: number);
}
declare const ROCKETLLM_EXCEPTION_TYPES: (typeof AuthenticationError | typeof BadRequestError | typeof Timeout | typeof ContentPolicyViolationError | typeof APIError | typeof APIConnectionError | typeof UnsupportedParamsError)[];

/**
 * RocketLLM - Universal LLM SDK for JavaScript/TypeScript
 *
 * Works in two modes:
 * 1. Proxy mode - Routes requests through your proxy server
 * 2. Direct mode - Full featured with provider detection and transformation
 */

declare const VERSION = "1.0.0";
declare let useRocketLLMProxy: boolean;

export { APIConnectionError, APIError, AuthenticationError, BadGatewayError, BadRequestError, BaseConfig, BinaryResponseContent, type CacheCreationTokenDetails, type ChatCompletionAssistantMessageParam, type ChatCompletionContentPartImageParam, type ChatCompletionContentPartParam, type ChatCompletionContentPartTextParam, type ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionMessageParam, type ChatCompletionMessageParam, type ChatCompletionMessageToolCallParam, type ChatCompletionRequest, type ChatCompletionRequestNonStreaming, type ChatCompletionRequestStreaming, type ChatCompletionResponse, type ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob, type ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam, type ChoiceLogprobs, type Choices, type CompletionRequest, type CompletionTokensDetails, type CompletionTokensDetailsWrapper, ConfigurationError, type ContentBlock, ContentPolicyViolationError, ContextWindowExceededError, DEFAULT_CHAT_COMPLETION_PARAM_VALUES, type Delta, type DocumentContentBlock, type FileContentBlock, type FileTypes, type Function, type FunctionCall, GPTImageGenerationConfig, GeminiImageEditConfig, type GenericImageParsingChunk, type GenericRocketLLMParams, type GenericStreamingChunk, GoogleImageGenConfig, type ImageData, type ImageEditInput, type ImageEditOptionalRequestParams, type ImageEditRequest, type ImageEditRequestParams, ImageFetchError, type ImageGenerationRequest, type ImageResponse, type ImageURL, type ImageURLContentBlock, type ImageUsage, type ImageUsageInputTokensDetails, InternalServerError, type LLMProvider, type Message, type ModelResponse, type ModelResponseBase, type ModelResponseStream, NotFoundError, OpenAIImageEditConfig, PermissionDeniedError, type PromptTokensDetails, type PromptTokensDetailsWrapper, ProviderConfigManager, ProviderNotFoundError, type ProviderSpecificHeader, ROCKETLLM_EXCEPTION_TYPES, RateLimitError, type RequestFiles, type ResponseFormat, type ResponseFormatChunk, type ResponseFunctionCall, type ResponseMessage, RocketLLM, type RocketLLMConfig, type RocketLLMOptions, RocketLLMProviders, type ServerToolUse, ServiceUnavailableError, type StreamChunk, type StreamingChoices, type TextContentBlock, type ThinkingContentBlock, Timeout, type TopLogprob, type TranscriptionResponse, type TranscriptionUsageDurationObject, type TranscriptionUsageInputTokenDetailsObject, type TranscriptionUsageTokensObject, UnprocessableEntityError, UnsupportedParamsError, Usage, type UsageInfo, type UsageParams, VERSION, completion, config, createImageResponse, generateId, getOptionalParams, getOptionalParamsTranscription, getSupportedOpenAIParams, imageEdit, imageGeneration, preProcessNonDefaultParams, preProcessOptionalParams, search, speech, transcription, useRocketLLMProxy };
