Image Studio API
A unified, intelligent endpoint for AI image generation, prompt enhancement, and smart editing.
Endpoint
POST https://app.apimage.org/api/v1/image-studioThe Image Studio API uses a smart router to automatically detect your intent. Whether you're generating fresh visuals with FLUX 2 Pro, enhancing prompts with AI, or removing backgrounds, everything happens through a single, powerful endpoint.
Authentication
All requests require an API key passed in the Authorization header.
New Format (Recommended)
Use the modern sk_ prefixed keys.
Authorization: Bearer sk_live_...
JWT Tokens
For authenticating via user sessions in front-end apps.
Authorization: Bearer eyJhbG...
Actions
The action field determines the operation. If omitted, it defaults to generate.
| Action | Description |
|---|---|
generate | Generate or edit an image using FLUX AI models. Includes auto-routing for background removal. |
enhance_prompt | Rewrite a prompt to be more descriptive and optimized for high-quality generation. |
Action: generate
The core generation engine. Use this to create new images from scratch or edit existing ones by providing input images.
Required Parameters
promptString
The text description of the image. Max 10,000 characters.
modelString
Options: flux-2-pro (High fidelity) or flux-2-klein-9b (Fast/Cheap).
Code Examples
fetch('https://app.apimage.org/api/v1/image-studio', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_your_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A cyberpunk city with flying cars and neon signs',
model: 'flux-2-pro',
aspect_ratio: '16:9'
})
})
.then(res => res.json())
.then(data => console.log(data.image_url));import requests
url = 'https://app.apimage.org/api/v1/image-studio'
headers = {
'Authorization': 'Bearer sk_your_api_key',
'Content-Type': 'application/json'
}
payload = {
'prompt': 'A watercolor painting of Paris in autumn',
'model': 'flux-2-pro',
'aspect_ratio': '4:3'
}
response = requests.post(url, json=payload, headers=headers)
print(response.json()['image_url'])curl -X POST https://app.apimage.org/api/v1/image-studio \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A minimalist Japanese garden at dawn",
"model": "flux-2-pro",
"aspect_ratio": "16:9"
}'Action: enhance_prompt
Free of charge
This action does not consume any credits. Use it freely to optimize your user experience.
Rewrites a simple user prompt into a high-quality, descriptive prompt optimized for AI image generation.
Request Body
{
"action": "enhance_prompt",
"prompt": "a dog on a beach"
}Background Removal
Smart auto-routing detects background removal intent in your prompt and automatically routes to the specialized Stability AI engine.
How to trigger:
- Provide an
input_imagein the request. - Include keywords like
"remove background"or"clear bg"in the prompt. - Cost is a flat 2 credits.
Errors
402 Payment Required
The organization has insufficient AI credits. Please top up in the billing dashboard.
401 Unauthorized
Missing or invalid API key. Ensure you use the sk_ prefix format.