UNPKG

@devvai/devv-code-backend

Version:

Backend SDK for Devv Code - Provides authentication, data management, email and AI capabilities

48 lines (47 loc) 1.58 kB
import type { TextToImageOptions, TextToImageResponse } from './types'; /** * DevvImageGen - AI-powered image generation * * Supports multiple models: * * 1. **Default Model** (no model parameter): * Free text-to-image generation with full options support. * ```typescript * const imageGen = new DevvImageGen(); * const result = await imageGen.textToImage({ * prompt: "a red cat", * num_outputs: 2, * aspect_ratio: "16:9", * output_format: "png" * }); * ``` * * 2. **Google Gemini Model** (`google/gemini-2.5-flash-image`): * Supports both text-to-image and image-to-image generation: * - Text-to-image: Provide `prompt` only * - Image-to-image: Provide `prompt` and `image_url` or `image_urls` for transformations * - `output_format` must be "jpg" or "png" only * - Other parameters (num_outputs, aspect_ratio) may be ignored * * ```typescript * // Text-to-image * const result = await imageGen.textToImage({ * prompt: "a futuristic city", * model: "google/gemini-2.5-flash-image", * output_format: "jpg" // Only "jpg" or "png" supported * }); * * // Image-to-image transformation * const transformed = await imageGen.textToImage({ * prompt: "update the text to black", * model: "google/gemini-2.5-flash-image", * image_url: "https://static.copilothub.ai/text-to-image/ew99kcw0c45c.png", * output_format: "png" * }); * ``` * * For other advanced models requiring API keys, use DevvReplicate instead. */ export declare class DevvImageGen { textToImage(options: TextToImageOptions): Promise<TextToImageResponse>; }