Image Generation
Generate images from text prompts using various AI models. Our API supports multiple image generation providers to give you flexibility in your applications.
Midjourney
POST/api/v1/midjourney/generate
Generate high-quality, artistic images using Midjourney. This endpoint provides access to Midjourney's image generation capabilities through our platform.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | The text prompt to generate an image from |
style | string | No | Style preset to use (e.g., "raw", "cute", "scenic") |
width | integer | No | Width of the generated image (default: 512) |
height | integer | No | Height of the generated image (default: 512) |
model | string | No | Midjourney model version to use (default: "5") |
num_outputs | integer | No | Number of images to generate (default: 1, max: 4) |
Example Request
# Python example import requests import json url = "https://api.pomeloapi.example.com/api/v1/midjourney/generate" headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } data = { "prompt": "A serene mountain landscape with a lake at sunset, photorealistic", "style": "scenic", "width": 1024, "height": 768, "model": "5", "num_outputs": 2 } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json())
Response Format
{ "status": "success", "images": [ { "url": "https://storage.pomeloapi.example.com/images/abc123.png", "id": "img_abc123", "created_at": "2023-06-15T10:30:45Z" }, { "url": "https://storage.pomeloapi.example.com/images/def456.png", "id": "img_def456", "created_at": "2023-06-15T10:30:45Z" } ], "prompt": "A serene mountain landscape with a lake at sunset, photorealistic", "model": "5" }
Flux.1
POST/api/v1/flux.1
Generate high-quality images from text using Flux.1, which offers a variety of styles and capabilities.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | The text prompt to generate an image from |
negative_prompt | string | No | Text prompt specifying what you don't want in the image |
style | string | No | Style preset (e.g., "anime", "photorealistic", "digital-art") |
seed | integer | No | Random seed for reproducible image generation |
steps | integer | No | Number of denoising steps (default: 30, max: 50) |
aspect_ratio | string | No | Aspect ratio of the output image (e.g., "1:1", "16:9", "4:3") |
Example Request
# Python example import requests import json url = "https://api.pomeloapi.example.com/api/v1/flux.1" headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } data = { "prompt": "A futuristic cityscape with flying cars and holographic billboards", "negative_prompt": "blurry, low quality, distorted", "style": "digital-art", "steps": 40, "aspect_ratio": "16:9" } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json())
Response Format
{ "id": "gen_789xyz", "created": 1678901234, "images": [ { "url": "https://storage.pomeloapi.example.com/images/789xyz.png", "width": 1024, "height": 576 } ], "prompt": "A futuristic cityscape with flying cars and holographic billboards", "model": "flux.1", "seed": 42105, "status": "complete" }
Best Practices
Tips for Better Results
- Be specific and detailed in your prompts (e.g., specify lighting, style, mood)
- Use negative prompts to remove unwanted elements
- Experiment with different styles and presets
- Save seeds of images you like for future variations
- For consistent character generation, provide detailed descriptions
Content Moderation
All image generation requests are subject to content moderation. Requests that violate ourusage policieswill be rejected. This includes but is not limited to:
- Explicit sexual content
- Violence and gore
- Hateful or discriminatory imagery
- Content that infringes on intellectual property rights
- Personal information or private data