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

Images

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.

provider_orderstring · enum · nullableOptional

Set to custom to try allowed_providers in the listed order instead of using preference-based routing.

Example: customPossible values:
allow_quantizationbooleanOptionalDeprecated

Deprecated. Use quantizations instead. When false, excludes 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
    }
  }
}

Edit an image

post

Edits an uploaded image using a model tagged Image-Edit.

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

A model tagged Image-Edit.

Example: gemini-2.5-flash-image
promptstringRequired

Instructions for editing the image.

Example: Change the background to black.
imagestring · binaryRequired

The source image to edit.

sizestringOptional

Requested output dimensions. Provider support may vary.

Example: 1024x1024
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.

provider_orderstring · enum · nullableOptional

Set to custom to try allowed_providers in the listed order instead of using preference-based routing.

Example: customPossible values:
allow_quantizationbooleanOptionalDeprecated

Deprecated. Use quantizations instead. When false, excludes 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

Edited image.

application/json
createdintegerRequired

Unix timestamp when the images were created.

Example: 1786007165
sizestring · nullableOptional

Output dimensions when reported by the provider.

post/images/edits
POST /v1/images/edits HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 330

{
  "model": "gemini-2.5-flash-image",
  "prompt": "Change the background to black.",
  "image": "binary",
  "size": "1024x1024",
  "preference": "speed",
  "allowed_providers": [
    "text"
  ],
  "eu_native": true,
  "provider_order": "custom",
  "quantizations": [
    "fp8",
    "bf16",
    "unknown"
  ],
  "allow_zero_data_retention": true,
  "enable_model_fallback": true,
  "fallbacks": [
    "text"
  ]
}
{
  "created": 1786007165,
  "data": [
    {
      "b64_json": "text",
      "url": "text",
      "revised_prompt": "text"
    }
  ],
  "size": "text",
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1,
    "total_tokens": 1,
    "cost": 1,
    "cost_details": {
      "image_generation_cost": 1,
      "prompt_cost": 1
    }
  }
}

Last updated