# Generate image div strong 🔨 In Development — This section is still being developed and may change. Generate high-quality images from text prompts using advanced Freddy models. #### Authentication - `Authorization: Bearer $FREDDY_API_KEY` ## Request Body **`prompt`** string required Primary description of the image to create. **`model`** string optional Specific image model to use. Defaults to the recommended production model. **`size`** string optional Output dimensions. Supported: `256x256`, `512x512`, `1024x1024`, `1024x1792`, `1792x1024`. Default is `1024x1024`. **`quality`** string optional Rendering quality. Either `standard` or `hd`. Default is `standard`. **`style`** string optional Optional artistic style guidance. **`n`** integer optional Number of variants to produce (1-4). Default is `1`. ## Returns Array of generated image records. ```json { "data": [ { "url": "https://api.freddy.aitronos.com/generated-images/img_abc123.png", "revised_prompt": "A serene mountain landscape at sunset with a crystal clear lake in the foreground", "seed": 123456789 } ] } ``` Request ```bash curl -X POST "https://api.freddy.aitronos.com/v1/images/generate" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A serene mountain landscape at sunset with a crystal clear lake", "size": "1024x1024", "quality": "hd", "n": 1 }' ``` ```python import requests response = requests.post( "https://api.freddy.aitronos.com/v1/images/generate", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "prompt": "A serene mountain landscape at sunset with a crystal clear lake", "size": "1024x1024", "quality": "hd", "n": 1 } ) response.raise_for_status() image = response.json() ``` ```javascript const response = await fetch( 'https://api.freddy.aitronos.com/v1/images/generate', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'A serene mountain landscape at sunset with a crystal clear lake', size: '1024x1024', quality: 'hd', n: 1 }) } ); if (!response.ok) { throw new Error('Failed to generate image'); } const payload = await response.json(); ``` Error Response ```json { "error": { "type": "invalid_request", "message": "Prompt must be between 1 and 1,000 characters" } } ``` ## Related resources - [Image object](/docs/api-reference/images/objects/image-object) - [Upscale image](/docs/api-reference/images/upscale) - [Cleanup image](/docs/api-reference/images/cleanup) - [Remove background](/docs/api-reference/images/remove-background) ## Related resources - [Image object](/docs/api-reference/images/objects/image-object) - [Upscale image](/docs/api-reference/images/upscale) - [Cleanup image](/docs/api-reference/images/cleanup) - [Remove background](/docs/api-reference/images/remove-background)