Skip to main content

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

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Parameters

ParameterTypeRequiredDescription
typestringYesFeature type identifier. Must be IMAGE_GENERATOR
modelstringYesAI model identifier. Must be grok-2-image-1212
promptObjectobjectYesConfiguration object containing all generation parameters

Prompt Object Parameters

ParameterTypeRequiredDescriptionDefault
promptstringYesText description of the image to generate-
nnumberNoNumber of images to generate (1-4)1
sizestringNoImage dimensions1024x1024

Supported Image Sizes

SizeResolutionBest For
1024x10241024×1024High quality, detailed images
1024x7681024×768Landscape format, wide compositions
768x1024768×1024Portrait format, vertical compositions
512x512512×512Standard quality, faster generation

Code Examples

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"
}
}'

Interactive Playground

API Playground

https://api.1min.ai/api/features
Describe the image you want to generate
Number of images to generate (1-4)
Choose image dimensions

Generated 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

  1. 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"
  2. 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
  3. 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"
  4. 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"
  5. 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

  1. Structure Your Prompts: Organize prompts logically

    [Subject] + [Setting/Environment] + [Style] + [Lighting/Mood] + [Details]
  2. Use Descriptive Language: Rich vocabulary enhances results

    • Instead of "pretty": use "elegant", "stunning", "breathtaking"
    • Instead of "dark": use "shadowy", "mysterious", "dimly lit"
  3. Specify Exclusions: Use negative prompting concepts in descriptions

    • "Clean modern design without clutter"
    • "Peaceful landscape without urban elements"
  4. Balance Specificity: Be detailed but not overwhelming

    • Include 3-5 key descriptive elements
    • Focus on the most important visual aspects

Creative Workflows

  1. Iterative Refinement: Start broad, then refine

    • First: General concept and style
    • Then: Add specific details and adjustments
  2. Variation Exploration: Use the n parameter effectively

    • Generate multiple versions to explore different interpretations
    • Compare results to identify preferred directions
  3. 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