/// <reference types="node" />
import type { Agent } from 'node:http';
import { APIResponseType, ApiClientInterface, Headers } from './_types/generalTypes';
import { APIError } from './error';
export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
export type HTTPMethod = 'post' | 'get' | 'put' | 'delete';
export type FinalRequestOptions = RequestOptions & {
    method: HTTPMethod;
    path: string;
};
export type RequestOptions = {
    method?: HTTPMethod;
    path?: string;
    query?: Record<string, any> | undefined;
    body?: Record<string, any> | undefined;
    headers?: Headers | undefined;
    httpAgent?: Agent;
    stream?: boolean | undefined;
    signal?: AbortSignal | undefined | null;
    extraHeaders?: Record<string, string>;
};
type APIResponseProps = {
    response: Response;
    options: FinalRequestOptions;
    responseHeaders: globalThis.Headers;
};
type PromiseOrValue<T> = T | Promise<T>;
export declare class APIPromise<T> extends Promise<T> {
    private responsePromise;
    private parseResponse;
    private parsedPromise;
    constructor(responsePromise: Promise<APIResponseProps>, parseResponse?: (props: APIResponseProps) => PromiseOrValue<T>);
    private parse;
    then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
    catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
    finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}
export declare abstract class ApiClient {
    apiKey: string | null;
    baseURL: string;
    customHeaders: Record<string, string>;
    responseHeaders: Record<string, string>;
    portkeyHeaders: Record<string, string>;
    maxRetries: number;
    private fetch;
    constructor({ apiKey, baseURL, config, virtualKey, traceID, metadata, provider, Authorization, cacheForceRefresh, debug, customHost, openaiProject, openaiOrganization, awsSecretAccessKey, awsAccessKeyId, awsSessionToken, awsRegion, vertexProjectId, vertexRegion, workersAiAccountId, azureResourceName, azureDeploymentId, azureApiVersion, azureEndpointName, huggingfaceBaseUrl, forwardHeaders, cacheNamespace, requestTimeout, strictOpenAiCompliance, anthropicBeta, anthropicVersion, mistralFimCompletion, dangerouslyAllowBrowser, vertexStorageBucketName, providerFileName, providerModel, awsS3Bucket, awsS3ObjectKey, awsBedrockModel, fireworksAccountId, ...rest }: ApiClientInterface);
    protected defaultHeaders(): Record<string, string>;
    _post<Rsp extends APIResponseType>(path: string, opts?: RequestOptions): APIPromise<Rsp>;
    _put<Rsp extends APIResponseType>(path: string, opts?: RequestOptions): APIPromise<Rsp>;
    _get<Rsp extends APIResponseType>(path: string, opts?: RequestOptions): APIPromise<Rsp>;
    _delete<Rsp extends APIResponseType>(path: string, opts?: RequestOptions): APIPromise<Rsp>;
    protected generateError(status: number | undefined, errorResponse: object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
    _shouldRetry(response: Response): boolean;
    request(opts: FinalRequestOptions, retryCount?: number): Promise<APIResponseProps>;
    buildRequest(opts: FinalRequestOptions): {
        req: RequestInit;
        url: string;
    };
    methodRequest<Rsp>(method: HTTPMethod, path: string, opts?: RequestOptions): APIPromise<Rsp>;
}
export {};
