Images
Generates one or more images from a text prompt using the specified image-generation model.
The image-generation model to use.
flux-2-klein-4bA text description of the image to generate.
A modern workspace with a laptop, coffee cup, and plants on a wooden desk, soft natural lighting.Number of images to generate. Provider support may vary.
1Requested output dimensions in widthxheight form. Provider support may vary.
1024x1024The format of each generated image. Provider support may vary.
The provider preference for handling the request.
Providers that may process the request.
Whether to consider only providers based and regulated within the EU.
Set to custom to try allowed_providers in the listed order instead of using preference-based routing.
customPossible values: Deprecated. Use quantizations instead. When false, excludes quantized endpoints.
Whether to use only zero-data-retention providers.
Whether to allow model fallback when the primary model is unavailable.
Alternative models to use when model fallback is enabled.
Generated images.
Unix timestamp when the images were created.
1786007165Output dimensions when reported by the provider.
Internal server error.
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
}
}
}Edits an uploaded image using a model tagged Image-Edit.
A model tagged Image-Edit.
gemini-2.5-flash-imageInstructions for editing the image.
Change the background to black.The source image to edit.
Requested output dimensions. Provider support may vary.
1024x1024The provider preference for handling the request.
Providers that may process the request.
Whether to consider only providers based and regulated within the EU.
Set to custom to try allowed_providers in the listed order instead of using preference-based routing.
customPossible values: Deprecated. Use quantizations instead. When false, excludes quantized endpoints.
Whether to use only zero-data-retention providers.
Whether to allow model fallback when the primary model is unavailable.
Alternative models to use when model fallback is enabled.
Edited image.
Unix timestamp when the images were created.
1786007165Output dimensions when reported by the provider.
Invalid request.
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