
Qwen/Qwen-Image-2512
20B parameter image generation model from the Qwen family.
Generate an image using the OpenAI-compatible images API. The response contains a base64-encoded image.
Input
from openai import OpenAI
import base64
import os
client = OpenAI(
base_url="https://model-{MODEL_ID}.api.baseten.co/production/sync/v1",
api_key=os.environ["BASETEN_API_KEY"],
)
response = client.images.generate(
model="qwen-image-2512",
prompt="A cat holding a sign that says Hello World",
n=1,
size="1024x1024",
response_format="b64_json",
extra_body={
"num_inference_steps": 25,
"guidance_scale": 1.0,
},
)
# Decode and save the image
img_data = base64.b64decode(response.data[0].b64_json)
with open("qwen_output.png", "wb") as f:
f.write(img_data)
Output
{
"created": 1234567890,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQA..."
}
]
}