vennaVenna

Image generation

Generate images from a prompt and edit existing images through the OpenAI-compatible /v1/images endpoints.

The gateway exposes OpenAI-shaped image endpoints — generation from a text prompt and mask-constrained editing of an existing image. Both return the standard data array of url or b64_json entries.

Models

Generation runs on qwen-image or flux-2-klein. Editing runs on qwen-image-edit — a distinct model, not a flag on the generation models.

Generate an image

POST /v1/images/generations takes a required prompt, plus these optional fields:

Prop

Type

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://gateway.venna.net/v1",
  apiKey: process.env.VENNA_API_KEY,
});

const result = await client.images.generate({
  model: "qwen-image",
  prompt: "A studio product shot of a matte-black mechanical keyboard, softbox lighting",
  n: 1,
  size: "1024x1024",
});

console.log(result.data[0]?.url);
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.venna.net/v1",
    api_key=os.environ["VENNA_API_KEY"],
)

result = client.images.generate(
    model="qwen-image",
    prompt="A studio product shot of a matte-black mechanical keyboard, softbox lighting",
    n=1,
    size="1024x1024",
)

print(result.data[0].url)
curl https://gateway.venna.net/v1/images/generations \
  -H "Authorization: Bearer $VENNA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image",
    "prompt": "A studio product shot of a matte-black mechanical keyboard, softbox lighting",
    "n": 1,
    "size": "1024x1024"
  }'

Each entry in data carries either a url (default) or a b64_json string, depending on response_format — set response_format: "b64_json" to get the image bytes inline instead of a fetchable link:

const result = await client.images.generate({
  model: "flux-2-klein",
  prompt: "A minimalist line-art logo of a fox",
  response_format: "b64_json",
});

const imageBytes = Buffer.from(result.data[0]?.b64_json ?? "", "base64");

Edit an image

POST /v1/images/edits is multipart/form-data, not JSON. Model is always qwen-image-edit.

Prop

Type

import OpenAI, { toFile } from "openai";
import { readFile } from "node:fs/promises";

const client = new OpenAI({
  baseURL: "https://gateway.venna.net/v1",
  apiKey: process.env.VENNA_API_KEY,
});

const result = await client.images.edit({
  model: "qwen-image-edit",
  image: await toFile(await readFile("./product.png"), "product.png"),
  prompt: "Replace the background with a warm gradient studio backdrop",
});

console.log(result.data[0]?.url);
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.venna.net/v1",
    api_key=os.environ["VENNA_API_KEY"],
)

result = client.images.edit(
    model="qwen-image-edit",
    image=open("product.png", "rb"),
    prompt="Replace the background with a warm gradient studio backdrop",
)

print(result.data[0].url)
curl https://gateway.venna.net/v1/images/edits \
  -H "Authorization: Bearer $VENNA_API_KEY" \
  -F model="qwen-image-edit" \
  -F prompt="Replace the background with a warm gradient studio backdrop" \
  -F image=@product.png

No image variations

POST /v1/images/variations is not supported — it returns a permanent 501. Qwen has no variation endpoint to back it, so there's no upstream path to implement it against. Use edit with a descriptive prompt to get a modified take on an existing image instead.

Images are billed per generated image — against your subscription's image quota if you're on a plan, or deducted from prepaid balance otherwise. n: 4 bills as four images, not one request.

Next steps

  • API reference: Images — full request/response schemas for generations, edits, and the unsupported variations route.
  • Quickstart — pointing any OpenAI-compatible SDK at the gateway.

On this page