DEVUP Docs
Back to Dashboard

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.

POSThttps://api.devupai.com/v1/images/generations

Browse all text-to-image models.

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

ParameterNotes
promptText description of the image
modelDefaults to FLUX Schnell
sizeImage dimensions (e.g., "1024x1024")
nNumber of images to generate
response_formatFormat 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, styleAvailable 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"):

json
{
  "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"):

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.