import { LanguageModelV3 } from '@ai-sdk/provider';
import { FetchFunction } from '@ai-sdk/provider-utils';

declare class AiGatewayInternalFetchError extends Error {
}
declare class AiGatewayDoesNotExist extends Error {
}
declare class AiGatewayUnauthorizedError extends Error {
}
type InternalLanguageModelV3 = LanguageModelV3 & {
    config?: {
        fetch?: FetchFunction | undefined;
    };
};
declare class AiGatewayChatLanguageModel implements LanguageModelV3 {
    readonly specificationVersion = "v3";
    readonly defaultObjectGenerationMode = "json";
    readonly supportedUrls: Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
    readonly models: InternalLanguageModelV3[];
    readonly config: AiGatewaySettings;
    get modelId(): string;
    get provider(): string;
    constructor(models: LanguageModelV3[], config: AiGatewaySettings);
    processModelRequest<T extends LanguageModelV3["doStream"] | LanguageModelV3["doGenerate"]>(options: Parameters<T>[0], modelMethod: "doStream" | "doGenerate"): Promise<Awaited<ReturnType<T>>>;
    doStream(options: Parameters<LanguageModelV3["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doStream"]>>>;
    doGenerate(options: Parameters<LanguageModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doGenerate"]>>>;
}
interface AiGateway {
    (models: LanguageModelV3 | LanguageModelV3[]): LanguageModelV3;
    chat(models: LanguageModelV3 | LanguageModelV3[]): LanguageModelV3;
}
type AiGatewayReties = {
    maxAttempts?: 1 | 2 | 3 | 4 | 5;
    retryDelayMs?: number;
    backoff?: "constant" | "linear" | "exponential";
};
type AiGatewayOptions = {
    cacheKey?: string;
    cacheTtl?: number;
    skipCache?: boolean;
    metadata?: Record<string, number | string | boolean | null | bigint>;
    collectLog?: boolean;
    eventId?: string;
    requestTimeoutMs?: number;
    retries?: AiGatewayReties;
};
type AiGatewayAPISettings = {
    gateway: string;
    accountId: string;
    apiKey?: string;
    options?: AiGatewayOptions;
};
type AiGatewayBindingSettings = {
    binding: {
        run(data: unknown): Promise<Response>;
    };
    options?: AiGatewayOptions;
};
type AiGatewaySettings = AiGatewayAPISettings | AiGatewayBindingSettings;
declare function createAiGateway(options: AiGatewaySettings): AiGateway;
declare function parseAiGatewayOptions(options: AiGatewayOptions): Headers;

export { type AiGateway, type AiGatewayAPISettings, type AiGatewayBindingSettings, AiGatewayChatLanguageModel, AiGatewayDoesNotExist, AiGatewayInternalFetchError, type AiGatewayOptions, type AiGatewayReties, type AiGatewaySettings, AiGatewayUnauthorizedError, createAiGateway, parseAiGatewayOptions };
