/** Supported AI providers */
export type Provider = "openai" | "gemini";
/** Image input: URL, local file path, or base64-encoded string */
export type ImageInput = string | Buffer;
/** Configuration for creating an AltImageClient */
export interface AltImageClientOptions {
/** AI provider to use */
provider: Provider;
/** API key for the chosen provider */
apiKey: string;
/** Model to use (defaults to provider's recommended vision model) */
model?: string;
/** Language for the generated alt text (e.g. "en", "es", "fr") */
language?: string;
/** Maximum character length for the alt text */
maxLength?: number;
/** Custom prompt to guide the AI generation */
customPrompt?: string;
}
/** Options for a single generateAlt call (overrides client defaults) */
export interface GenerateAltOptions {
/** Language for the generated alt text */
language?: string;
/** Maximum character length for the alt text */
maxLength?: number;
/** Custom prompt to guide the AI generation */
customPrompt?: string;
}
/** Options for HTML processing */
export interface ProcessHTMLOptions extends GenerateAltOptions {
/** Only process
tags that are missing alt attributes (default: true) */
onlyMissing?: boolean;
/** Override existing alt attributes (default: false) */
overrideExisting?: boolean;
}
/** Result of a single alt text generation */
export interface AltResult {
/** The generated alt text */
alt: string;
/** The image source that was processed */
src: string;
}
/** Result of a batch operation */
export interface BatchResult {
/** Successfully generated results */
results: AltResult[];
/** Errors encountered during processing */
errors: BatchError[];
}
/** Error from a batch operation */
export interface BatchError {
/** The image source that failed */
src: string;
/** The error that occurred */
error: Error;
}
/** Internal interface for AI provider implementations */
export interface AIProvider {
/** Generate alt text for an image */
generateAlt(imageBase64: string, mimeType: string, prompt: string): Promise;
}