> For the complete documentation index, see [llms.txt](https://docs.cortecs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cortecs.ai/api-overview/image-generation-beta.md).

# Image Generation \[BETA]

{% hint style="info" %}
To get a full list of models, visit [cortecs.ai](https://cortecs.ai/) and filter by the **Image-Gen** tag.
{% endhint %}

## Generate images

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

```json
{"openapi":"3.0.0","info":{"title":"Cortecs Image Generation API","version":"1.0.0"},"servers":[{"url":"https://api.cortecs.ai/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ImageGenerationRequest":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","description":"The image-generation model to use."},"prompt":{"type":"string","description":"A text description of the image to generate."},"n":{"type":"integer","minimum":1,"description":"Number of images to generate. Provider support may vary.","default":1},"size":{"type":"string","description":"Requested output dimensions in widthxheight form. Provider support may vary."},"response_format":{"type":"string","enum":["url","b64_json"],"description":"The format of each generated image. Provider support may vary."},"preference":{"type":"string","enum":["speed","cost","balanced"],"description":"The provider preference for handling the request."},"allowed_providers":{"type":"array","items":{"type":"string"},"description":"Providers that may process the request."},"eu_native":{"type":"boolean","description":"Whether to consider only providers based and regulated within the EU."},"allow_quantization":{"type":"boolean","description":"Whether to allow quantized endpoints."},"allow_zero_data_retention":{"type":"boolean","description":"Whether to use only zero-data-retention providers."},"enable_model_fallback":{"type":"boolean","description":"Whether to allow model fallback when the primary model is unavailable."},"fallbacks":{"type":"array","items":{"type":"string"},"description":"Alternative models to use when model fallback is enabled."}}},"ImageGenerationResponse":{"type":"object","required":["created","data"],"properties":{"created":{"type":"integer","description":"Unix timestamp when the images were created."},"data":{"type":"array","items":{"type":"object","properties":{"b64_json":{"type":"string","nullable":true,"description":"Base64-encoded image data when requested or returned by the provider."},"url":{"type":"string","nullable":true,"description":"Image URL when returned by the provider. Provider support may vary."},"revised_prompt":{"type":"string","nullable":true,"description":"Provider-revised prompt when available."}}}},"size":{"type":"string","nullable":true,"description":"Output dimensions when reported by the provider."},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer","description":"Prompt input tokens when reported by the provider."},"output_tokens":{"type":"integer","description":"Output tokens when reported by the provider."},"total_tokens":{"type":"integer","description":"Total tokens when reported by the provider."},"cost":{"type":"number","description":"Total image-request cost in Cortecs microcredits."},"cost_details":{"type":"object","properties":{"image_generation_cost":{"type":"number","description":"Generated-image cost in Cortecs microcredits."},"prompt_cost":{"type":"number","description":"Prompt-input cost in Cortecs microcredits."}}}}}}}}},"paths":{"/images/generations":{"post":{"summary":"Generate images","description":"Generates one or more images from a text prompt using the specified image-generation model.","operationId":"createImageGeneration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationRequest"}}}},"responses":{"200":{"description":"Generated images.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationResponse"}}}},"500":{"description":"Internal server error."}}}}}}
```
