import { LanguageModelV1 } 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 InternalLanguageModelV1 = LanguageModelV1 & {
    config?: {
        fetch?: FetchFunction | undefined;
    };
};
declare class AiGatewayChatLanguageModel implements LanguageModelV1 {
    readonly specificationVersion = "v1";
    readonly defaultObjectGenerationMode = "json";
    readonly models: InternalLanguageModelV1[];
    readonly config: AiGatewaySettings;
    get modelId(): string;
    get provider(): string;
    constructor(models: LanguageModelV1[], config: AiGatewaySettings);
    processModelRequest<T extends LanguageModelV1["doStream"] | LanguageModelV1["doGenerate"]>(options: Parameters<T>[0], modelMethod: "doStream" | "doGenerate"): Promise<Awaited<ReturnType<T>>>;
    doStream(options: Parameters<LanguageModelV1["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV1["doStream"]>>>;
    doGenerate(options: Parameters<LanguageModelV1["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV1["doGenerate"]>>>;
}
interface AiGateway {
    (models: LanguageModelV1 | LanguageModelV1[]): LanguageModelV1;
    chat(models: LanguageModelV1 | LanguageModelV1[]): LanguageModelV1;
}
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 };
