For the complete documentation index, see llms.txt. This page is also available as Markdown.

Image Generation [BETA]

Image generation creates images from natural-language prompts, enabling applications such as illustrations, product concepts, marketing assets, and visual prototypes.

To explore available models, visit cortecs.ai and filter by the Image-Gen tag.

Example usage

import base64
from pathlib import Path

from openai import OpenAI

client = OpenAI(
    base_url="https://api.cortecs.ai/v1",
    api_key="<API_KEY>",
)

response = client.images.generate(
    model="gemini-2.5-flash-image",
    prompt="Generate an image of a blue circle on a white background.",
)

image_base64 = next(
    (image.b64_json for image in response.data if image.b64_json),
    None,
)

if image_base64 is None:
    raise RuntimeError("The response did not contain a Base64-encoded image.")

output_path = Path("generated-image.png")
output_path.write_bytes(base64.b64decode(image_base64))
print(f"Saved image to {output_path.resolve()}")

Last updated