export declare const DEFAULT_OPENAI_IMAGE_MODEL = "gpt-image-2";
export declare const DEFAULT_OPENAI_IMAGES_BASE_URL = "https://api.openai.com/v1";
export declare const DEFAULT_OPENAI_API_KEY_ENV = "OPENAI_API_KEY";
export declare const OPENAI_IMAGE_API_KEY_ACTION = "Use an OpenAI Platform project API key: create it through Platform OAuth, keep any encrypted copy outside the repo, decrypt only locally, run one command with OPENAI_API_KEY=<ephemeral>, then unset the env/temp key. Codex/ChatGPT OAuth tokens are only for login and cannot call the Images API.";
export type OpenAiImageOperation = "generate" | "edit";
export type OpenAiImageErrorKind = "auth" | "permission" | "billing" | "rate_limit" | "moderation" | "api" | "network" | "invalid_response";
export type OpenAiImageFetch = typeof fetch;
export interface OpenAiImageClientOptions {
    apiKey: string;
    fetch?: OpenAiImageFetch;
    baseUrl?: string;
    timeoutMs?: number;
}
export interface OpenAiImageRequestOptions {
    model?: string;
    size?: string;
    quality?: string;
    background?: string;
    outputFormat?: "png" | "jpeg" | "webp";
    n?: number;
    user?: string;
}
export interface GenerateImageOptions extends OpenAiImageRequestOptions {
    prompt: string;
}
export interface EditImageOptions extends OpenAiImageRequestOptions {
    prompt: string;
    imagePaths: string[];
    maskPath?: string;
}
export interface OpenAiImageResult {
    operation: OpenAiImageOperation;
    model: string;
    image: Buffer;
    mimeType: string;
    outputFormat: "png" | "jpeg" | "webp";
    created?: number;
    usage?: unknown;
    promptHash: string;
    promptLength: number;
    imageCount?: number;
    maskProvided?: boolean;
}
export interface SavedOpenAiImageResult extends OpenAiImageResult {
    imagePath: string;
    metadataPath: string;
    relativeImagePath: string;
    relativeMetadataPath: string;
}
export interface OpenAiImageMetadata {
    createdAt: string;
    operation: OpenAiImageOperation;
    provider: "openai";
    model: string;
    output: {
        path: string;
        mimeType: string;
        bytes: number;
    };
    request: {
        promptSha256: string;
        promptLength: number;
        size?: string;
        quality?: string;
        background?: string;
        outputFormat: string;
        n: number;
        imageCount?: number;
        maskProvided?: boolean;
    };
    response: {
        created?: number;
        usage?: unknown;
    };
}
export declare class OpenAiImageError extends Error {
    readonly kind: OpenAiImageErrorKind;
    readonly status?: number;
    readonly action: string;
    constructor(message: string, options: {
        kind: OpenAiImageErrorKind;
        action: string;
        status?: number;
    });
}
export declare class OpenAiImageClient {
    private readonly apiKey;
    private readonly fetchImpl;
    private readonly baseUrl;
    private readonly timeoutMs;
    constructor(options: OpenAiImageClientOptions);
    generate(options: GenerateImageOptions): Promise<OpenAiImageResult>;
    edit(options: EditImageOptions): Promise<OpenAiImageResult>;
    private requestJson;
    private requestForm;
    private request;
    private toImageResult;
    private downloadImage;
}
export declare function resolveOpenAiApiKey(env?: NodeJS.ProcessEnv, envName?: string): string;
export declare function isOpenAiPlatformApiKey(credential: string): boolean;
export declare function isLikelyOpenAiOAuthCredential(credential: string): boolean;
export declare function saveOpenAiImageResult(root: string, result: OpenAiImageResult, options?: OpenAiImageRequestOptions, now?: Date): Promise<SavedOpenAiImageResult>;
