Overview
The Decart image models support optional settings to customize the generation behavior. These settings are passed to the generateImage() function alongside the model and prompt.
import { decart } from '@decartai/ai-sdk-provider' ;
import { generateImage } from 'ai' ;
const { image } = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'Three dogs playing in the snow' ,
aspectRatio: '16:9' , // Optional: control dimensions
seed: 42 , // Optional: reproducible results
});
Supported Settings
aspectRatio
aspectRatio
string
default: "undefined"
Controls the aspect ratio of the generated image. Only two values are supported:
"16:9" - Landscape orientation
"9:16" - Portrait orientation
If not specified, the model uses its default aspect ratio.
Landscape (16:9)
Ideal for wide scenes, panoramic views, and horizontal compositions:
const { image } = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A serene beach at sunset with palm trees' ,
aspectRatio: '16:9' ,
});
Portrait (9:16)
Ideal for vertical compositions, portraits, and tall subjects:
const { image } = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A tall lighthouse on a rocky cliff' ,
aspectRatio: '9:16' ,
});
Unsupported Aspect Ratios Only 16:9 and 9:16 are supported. Other aspect ratios (e.g., 1:1, 4:3, 21:9) will generate a warning and fall back to the default behavior: {
"type" : "unsupported-setting" ,
"setting" : "aspectRatio" ,
"details" : "Only 16:9 and 9:16 aspect ratios are supported."
}
seed
seed
number
default: "undefined"
Sets a seed value for deterministic, reproducible image generation. When you use the same seed with the same prompt and settings, you’ll get the same image.
Use any integer value
Useful for A/B testing and iterative refinement
Omit for random generation
Basic Usage
const { image } = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A cozy cabin in the mountains' ,
seed: 12345 ,
});
Reproducible Results
Generate the same image multiple times:
// First generation
const result1 = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A robot painting a landscape' ,
seed: 42 ,
aspectRatio: '16:9' ,
});
// Second generation - identical to first
const result2 = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A robot painting a landscape' ,
seed: 42 ,
aspectRatio: '16:9' ,
});
// Images are identical
Iterative Refinement
Test variations by changing only the seed:
const baseConfig = {
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A futuristic city at night' ,
aspectRatio: '16:9' as const ,
};
// Generate variations
const seeds = [ 100 , 200 , 300 , 400 , 500 ];
const variations = await Promise . all (
seeds . map ( seed =>
generateImage ({ ... baseConfig , seed })
)
);
Unsupported Settings
The following AI SDK settings are not supported by Decart models and will generate warnings if used:
size
The size parameter is not supported. Use aspectRatio instead:
// ❌ Not supported
const result = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A mountain landscape' ,
size: '1024x1024' , // Will generate warning
});
// ✅ Use aspectRatio instead
const result = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A mountain landscape' ,
aspectRatio: '16:9' ,
});
Warning output:
{
"type" : "unsupported-setting" ,
"setting" : "size"
}
Implementation Details
Internal Conversion
When you specify an aspectRatio, it’s converted to an orientation value that’s sent to the Decart API:
"16:9" → "landscape"
"9:16" → "portrait"
This conversion is handled automatically by the provider (see decart-config.ts:14).
Settings are sent as form data to the Decart API:
// Internal implementation (from decart-image-model.ts:57-66)
const formData = new FormData ();
formData . append ( 'prompt' , prompt );
if ( seed !== undefined ) {
formData . append ( 'seed' , seed . toString ());
}
if ( orientation !== undefined ) {
formData . append ( 'orientation' , orientation );
}
Complete Example
import { decart } from '@decartai/ai-sdk-provider' ;
import { generateImage } from 'ai' ;
import fs from 'fs' ;
async function generateCustomImage () {
const { image , warnings } = await generateImage ({
model: decart . image ( 'lucy-pro-t2i' ),
prompt: 'A majestic eagle soaring over snow-capped mountains' ,
aspectRatio: '9:16' , // Portrait orientation
seed: 777 , // Reproducible results
});
// Check for warnings
if ( warnings && warnings . length > 0 ) {
console . warn ( 'Warnings:' , warnings );
}
// Save the image
const filename = `eagle- ${ Date . now () } .png` ;
fs . writeFileSync ( filename , image . uint8Array );
console . log ( `Image saved to ${ filename } ` );
}
generateCustomImage ();
Next Steps
Models Learn about lucy-pro-t2i capabilities
Examples See real-world usage examples