1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/gpt-image-1";
const data = {
"prompt": "Create a professional and visually engaging magazine cover for a lifestyle magazine called \"Urban Pulse.\" Include these featured article headlines clearly: \"10 Hidden Cafés You'll Love in NYC\" \"Minimalist Apartments: Small Spaces, Big Ideas\" \"Exclusive Interview: Behind the Scenes with Indie Band Echo District\" Use contemporary typography, vibrant colors, and include an eye-catching main photograph with a person standing in front of a city scene",
"size": "auto",
"quality": "auto",
"moderation": "auto",
"background": "opaque",
"output_compression": 100,
"output_format": "png"
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
Text prompt used to generate the image.
Select image resolution. Square is the fastest to generate.
Allowed values:
Controls the visual quality of the output image.
Allowed values:
Controls the moderation strictness - use low for less restrictions.
Allowed values:
Select whether the image background should be transparent or opaque.
Allowed values:
Select the compression level for the output image (1-100).
Select the output format of the image.
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
GPT-Image-1 is OpenAI’s advanced image generation model that bridges the gap between natural language understanding and high-quality image creation. Designed for developers, creators, and businesses, it allows users to generate richly detailed visuals from simple text prompts. Whether you're prototyping a product mockup, visualizing creative concepts, or generating assets for marketing, GPT-Image-1 makes it easy to go from idea to image—without any design skills required.
GPT-Image-1 leverages OpenAI’s next-generation architecture to translate textual descriptions into base64-encoded image data. Unlike earlier diffusion-based systems, GPT-Image-1 uses image-specific tokens, enabling faster generation and more accurate prompt following. When a request is made, the model processes the prompt, renders it token-by-token, and delivers the final image in PNG, JPEG, or WebP formats.
The API offers multiple customization parameters:
"transparent"
to remove backgrounds (PNG/WebP only)GPT-Image-1 is highly versatile across industries:
By setting the "n"
parameter, users can test multiple visual concepts at once. And with transparent backgrounds, GPT-Image-1 easily fits into compositing workflows for UI/UX, motion design, or AR/VR.
GPT-Image-1 unlocks a new level of creative autonomy. It enables teams to scale content creation, iterate faster, and reduce design bottlenecks—while maintaining creative control through precise language input. Whether you're an indie dev, agency, or enterprise, this model can transform how your organization thinks about visual content.