> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/reference/api-reference/images.md). Agents can also search and read this documentation through its [MCP server](https://docs.otari.ai/~gitbook/mcp).

# Images

## Edit Image

> OpenAI-compatible image edit endpoint, taking \`\`multipart/form-data\`\`.\
> \
> Authentication modes:\
> \- Master key: the \`\`user\`\` field is required and names an existing user.\
> \- API key: usage and spend go to the key's own user. A \`\`user\`\` naming a\
> &#x20; different user is refused with 403, or ignored when mismatch rejection is off.\
> \
> A priced response carries its cost on \`usage\` as \`cost\_usd\` (a six-decimal\
> USD string) and \`pricing\_source\`, as a chat completion does; a provider that\
> sends no \`usage\` gets one holding just those two fields. An unpriced\
> response carries neither.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.55.1"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}}},"paths":{"/api/v1/images/edits":{"post":{"description":"OpenAI-compatible image edit endpoint, taking ``multipart/form-data``.\n\nAuthentication modes:\n- Master key: the ``user`` field is required and names an existing user.\n- API key: usage and spend go to the key's own user. A ``user`` naming a\n  different user is refused with 403, or ignored when mismatch rejection is off.\n\nA priced response carries its cost on `usage` as `cost_usd` (a six-decimal\nUSD string) and `pricing_source`, as a chat completion does; a provider that\nsends no `usage` gets one holding just those two fields. An unpriced\nresponse carries neither.","operationId":"images-edit_image","requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"image":{"description":"The image or images to edit.","items":{"contentMediaType":"application/octet-stream","type":"string"},"type":"array"},"image[]":{"description":"Same as image.","items":{"contentMediaType":"application/octet-stream","type":"string"},"type":"array"},"mask":{"contentMediaType":"application/octet-stream","description":"Where to edit: the transparent areas of this PNG.","type":"string"},"model":{"title":"Model","type":"string"},"n":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}],"title":"N"},"prompt":{"title":"Prompt","type":"string"},"quality":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Quality"},"response_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Format"},"size":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Size"},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User"}},"required":["model","prompt"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{}}},"description":"Successful Response"},"413":{"description":"The upload is larger than 50 MB."},"422":{"description":"A required field is missing, or a field is the wrong type."}},"summary":"Edit Image","tags":["images"]}}}}
```

## Create Image

> OpenAI-compatible image generation endpoint.\
> \
> Authentication modes:\
> \- Master key + user field: Use specified user (must exist)\
> \- API key + user field: Use specified user (must exist)\
> \- API key without user field: Use the shared "default" user\
> \
> A priced response carries its cost on \`usage\` as \`cost\_usd\` (a six-decimal\
> USD string) and \`pricing\_source\`, as a chat completion does; a provider that\
> sends no \`usage\` gets one holding just those two fields. An unpriced\
> response carries neither.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.55.1"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"ImageGenerationRequest":{"description":"OpenAI-compatible image generation request.\n\nFields are derived from any-llm's ``ImageGenerationParams`` (see\n``_schema_derive``) so the schema cannot silently drop a param any-llm\nforwards.","properties":{"model":{"title":"Model","type":"string"},"n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N"},"prompt":{"title":"Prompt","type":"string"},"quality":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Quality"},"response_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Format"},"size":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Size"},"style":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Style"},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User"}},"required":["model","prompt"],"title":"ImageGenerationRequest","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/images/generations":{"post":{"description":"OpenAI-compatible image generation endpoint.\n\nAuthentication modes:\n- Master key + user field: Use specified user (must exist)\n- API key + user field: Use specified user (must exist)\n- API key without user field: Use the shared \"default\" user\n\nA priced response carries its cost on `usage` as `cost_usd` (a six-decimal\nUSD string) and `pricing_source`, as a chat completion does; a provider that\nsends no `usage` gets one holding just those two fields. An unpriced\nresponse carries neither.","operationId":"images-create_image","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Create Image","tags":["images"]}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/reference/api-reference/images.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
