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

Image Generation [BETA]

To get a full list of models, visit cortecs.ai and filter by the Image-Gen tag.

Generate images

post

Generates one or more images from a text prompt using the specified image-generation model.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
modelstringRequired

The image-generation model to use.

Example: flux-2-klein-4b
promptstringRequired

A text description of the image to generate.

Example: A modern workspace with a laptop, coffee cup, and plants on a wooden desk, soft natural lighting.
ninteger · min: 1Optional

Number of images to generate. Provider support may vary.

Default: 1
sizestringOptional

Requested output dimensions in widthxheight form. Provider support may vary.

Example: 1024x1024
response_formatstring · enumOptional

The format of each generated image. Provider support may vary.

Possible values:
preferencestring · enumOptional

The provider preference for handling the request.

Possible values:
allowed_providersstring[]Optional

Providers that may process the request.

eu_nativebooleanOptional

Whether to consider only providers based and regulated within the EU.

allow_quantizationbooleanOptional

Whether to allow quantized endpoints.

allow_zero_data_retentionbooleanOptional

Whether to use only zero-data-retention providers.

enable_model_fallbackbooleanOptional

Whether to allow model fallback when the primary model is unavailable.

fallbacksstring[]Optional

Alternative models to use when model fallback is enabled.

Responses
200

Generated images.

application/json
createdintegerRequired

Unix timestamp when the images were created.

Example: 1786007165
sizestring · nullableOptional

Output dimensions when reported by the provider.

post/images/generations
from openai import OpenAI

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

response = client.images.generate(
    model="flux-2-klein-4b",
    prompt="A modern workspace with a laptop, coffee cup, and plants on a wooden desk, soft natural lighting.",
)

print(response.data)
{
  "created": 1786012026,
  "data": [
    {
      "b64_json": "<base64-encoded image>",
      "revised_prompt": null,
      "url": null
    }
  ],
  "size": "1024x1024",
  "usage": {
    "cost": 9000,
    "cost_details": {
      "image_generation_cost": 9000,
      "prompt_cost": 0
    }
  }
}

Last updated