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

# AI

## AI-powered image processing

> Remove backgrounds, inpaint (object removal), or upscale images using AI models.

```json
{"openapi":"3.0.3","info":{"title":"MiOffice API","version":"1.0.0"},"servers":[{"url":"https://mioffice.ai","description":"Production"}],"paths":{"/api/ai-process":{"post":{"operationId":"processAi","summary":"AI-powered image processing","description":"Remove backgrounds, inpaint (object removal), or upscale images using AI models.","tags":["AI"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","action"],"properties":{"file":{"type":"string","format":"binary","description":"Image file to process"},"action":{"type":"string","enum":["removeBackground","inpaint","upscale"],"description":"AI operation to perform"},"maskData":{"type":"string","format":"binary","description":"Mask image for inpaint action (required for inpaint)"},"options":{"type":"string","description":"JSON string. removeBackground: {\"format\":\"png\"}"}}}}}},"responses":{"200":{"description":"AI-processed image","content":{"image/*":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Job queued for async processing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueuedJob"}}}},"400":{"description":"Invalid action, missing file, or missing mask for inpaint"},"413":{"description":"File exceeds 10MB limit"},"429":{"description":"Rate limit exceeded or queue full"}}}}},"components":{"schemas":{"QueuedJob":{"type":"object","properties":{"jobId":{"type":"string","description":"Unique job identifier"},"jobToken":{"type":"string","description":"Authorization token for this job"},"position":{"type":"integer","description":"Current position in queue"},"estimatedWaitMs":{"type":"integer","description":"Estimated wait time in milliseconds"},"pollUrl":{"type":"string","description":"URL to poll for job status"}}}}}}
```
