Image Generation
Generate images from text prompts using DALL-E and other models. OpenAI-compatible /v1/images/generations endpoint with INR billing.
Use this page with an AI assistant
Opens a new chat with this docs URL and the correct AICredits base URLs.
Generate images from text prompts using the OpenAI-compatible /v1/images/generations endpoint. Costs are charged in INR from your wallet like any other request.
Overview
The image generation endpoint follows the OpenAI Images API format. Use the standard OpenAI SDK — just point it at the AICredits base URL. Images are returned as URLs or base64-encoded data.
Image generation is billed per image based on the model, size, and quality selected. Costs are converted from USD to INR using the live forex rate.
Generate an Image
from openai import OpenAI
client = OpenAI(
base_url="https://api.aicredits.in/v1",
api_key="sk-your-key-here",
)
response = client.images.generate(
model="dall-e-3",
prompt="A serene view of the Indian Himalayas at sunrise, photorealistic, 4K",
size="1024x1024",
quality="standard",
n=1,
)
image_url = response.data[0].url
print(image_url)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aicredits.in/v1",
apiKey: "sk-your-key-here",
});
const response = await client.images.generate({
model: "dall-e-3",
prompt: "A serene view of the Indian Himalayas at sunrise, photorealistic, 4K",
size: "1024x1024",
quality: "standard",
n: 1,
});
const imageUrl = response.data[0].url;
console.log(imageUrl);curl https://api.aicredits.in/v1/images/generations \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A serene view of the Indian Himalayas at sunrise, photorealistic, 4K",
"size": "1024x1024",
"quality": "standard",
"n": 1
}'Parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Image model to use. Default: dall-e-3 |
prompt | string (required) | Text description (max 4000 chars for DALL-E 3) |
n | integer | Number of images. DALL-E 3 supports only 1 |
size | string | Image dimensions. See Sizes & Quality below. |
quality | string | standard or hd. HD costs more but has finer detail. |
response_format | string | url (default) or b64_json |
style | string | vivid (hyper-real) or natural (more realistic) |
Response Format
{
"created": 1709123456,
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/...",
"revised_prompt": "A serene panoramic view of the Indian Himalayas..."
}
]
}revised_prompt
DALL-E 3 may revise your prompt to add safety mitigations or improve image quality. The revised_prompt field shows what was actually used.
To get the image as base64 (useful for processing without hosting):
import base64
from openai import OpenAI
client = OpenAI(
base_url="https://api.aicredits.in/v1",
api_key="sk-your-key-here",
)
response = client.images.generate(
model="dall-e-3",
prompt="A minimalist logo for a tech startup",
response_format="b64_json",
)
image_data = base64.b64decode(response.data[0].b64_json)
with open("logo.png", "wb") as f:
f.write(image_data)Sizes & Quality
DALL-E 3 supports the following size and quality combinations:
| Size | Quality | Best For |
|---|---|---|
| 1024×1024 | standard | General purpose, square images |
| 1024×1024 | hd | Detailed artwork, fine textures |
| 1792×1024 | standard / hd | Landscape / widescreen images |
| 1024×1792 | standard / hd | Portrait / tall images |
Billing
Image generation costs are fixed per image (not per token):
| Model | Size | Cost |
|---|---|---|
| DALL-E 3 | 1024×1024 | Standard: ~₹3.5 · HD: ~₹7 |
| DALL-E 3 | 1792×1024 / 1024×1792 | Standard: ~₹5 · HD: ~₹10 |
| DALL-E 2 | 256–1024px | ~₹0.7–₹1.5 depending on size |
Exact INR prices depend on the live USD/INR rate. See the Pricing page for the full cost formula.
Error Handling
| Status | Cause |
|---|---|
| 400 | Invalid parameters (unsupported size, bad model name) |
| 400 | Prompt violates content policy |
| 402 | Insufficient wallet balance — top up at Dashboard → Billing |
| 429 | Rate limit exceeded — image generation counts toward your RPM limit |