SmartGen provides a high-level interface for generating images with enhanced prompt engineering and dimension controls. It supports both FLUX and Stable Diffusion models.
{ // Basic settings description: string, // Main image description width?: number, height?: number, // AI model settings image_model?: string, // Default: FLUX-1-dev is_sd?: boolean, // Default: false. Set it to true if we want to use stable diffusion prompt language_model?: string, // Default: nvidia/llama-3.1-nemotron-70b-instruct. For image prompt generation. // Dimension controls (all optional, scale 1-5) stylization_level: number, // Realism vs artistic style. 1: Photorealistic 5: Highly artistic detail_level: number, // Amount of detail. 1: Minimalist 5: Extreme intricate color_level: number, // Color intensity. 1: Monochromatic 5: Hyper-saturated lighting_level: number, // Lighting drama. 1: Flat, even lighting 5: Extreme dramatic lighting // Optional parameters must_include?: string, // Elements to always include without altering examples?: string[], // Example prompts for reference quality?: 'normal' | 'high', // Controls iteration count num_iterations?: number, // Default is 20. If specified, this overrides quality setting guidance_scale?: number, // 3 for Flux and 6 for Stable Diffusion negative_prompt?: string, // Negative prompt, only applies to Stable Diffusion param_only?: boolean // Default: false. Set it to true if we want to return params without execution.}
You can split the generation process into two steps:
Copy
// Step 1: Get image generation parametersconst params = await heurist.smartgen.generateImage({ description: "A cyberpunk cityscape", image_model: "FLUX-1-dev", stylization_level: 4, must_include: "neon lights, flying cars", param_only: true // Don't generate image yet. Only return the parameters});// Review and modify parameters if neededconsole.log(params.parameters.prompt);// Step 2: Call `images.generate` API to generate with the same or modified parametersconst imageResult = await heurist.images.generate({ ...params.parameters // You may change some fields});
You can create an image with a simple description in one step:
Copy
const result = await heurist.smartgen.generateImage({ description: "A cyberpunk cityscape", image_model: "FLUX-1-dev", stylization_level: 4, must_include: "neon lights, flying cars"});// Result image URLconsole.log(result.url);// You can inspect the image generation parametersconsole.log(result.parameters);