# Grok Imagine Text To Image > AI model for generating image content ## Overview - **Model ID**: `grok-imagine-image-t2i` - **Category**: image - **Provider**: xai - **Status**: model_ready - **Screenshot**: `https://assets.modelslab.com/generations/77fe7302-eee2-45bd-baae-45d2a822b52f.webp` ## API Information This model can be used via our HTTP API. See the API documentation and usage examples below. ### Endpoint - **URL**: `https://modelslab.com/api/v7/images/text-to-image` - **Method**: POST ### Parameters - **`prompt`** (required): Describe in text how the image that need to be generated should appear. - Type: textarea - **`aspect_ratio`** (required): Select the aspect ratio - Type: select (options: 1:1, 9:16, 3:4, 4:3, 16:9) - **`resolution`** (required): Select the Resolution acceptable resolution are 1K and 2K - Type: select (options: 1k, 2k) ## Usage Examples ### cURL ```bash curl --request POST \ --url https://modelslab.com/api/v7/images/text-to-image \ --header "Content-Type: application/json" \ --data '{ "key": "YOUR_API_KEY", "model_id": "grok-imagine-image-t2i", "prompt": "a dramatic scene with a large, menacing dragon and a cloaked figure. The dragon, with its intricate scales and sharp horns, dominates the background, its wings partially spread and its mouth slightly open, revealing sharp teeth. Its scales are a mix of dark red and gray, adding to its intimidating presence. In the foreground, a person stands with their back to the viewer, wearing a detailed, medieval-style cloak and armor. The cloak is deep red with intricate patterns, and the armor is metallic, with a weathered appearance. The setting is a rugged, mountainous landscape with snow-covered peaks and a cloudy sky, enhancing the epic and mystical atmosphere of the scene.", "aspect_ratio": "1:1", "resolution": "2k" }' ``` ### Python ```python import requests response = requests.post( "https://modelslab.com/api/v7/images/text-to-image", headers={ "Content-Type": "application/json" }, json={ "key": "YOUR_API_KEY", "model_id": "grok-imagine-image-t2i", "prompt": "a dramatic scene with a large, menacing dragon and a cloaked figure. The dragon, with its intricate scales and sharp horns, dominates the background, its wings partially spread and its mouth slightly open, revealing sharp teeth. Its scales are a mix of dark red and gray, adding to its intimidating presence. In the foreground, a person stands with their back to the viewer, wearing a detailed, medieval-style cloak and armor. The cloak is deep red with intricate patterns, and the armor is metallic, with a weathered appearance. The setting is a rugged, mountainous landscape with snow-covered peaks and a cloudy sky, enhancing the epic and mystical atmosphere of the scene.", "aspect_ratio": "1:1", "resolution": "2k" } ) print(response.json()) ``` ### JavaScript ```javascript fetch("https://modelslab.com/api/v7/images/text-to-image", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "key": "YOUR_API_KEY", "model_id": "grok-imagine-image-t2i", "prompt": "a dramatic scene with a large, menacing dragon and a cloaked figure. The dragon, with its intricate scales and sharp horns, dominates the background, its wings partially spread and its mouth slightly open, revealing sharp teeth. Its scales are a mix of dark red and gray, adding to its intimidating presence. In the foreground, a person stands with their back to the viewer, wearing a detailed, medieval-style cloak and armor. The cloak is deep red with intricate patterns, and the armor is metallic, with a weathered appearance. The setting is a rugged, mountainous landscape with snow-covered peaks and a cloudy sky, enhancing the epic and mystical atmosphere of the scene.", "aspect_ratio": "1:1", "resolution": "2k" }) }) .then(response => response.json()) .then(data => console.log(data)); ``` ## Links - [Model Playground](https://modelslab.com/models/grok-imagine-text-to-image/grok-imagine-image-t2i) - [API Documentation](https://docs.modelslab.com) - [ModelsLab Platform](https://modelslab.com)