/**
 * Shared provider HTTP client (voice, STT/TTS, image-generation extensions).
 *
 * Wraps `globalThis.fetch` with SSRF guard (`assertSafeUrl`), timeout + signal
 * merge, and standardized errors via `assertOkOrThrowProviderError`.
 */
import { type SsrfGuardOptions } from './ssrf-guard.js';
export interface ProviderHttpRequestConfig extends SsrfGuardOptions {
    /** Hard timeout in milliseconds. Required: callers must always specify. */
    timeoutMs: number;
    /** Extra abort signal (e.g. from caller cancellation). Merged with timeout signal. */
    signal?: AbortSignal;
    /**
     * Label used in thrown ProviderHttpError messages. Should look like
     * "OpenAI TTS", "dashscope", or "Alibaba paraformer-v2 transcription".
     */
    label: string;
}
export interface FetchWithGuardOptions extends ProviderHttpRequestConfig {
    /** Pre-built RequestInit; URL is the first positional argument. */
    init?: RequestInit;
}
/**
 * fetch + SSRF guard + timeout. Returns the raw Response (caller decides whether
 * to assertOk / parse / stream). Throws SsrfBlockedError on guard failure.
 */
export declare function fetchWithTimeoutGuarded(url: string | URL, options: FetchWithGuardOptions): Promise<Response>;
export interface PostJsonRequestOptions extends ProviderHttpRequestConfig {
    body: unknown;
    headers?: Record<string, string> | Headers;
}
export declare function postJsonRequest(url: string | URL, options: PostJsonRequestOptions): Promise<Response>;
export interface PostMultipartRequestOptions extends ProviderHttpRequestConfig {
    body: FormData;
    headers?: Record<string, string> | Headers;
}
export declare function postMultipartRequest(url: string | URL, options: PostMultipartRequestOptions): Promise<Response>;
export interface GetJsonRequestOptions extends ProviderHttpRequestConfig {
    headers?: Record<string, string> | Headers;
}
export declare function getJsonRequest(url: string | URL, options: GetJsonRequestOptions): Promise<Response>;
/**
 * Normalize a base URL: trim trailing slash, force http(s) scheme.
 */
export declare function normalizeBaseUrl(baseUrl: string): string;
export interface ProviderOperationDeadline {
    deadlineMs: number;
    assertNotExpired(): void;
    remainingMs(): number;
}
export declare function createProviderOperationDeadline(timeoutMs: number): ProviderOperationDeadline;
export declare function waitProviderOperationPollInterval(intervalMs: number, signal?: AbortSignal): Promise<void>;
