Images
Generate images with POST https://api.kyvalt.com/v1/images/generations, the same request and response as the OpenAI Images API. Use your kv- key and any image model from Models.
Make a request
curl https://api.kyvalt.com/v1/images/generations \
-H "Authorization: Bearer $KYVALT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "venice-flux-2-pro",
"prompt": "A lighthouse on a rocky coast at sunset, watercolor",
"n": 1
}'import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.kyvalt.com/v1", api_key="kv-...")
result = client.images.generate(
model="venice-flux-2-pro",
prompt="A lighthouse on a rocky coast at sunset, watercolor",
n=1,
)
with open("lighthouse.png", "wb") as f:
f.write(base64.b64decode(result.data[0].b64_json)){
"created": 1794743905,
"model": "venice-flux-2-pro",
"data": [
{ "b64_json": "iVBORw0KGgo..." }
]
}Each item in data carries the image as base64 in b64_json. Some models return a temporary url instead; download it soon, because it expires.
Request fields
| Field | Required | Notes |
|---|---|---|
model | Yes | An image model ID from Models. |
prompt | Yes | What to draw. |
n | No | Number of images, 1 to 10. Defaults to 1. |
size, quality, style, response_format | No | Passed to the model as sent. Which values work depends on the model. |
Pricing
Image models are priced per image, not per token. Models lists the price per image next to the list price.
- Before the request, your balance must cover
nimages. That amount is held, not charged. - After the request, you pay only for the images that came back. If the model returns fewer images, or none, the rest is released.
- The
X-Min-Discountheader and the discount floor on your key apply as they do for text. See Discount floor and price cap.
Each request appears in Usage logs with the number of images and its cost.
Content
Some image models are uncensored and can produce adult content. You must be 18 or older to use them, and you are responsible for what you generate. Sexual content involving minors, intimate images of real people without their consent, and anything else illegal is forbidden on every model, as set out in the Terms of Service.