/** * Diegetic still-asset generation for in-world UI graphics — props, on-screen * dashboards, motion-graphic overlays — the kind the reference advert used (a * "Settlement Report Dashboard", a "SYSTEM COMPROMISED" alert) inside shots. * vclaw generates character frames and storyboard grids elsewhere; this module * covers ARBITRARY prop / screen / overlay graphics. * * Three interchangeable backends, selected by `backend`: * - `gobananas` (DEFAULT): the same image API `character-auto-create.ts` uses * (`POST ${apiUrl}/images`, no OpenAI key). Reads the returned image URL and * downloads it to disk, honoring the served file's REAL extension. * - `openai`: the OpenAI Images API (`POST /v1/images/generations`, gpt-image-1 / * the "gpt-image-2" family), returning `{ data: [{ b64_json }] }` decoded to disk. * - `flow`: Google Flow via useapi.net (`POST /google-flow/images`, imagen-4 / * nano-banana / nano-banana-pro) with reference_1..10 + character_1..7 slots * and inline @-marker validation — see `gen-image-flow.ts`. * * The fetcher is injectable so request composition, URL/b64 extraction, and the * download/decode are fully testable offline. */ export declare const GEN_IMAGE_KINDS: readonly ["prop", "screen", "overlay"]; export type GenImageKind = typeof GEN_IMAGE_KINDS[number]; export declare const GEN_IMAGE_BACKENDS: readonly ["gobananas", "openai", "flow"]; export type GenImageBackend = typeof GEN_IMAGE_BACKENDS[number]; /** The proven default backend (no OpenAI key required). */ export declare const DEFAULT_GEN_IMAGE_BACKEND: GenImageBackend; export declare const DEFAULT_GO_BANANAS_API_URL = "https://gobananasai.com/api"; export declare const DEFAULT_GEN_IMAGE_MODEL = "gemini-pro-image"; export declare const DEFAULT_OPENAI_IMAGE_ENDPOINT = "https://api.openai.com/v1/images/generations"; /** gpt-image-1 is the live API model id for the gpt-image ("gpt-image-2") family. */ export declare const DEFAULT_OPENAI_IMAGE_MODEL = "gpt-image-1"; /** Go Bananas `POST /images` request body. */ export interface GoBananasGenImageRequest { prompt: string; aspect_ratio: string; model_id: string; enhance_prompt: boolean; negative_prompt: string; /** Lock the still to a managed Go Bananas character for identity consistency. */ character_id?: number; /** Render via a Go Bananas style preset (e.g. the multi-view reference sheet). */ style_preset_id?: number; } /** OpenAI `POST /v1/images/generations` request body. */ export interface OpenAiGenImageRequest { model: string; prompt: string; size: string; n: number; } export type GenImageRequest = GoBananasGenImageRequest | OpenAiGenImageRequest; export interface BuildGenImageRequestOptions { prompt: string; kind: GenImageKind; /** Backend to compose for; defaults to `gobananas`. */ backend?: GenImageBackend; /** Go Bananas aspect ratio override (ignored by the OpenAI backend). */ aspectRatio?: string; /** OpenAI canvas size override (ignored by the Go Bananas backend). */ size?: string; /** Model id override for the selected backend. */ model?: string; /** Go Bananas only: lock the still to a managed character id for consistency. */ characterId?: number; /** Go Bananas only: render via a style preset (e.g. the reference-sheet preset). */ stylePresetId?: number; } /** * Weave the per-kind render directive into a prompt (PURE). Shared by every * backend's request composer so the directive treatment never drifts. */ export declare function composeGenImagePrompt(prompt: string, kind: GenImageKind): string; /** Default aspect ratio for a kind (PURE; shared with the Flow backend). */ export declare function defaultGenImageAspect(kind: GenImageKind): string; /** * Compose the image request body for the selected backend (PURE). Weaves the * per-kind render directive into the prompt. For Go Bananas it resolves the * aspect ratio and a text-aware negative prompt; for OpenAI it resolves the * canvas size. Exposed for tests and dry-run inspection. (The Flow backend has * its own composer — `buildFlowImageParams` in `gen-image-flow.ts` — because * its body carries reference/character slots and marker validation.) */ export declare function buildGenImageRequest(opts: BuildGenImageRequestOptions): GenImageRequest; /** Extract the image URL from the many shapes the Go Bananas /images endpoint * may return (mirrors character-auto-create's fallback chain). */ export declare function extractGenImageUrl(payload: unknown): string | undefined; export interface GenerateGenImageOptions { prompt: string; kind: GenImageKind; /** Backend to use; defaults to `gobananas`. */ backend?: GenImageBackend; /** Where the resulting image is written. */ outputPath: string; /** Go Bananas aspect ratio override. */ aspectRatio?: string; /** OpenAI canvas size override. */ size?: string; /** Model id override for the selected backend. */ model?: string; /** Go Bananas only: lock the still to a managed character id for consistency. */ characterId?: number; /** Go Bananas only: render via a style preset (e.g. the reference-sheet preset). */ stylePresetId?: number; /** * API key. Go Bananas falls back to GO_BANANAS_API_KEY; OpenAI falls back to * OPENAI_API_KEY. */ apiKey?: string; /** Go Bananas API base URL; falls back to GO_BANANAS_API_URL then the default. */ apiUrl?: string; /** OpenAI endpoint override; falls back to VCLAW_OPENAI_IMAGE_ENDPOINT then the default. */ endpoint?: string; /** Injectable fetch for tests; defaults to the global fetch. */ fetcher?: typeof fetch; /** Flow backend: local image paths (uploaded first) or mediaGenerationIds for reference_1..10. */ refs?: string[]; /** Flow backend: saved Flow character refs for character_1..7. */ characterRefs?: string[]; /** Flow backend: images per generation (1-4, default 1). */ count?: number; /** Flow backend: seed for reproducible results. */ seed?: number; /** Flow backend: useapi token; falls back to USEAPI_API_TOKEN. */ apiToken?: string; /** Flow backend: useapi account email; falls back to USEAPI_ACCOUNT_EMAIL. */ accountEmail?: string; } export interface GenImageResult { path: string; kind: GenImageKind; backend: GenImageBackend; model: string; /** Present for the Go Bananas and Flow backends. */ aspectRatio?: string; /** Present for the OpenAI backend. */ size?: string; /** Present for the Go Bananas and Flow backends (the downloaded URL). */ imageUrl?: string; sizeBytes: number; } /** * Return `outputPath` with its extension replaced by the image format implied by * `imageUrl` (jpg/jpeg→jpg, png, webp, gif, avif). When the URL carries no * recognizable image extension, `outputPath` is returned unchanged. PURE. */ export declare function withImageExtension(outputPath: string, imageUrl: string): string; /** * Generate a diegetic still and write it to disk via the selected backend. * Throws a clear error when the key is missing, a request fails, or no image * data/URL comes back. */ export declare function generateGenImage(opts: GenerateGenImageOptions): Promise; //# sourceMappingURL=gen-image.d.ts.map