/**
 * OpenAI-compatible image provider factory.
 *
 * Many image providers (OpenAI, Azure OpenAI, OpenAI-compatible gateways)
 * speak the same `/images/generations` and `/images/edits` REST shape.
 * This factory wraps that wire format on top of shared provider HTTP, normalization,
 * and auth-runtime so vendor modules only need to declare:
 *   - id / aliases / models / capabilities
 *   - baseUrl resolution
 *   - apiKey resolution
 *   - optional request body / response transforms
 *
 */
import type { ImageProviderUiMetadata } from './image-provider-ui.js';
import type { GeneratedImageAsset, ImageGenerationProvider, ImageGenerationProviderCapabilities, ImageGenerationProviderConfiguredContext, ImageGenerationRequest } from './types.js';
/** Subset of the official OpenAI image response we map. */
export interface OpenAiCompatibleImageResponse {
    data?: Array<{
        b64_json?: string;
        revised_prompt?: string;
        [k: string]: unknown;
    }>;
    [k: string]: unknown;
}
export interface OpenAiCompatibleEndpointResolution {
    /** Base URL without trailing slash, e.g. `https://api.openai.com/v1`. */
    baseUrl: string;
    /** Optional override for the generations sub-path; defaults to `/images/generations`. */
    generationsPath?: string;
    /** Optional override for the edits sub-path; defaults to `/images/edits`. */
    editsPath?: string;
    /** Extra headers merged into the request (e.g. `api-key` for Azure). */
    headers?: Record<string, string>;
    /**
     * Override Authorization header logic. When omitted, the factory adds
     * `Authorization: Bearer <apiKey>` if `apiKey` is present.
     */
    authorization?: {
        kind: 'none';
    } | {
        kind: 'bearer';
    } | {
        kind: 'header';
        headerName: string;
    };
}
export interface OpenAiCompatibleImageProviderOptions {
    id: string;
    aliases?: string[];
    label?: string;
    defaultModel: string;
    models: string[];
    capabilities: ImageGenerationProviderCapabilities;
    /** Sync env / cfg lookup that decides if the provider has any usable credential. */
    isConfigured: (ctx: ImageGenerationProviderConfiguredContext) => boolean;
    /** Resolve API key for one request. May return null when using OAuth/header auth. */
    resolveApiKey: (req: ImageGenerationRequest) => string | null | undefined;
    /** Resolve endpoint info per-request (region, baseUrl override, Azure deployment, …). */
    resolveEndpoint: (req: ImageGenerationRequest) => OpenAiCompatibleEndpointResolution;
    /** Default per-call timeout. Combined with provider-level config in provider-http. */
    defaultTimeoutMs?: number;
    /**
     * Hook to enrich the JSON body sent to `/images/generations`. Mutate the
     * returned object freely; the factory keeps standard fields stable.
     */
    buildGenerateRequestBody?: (req: ImageGenerationRequest, base: Record<string, unknown>) => Record<string, unknown>;
    /** Hook to enrich the multipart form for `/images/edits`. */
    buildEditFormFields?: (req: ImageGenerationRequest, fields: Record<string, string>) => Record<string, string>;
    /**
     * Optional response mapper. Default: `mapDefaultOpenAiResponse`. Vendor
     * implementations can override to handle non-standard response shapes.
     */
    mapResponse?: (raw: unknown, req: ImageGenerationRequest) => GeneratedImageAsset[];
    /** Default count clamp. Provider may also enforce via `capabilities.generate.maxCount`. */
    defaultCount?: number;
    defaultSize?: string;
    /** Gateway console presets for `cfg.providers.<id>.baseUrl`. */
    ui?: ImageProviderUiMetadata;
}
export declare function createOpenAiCompatibleImageProvider(options: OpenAiCompatibleImageProviderOptions): ImageGenerationProvider;
export declare function mapDefaultOpenAiResponse(raw: unknown, req: ImageGenerationRequest): GeneratedImageAsset[];
