Generate images from text prompts via the OpenDunes image generation endpoint.
The image generation endpoint produces images from natural language prompts. It is OpenAI-compatible, so the openai SDK's images.generate call works without modification — just swap the base URL. It maps to POST /v1/images/generations.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://opendunes.com/v1",
apiKey: process.env.OPENDUNES_API_KEY,
});
const resp = await client.images.generate({
model: "google/gemini-2.5-flash-image",
prompt: "An aerial view of the Sahara dunes at golden hour, photorealistic",
size: "1024x1024",
n: 1,
});
console.log(resp.data?.[0]?.b64_json?.slice(0, 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.createVariationcall 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.