Experimental Feature
SmartGen is currently in beta. API endpoints and behaviors may evolve as improvements are introduced.
Overview
SmartGen offers a high level interface for generating images with advanced prompt engineering and precise control over image dimensions and style. It supports both FLUX and Stable Diffusion models.
Basic Example
tsCopycodeimportCinnafrom'cinna';constcinna=newCinna({apiKey:process.env['CINNA_API_KEY']});constresponse=awaitcinna.smartgen.generateImage({description:"A futuristic cyberpunk portrait of a young woman",image_model:"FLUX.1-dev",stylization_level:3,detail_level:4,color_level:5,lighting_level:2});
Parameters and Controls
SmartGen accepts the following input parameters:
Two Step Generation
You can decouple image creation into two steps for greater control:
Response Format (if param_only is true)
One Step Generation
For direct image creation:
Demonstration
The following example illustrates the change in color intensity from monochrome to highly vibrant using color_level from 1 to 5:
Example 1: “A futuristic cyberpunk portrait of a young woman”
tsCopy code{
// Core settings
description: string, // Main description of the image
width?: number,
height?: number,
// AI model options
image_model?: string, // Default: FLUX-1-dev
is_sd?: boolean, // Set to true to use Stable Diffusion
language_model?: string, // Default: nvidia/llama-3.1-nemotron-70b-instruct
// Visual controls (scale from 1 to 5)
stylization_level: number, // Artistic style versus realism
detail_level: number, // Level of intricacy in visual details
color_level: number, // Color intensity from grayscale to vivid
lighting_level: number, // Lighting depth from neutral to dramatic
// Optional parameters
must_include?: string, // Required elements in the final output
examples?: string[], // Reference prompts
quality?: 'normal' | 'high',
num_iterations?: number, // Overrides quality if provided
guidance_scale?: number, // Use 3 for FLUX, 6 for Stable Diffusion
negative_prompt?: string, // Excludes undesired elements (only for Stable Diffusion)
param_only?: boolean // If true, returns parameters without generating an image
}