# Ideogram 4.0 > Generate native 2K images with best-in-class, accurate text rendering for posters, logos, and design-led visuals. ## Overview - **Endpoint**: `https://api.segmind.com/v1/ideogram-4` - **Model ID**: `ideogram-4` - **Category**: Text-to-Image Generation - **Type**: Synchronous (Direct response) - **Average Cost**: $0.10715604375000001 ## Pricing | rendering_speed | rate_per_mp | | --- | --- | | TURBO | 0.03 | | BALANCED | 0.06 | | QUALITY | 0.1 | ## API Information This model uses a **synchronous response pattern**: 1. Make a POST request with your parameters 2. Receive the output directly in the response (binary for images/videos/audio, JSON for text) 3. No polling required - response is immediate ### Input Schema The API accepts the following input parameters: - **`prompt`** (`string`, _required_): Prompt Describe the image; put exact in-image text in quotes. More detail improves design and typography. - Default: `"A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design"` - **`rendering_speed`** (`string | null`, _optional_): Rendering speed Speed/quality tradeoff. Use QUALITY for text-heavy design, TURBO for fast cheap drafts. - Default: `"QUALITY"` - Options: "TURBO" (TURBO), "BALANCED" (BALANCED), "QUALITY" (QUALITY) - **`image_size`** (`string | null`, _optional_): Image size Output aspect ratio and resolution. Portrait suits posters, landscape banners, square_hd is default. - Default: `"square_hd"` - Options: "square_hd" (square_hd), "square" (square), "portrait_4_3" (portrait_4_3), "portrait_16_9" (portrait_16_9), "landscape_4_3" (landscape_4_3), "landscape_16_9" (landscape_16_9) - **`num_images`** (`integer | null`, _optional_): Number of images Images generated per request, 1 to 8. Raise to compare variations in one call. - Default: `1` - Range: 1 to 8 - **`enable_prompt_expansion`** (`boolean | null`, _optional_): Prompt expansion LLM expands your prompt for richer detail. Disable when exact in-image text must stay unchanged. - Default: `true` - **`output_format`** (`string | null`, _optional_): Output format Image file format. jpeg for smaller files, png for transparency and crisp text edges. - Default: `"jpeg"` - Options: "jpeg" (jpeg), "png" (png) - **`seed`** (`integer | null`, _optional_): Seed Random seed; -1 randomizes. Fix a value to reproduce the same image across runs. - Default: `123456` - Range: 100 to 999999 - **`enable_safety_checker`** (`boolean | null`, _optional_): Safety checker Filters unsafe content from outputs. Keep enabled for production and public-facing apps. - Default: `true` **Required Parameters Example**: ```json { "prompt": "A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design" } ``` **Full Example**: ```json { "prompt": "A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design", "rendering_speed": "QUALITY", "image_size": "square_hd", "num_images": 1, "enable_prompt_expansion": true, "output_format": "jpeg", "seed": 123456, "enable_safety_checker": true } ``` ### Output Schema The API returns a synchronous response based on the model type: **For Image/Video/Audio Models**: - Response contains binary data (image/png, video/mp4, audio/mp3) - Content-Type header indicates the media type - Save the response body directly to a file **For Text Models**: - Response is JSON with the generated text - Structure varies by model **HTTP Response Codes**: - **200 - OK**: Request successful, output in response body - **400 - Bad Request**: Invalid parameters - **401 - Unauthorized**: Invalid or missing API key - **404 - Not Found**: Model not found - **406 - Not Acceptable**: Insufficient credits - **429 - Too Many Requests**: Rate limit exceeded - **500 - Server Error**: Internal server error ## Usage Examples ### cURL ```bash curl -X POST "https://api.segmind.com/v1/ideogram-4" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design", "rendering_speed": "QUALITY", "image_size": "square_hd", "num_images": 1, "enable_prompt_expansion": true, "output_format": "jpeg", "seed": 123456, "enable_safety_checker": true }' ``` ### Python ```python import requests import json api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/ideogram-4" data = { "prompt": "A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design", "rendering_speed": "QUALITY", "image_size": "square_hd", "num_images": 1, "enable_prompt_expansion": true, "output_format": "jpeg", "seed": 123456, "enable_safety_checker": true } response = requests.post( url, json=data, headers={ 'x-api-key': api_key, 'Content-Type': 'application/json' } ) if response.status_code == 200: # For image/video/audio models, response.content contains the binary data with open('output.png', 'wb') as f: f.write(response.content) print('Generation complete, saved to output.png') else: print(f"Error: {response.status_code}") print(response.text) ``` ### JavaScript ```javascript const apiKey = 'YOUR_API_KEY'; const url = 'https://api.segmind.com/v1/ideogram-4'; const data = { "prompt": "A vintage-style travel poster of Tokyo at night, glowing neon signs reflecting on wet streets, a bold title reading \"TOKYO\" across the top and the tagline \"Where Tradition Meets Tomorrow\" below, vibrant teal and magenta palette, clean retro print design", "rendering_speed": "QUALITY", "image_size": "square_hd", "num_images": 1, "enable_prompt_expansion": true, "output_format": "jpeg", "seed": 123456, "enable_safety_checker": true }; const response = await fetch(url, { method: 'POST', headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify(data), }); if (response.ok) { // For image/video/audio models, response contains binary data const blob = await response.blob(); const downloadUrl = URL.createObjectURL(blob); // Create download link const a = document.createElement('a'); a.href = downloadUrl; a.download = 'output.png'; a.click(); console.log('Generation complete'); } ``` ## Additional Resources ### Documentation - [Model Playground](https://www.segmind.com/models/ideogram-4) - [API Documentation](https://www.segmind.com/models/ideogram-4/api) - [Pricing Details](https://www.segmind.com/models/ideogram-4/pricing) - [Platform Documentation](https://docs.segmind.com/) ### Tags No tags available