More APIs
Image Generation
Generate images from text prompts using the OpenAI-compatible images API.
DEVUP AI supports the OpenAI-compatible image generation API. The default model is FLUX Schnell.
Example
import urllib.request
from openai import OpenAI
client = OpenAI(
api_key="$DEVUP_API_KEY",
base_url="https://api.devupai.com/v1",
)
response = client.images.generate(
prompt="A photo of an astronaut riding a horse on Mars.",
size="1024x1024",
n=1,
)
image_url = response.data[0].url
with urllib.request.urlopen(image_url) as res:
image_bytes = res.read()
with open("output.png", "wb") as f:
f.write(image_bytes)Supported parameters
| Parameter | Notes |
|---|---|
| prompt | Text description of the image |
| model | Defaults to FLUX Schnell |
| size | Image dimensions (e.g., "1024x1024") |
| n | Number of images to generate |
| response_format | Format of the generated images: "url" (default, returns a signed proxy URL in data[].url) or "b64_json" (returns Base64-encoded image bytes inline in data[].b64_json). Any other value is rejected with HTTP 400. |
| quality, style | Available for compatibility only |
URL expiry
The generated image URL in data[].url is signed and expires 300 seconds after the response is generated. After expiry, the media proxy returns HTTP 403 Forbidden. Applications should download the image bytes directly upon receiving the response rather than storing the proxy URL. This expiration applies only to the "url" response; callers who do not want to handle expiring URLs can request "b64_json" instead.
Response format
Default response (response_format: "url"):
{
"data": [
{
"url": "https://api.devupai.com/v1/images/proxy?d=<b64url>&s=<hmac>"
}
],
"_devup": {
"cost_dzd": 0.0,
"balance_dzd": 0.0
}
}Inline Base64 response (response_format: "b64_json"):
{
"data": [
{
"b64_json": "<base64>"
}
],
"_devup": {
"cost_dzd": 0.0,
"balance_dzd": 0.0
}
}The _devup object contains:
cost_dzd: Cost of the request in DZD.balance_dzd: Remaining balance in DZD.
LoRA image adapters
You can also use custom LoRA adapters for image generation — see LoRA for Image Generation.
Tutorial
For a deeper example including advanced options, see the Stable Diffusion tutorial.