Generate images using OpenDunes-hosted image models.
The Images resource gives you text-to-image generation, billed in DA per output image. It works with the OpenAI SDK's images.generate helper, which maps to POST /v1/images/generations.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://opendunes.com/v1",
api_key=os.environ["OPENDUNES_API_KEY"],
)
resp = client.images.generate(
model="google/gemini-2.5-flash-image",
prompt="An aerial view of Algiers at dusk, impressionist oil painting style.",
n=1,
size="1024x1024",
)
print(resp.data[0].b64_json[:32]) # the image itself, base64-encodedEach image comes back in the response: its bytes base64-encoded in data[].b64_json, its type in media_type, and the id of the copy kept in Files in file_id. A kept image never expires. If the provider returns no image, the call fails with 502 no_image and you are not charged.
Editing a picture goes through the same route: send the start picture in
input_references— see Image Generation. The SDK'simages.editandimages.create_variationcall routes OpenDunes does not carry.
Image generation is billed per output image — n images cost n × the model's per-image rate. Rates are shown in the model catalog. See the image API reference.