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

# Images

Generate images from image or text input.

## Create image

> Generate images from a text prompt.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Images","description":"Generate images from image or text input."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: nexos-...` for a user key or `X-Api-Key: nexos-team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"ImagesGenerationsRequest":{"type":"object","additionalProperties":false,"properties":{"prompt":{"description":"A text description of the desired image(s).","type":"string"},"model":{"type":"string"},"n":{"type":"integer","minimum":1,"maximum":10,"nullable":true,"description":"The number of images to generate. Must be between 1 and 10."},"quality":{"description":"The quality of the generated images. Supported values depend on the model: GPT Image models accept `low`, `medium`, `high`, and `auto`; `standard` and `hd` are DALL-E values and are rejected by GPT Image models.\n","type":"string","enum":["auto","low","medium","high","standard","hd"],"nullable":true},"response_format":{"description":"The format of the generated images. The currently available models (GPT Image, Imagen) ignore this parameter and always return base64-encoded images (`b64_json`); `url` only applies to models that support hosted image URLs.\n","type":"string","enum":["url","b64_json"],"nullable":true},"size":{"description":"The size of the generated images. Supported values depend on the model: GPT Image models accept `1024x1024`, `1536x1024`, `1024x1536`, and `auto`; the remaining values are DALL-E sizes.\n","type":"string","enum":["auto","1024x1024","1536x1024","1024x1536","256x256","512x512","1792x1024","1024x1792"],"nullable":true},"style":{"description":"The style of the generated images. DALL-E parameter; accepted but ignored by GPT Image models.","type":"string","enum":["vivid","natural"],"nullable":true}},"required":["prompt","model"]}},"responses":{"ImagesResponse":{"description":"Represents an image response returned by model, based on the provided input.","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer","description":"The Unix timestamp (in seconds) of when the images were created.\n"},"data":{"type":"array","items":{"type":"object","properties":{"b64_json":{"type":"string","description":"The base64-encoded JSON of the generated image. Always returned by GPT Image models,\notherwise returned if response_format is b64_json.\n"},"revised_prompt":{"type":"string","description":"The prompt that was used to generate the image, if there was any revision to the prompt.\n"},"url":{"type":"string","description":"The URL of the generated image, if response_format is url. Not returned by GPT Image models.\n"}}}},"background":{"type":"string","description":"The background setting of the generated images. Returned by GPT Image models."},"output_format":{"type":"string","description":"The output format of the generated images. Returned by GPT Image models."},"quality":{"type":"string","description":"The quality of the generated images. Returned by GPT Image models."},"size":{"type":"string","description":"The size of the generated images. Returned by GPT Image models."},"provider":{"type":"string","description":"The upstream provider that served the request (e.g. `vertex-ai`). Returned for some providers."},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"input_tokens_details":{"type":"object","properties":{"image_tokens":{"type":"integer"},"text_tokens":{"type":"integer"}}},"output_tokens":{"type":"integer"},"output_tokens_details":{"type":"object","properties":{"image_tokens":{"type":"integer"},"text_tokens":{"type":"integer"}}},"total_tokens":{"type":"integer"},"nexos_credits_cost":{"type":"number","format":"double","description":"Cost of the request in nexos credits."}}}},"required":["created","data"]}}}},"OutOfCredits":{"description":"The company has run out of AI credits. Returned when the company's budget limit has been reached.\n","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}}},"paths":{"/v1/images/generations":{"post":{"operationId":"post-images-generations-v1","summary":"Create image","tags":["Images"],"description":"Generate images from a text prompt.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImagesGenerationsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ImagesResponse"},"400":{"description":"Invalid request data."},"402":{"$ref":"#/components/responses/OutOfCredits"},"500":{"description":"Server error."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexos.ai/gateway-api/images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
