Grok-2 Image - Image Generator
Generate stunning images from text prompts using xAI's Grok-2 Image. Powered by advanced AI intelligence, Grok-2 Image combines creative understanding with technical precision to produce high-quality visual content across diverse styles and subjects.
Endpoint
Request Headers
| Field | Value |
|---|---|
| API-KEY | <api-key> |
| Content-Type | application/json |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Feature type identifier. Must be IMAGE_GENERATOR |
model | string | Yes | AI model identifier. Must be grok-2-image-1212 |
promptObject | object | Yes | Configuration object containing all generation parameters |
Prompt Object Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
prompt | string | Yes | Text description of the image to generate | - |
n | number | No | Number of images to generate (1-4) | 1 |
size | string | No | Image dimensions | 1024x1024 |
Supported Image Sizes
| Size | Resolution | Best For |
|---|---|---|
1024x1024 | 1024×1024 | High quality, detailed images |
1024x768 | 1024×768 | Landscape format, wide compositions |
768x1024 | 768×1024 | Portrait format, vertical compositions |
512x512 | 512×512 | Standard quality, faster generation |
Code Examples
- cURL
- JavaScript
- Python
curl --location 'https://api.1min.ai/api/features' \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "IMAGE_GENERATOR",
"model": "grok-2-image-1212",
"promptObject": {
"prompt": "A futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk style",
"n": 1,
"size": "1024x1024"
}
}'
fetch('https://api.1min.ai/api/features', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
type: 'IMAGE_GENERATOR',
model: 'grok-2-image-1212',
promptObject: {
prompt: 'A futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk style',
n: 1,
size: '1024x1024'
}
})
})
import requests
url = "https://api.1min.ai/api/features"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"type": "IMAGE_GENERATOR",
"model": "grok-2-image-1212",
"promptObject": {
"prompt": "A futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk style",
"n": 1,
"size": "1024x1024"
}
}
response = requests.post(url, headers=headers, json=data)
Interactive Playground
API Playground
https://api.1min.ai/api/featuresGenerated cURL Command:
curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "IMAGE_GENERATOR",
"model": "grok-2-image-1212",
"promptObject": {
"prompt": "A futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk style",
"n": 1,
"size": "1024x1024"
}
}'
Response Format
{
"aiRecord": {
"uuid": "g1h2i3j4-k5l6-7890-mnop-qr1234567890",
"userId": "user-12345",
"teamId": "team-67890",
"teamUser": {
"teamId": "team-67890",
"userId": "user-12345",
"userName": "John Doe",
"userAvatar": "https://example.com/avatar.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 15000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T11:00:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "grok-2-image-1212",
"type": "IMAGE_GENERATOR",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T11:00:00.000Z",
"aiRecordDetail": {
"promptObject": {
"prompt": "A futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk style",
"n": 1,
"size": "1024x1024"
},
"resultObject": [
"development/images/2025_01_15_11_00_30_001_futuristic_cityscape.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_11_00_30_001_futuristic_cityscape.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T110000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}
Use Cases
Creative & Artistic Applications
- Digital Art: Create original artwork with advanced AI understanding
- Concept Art: Generate visual concepts for games, films, and creative projects
- Illustration: Produce detailed illustrations for books, articles, and presentations
- Abstract Art: Generate complex abstract compositions and artistic expressions
- Style Exploration: Experiment with various artistic styles and techniques
Commercial & Business Applications
- Marketing Visuals: Create compelling images for advertising campaigns
- Brand Assets: Generate unique brand-related imagery and graphics
- Product Mockups: Visualize products in different settings and contexts
- Social Media Content: Produce engaging visual content for social platforms
- Website Graphics: Create custom images for web design and digital presence
Educational & Professional
- Educational Materials: Generate illustrations for learning and training content
- Presentations: Create custom visuals for professional presentations
- Documentation: Produce clear visual aids for technical documentation
- Research Visualization: Create images to support research and academic work
- Prototyping: Generate visual prototypes for design and development
Tips for Best Results
-
Detailed Descriptions: Provide rich, specific details in your prompts
- Good: "A Victorian mansion at twilight with ornate Gothic windows, ivy-covered walls, and warm golden light spilling from the entrance"
- Avoid: "A house"
-
Style Specifications: Include artistic style preferences
- Examples: "photorealistic", "oil painting style", "digital art", "watercolor", "cyberpunk aesthetic"
- Helps Grok-2 Image understand the desired visual approach
-
Composition Details: Specify camera angles, lighting, and composition
- "Wide-angle shot", "close-up portrait", "bird's eye view"
- "Dramatic lighting", "soft natural light", "neon lighting"
- "Centered composition", "rule of thirds", "symmetrical"
-
Color and Mood: Describe color palettes and emotional tone
- "Warm earth tones", "vibrant neon colors", "monochromatic blue"
- "Cheerful and bright", "moody and atmospheric", "serene and peaceful"
-
Technical Considerations: Choose appropriate image sizes
- 1024x1024: Best for detailed, high-quality images
- 1024x768: Ideal for landscape compositions
- 768x1024: Perfect for portrait orientations
- 512x512: Good for quick iterations and previews
Advanced Usage Tips
Prompt Engineering Best Practices
-
Structure Your Prompts: Organize prompts logically
[Subject] + [Setting/Environment] + [Style] + [Lighting/Mood] + [Details] -
Use Descriptive Language: Rich vocabulary enhances results
- Instead of "pretty": use "elegant", "stunning", "breathtaking"
- Instead of "dark": use "shadowy", "mysterious", "dimly lit"
-
Specify Exclusions: Use negative prompting concepts in descriptions
- "Clean modern design without clutter"
- "Peaceful landscape without urban elements"
-
Balance Specificity: Be detailed but not overwhelming
- Include 3-5 key descriptive elements
- Focus on the most important visual aspects
Creative Workflows
-
Iterative Refinement: Start broad, then refine
- First: General concept and style
- Then: Add specific details and adjustments
-
Variation Exploration: Use the
nparameter effectively- Generate multiple versions to explore different interpretations
- Compare results to identify preferred directions
-
Size Strategy: Match size to intended use
- Social media: 1024×1024 (square) or 1024×768 (landscape)
- Print materials: 1024×1024 for maximum detail
- Web graphics: 512×512 for faster loading
Notes
- Grok-2 Image excels at both photorealistic and artistic content generation
- The model shows strong performance across diverse subject matters and styles
- Generated images are unique on each request, providing fresh interpretations
- Optimal for professional and creative applications requiring high-quality visuals
- Supports complex, multi-element compositions with excellent coherence