# Analyze a JPEG prepared by a child task

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Analyze a managed child task's JPEG and question using the deployment-selected image model, returning a text answer directly.

```text
POST https://api.moi.matrixorigin.cn/v5/workspaces/{id}/runtime-image-analysis
```

## Before you call this API

Set `BASE_URL` to the product API prefix `https://api.moi.matrixorigin.cn/v5`. For private deployments, use the corresponding product API URL.

Use the same MOI_ENDPOINT, MOI_API_KEY, MOI_RUNTIME_AUTHORIZATION, and MOI_WORKSPACE_ID connection group in the managed child environment. BASE_URL uses MOI_ENDPOINT; WORKSPACE_ID uses MOI_WORKSPACE_ID. MOI_RUNTIME_AUTHORIZATION already includes Bearer. An ordinary PAT cannot replace child-task identity.

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --fail-with-body -sS -X POST "$BASE_URL/workspaces/$WORKSPACE_ID/runtime-image-analysis" \
  -H "X-API-Key: $MOI_API_KEY" \
  -H "X-MOI-Runtime-Authorization: $MOI_RUNTIME_AUTHORIZATION" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -F "file=@$PREPARED_JPEG" \
  --form-string "question=$QUESTION"
```

:::::
:::::{tab-item} Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | file | Yes | Nonempty JPEG, at most 650KiB; width and height each at most 1600 pixels. |
| `question` | string | Yes | Valid UTF-8; nonempty after trimming, at most 4096 Unicode code points. |

Multipart allows exactly one file and one question. Body limit is 1MiB; original question bytes are limited to 16384, and the encoded JPEG data URL to 900KiB. Deployment img_parse slot, exact system model routing, and billing must be available. Callers cannot supply model selection fields. Model-call context is 150 seconds; CLI wait limit is 180 seconds. Neither guarantees success.

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "answer": "示例回答"
}
```

:::::
:::::{tab-item} Fields

| Field/response item | Type | Description |
| --- | --- | --- |
| `answer` | string | Trimmed model answer. Does not establish creation of files or artifacts. |

Successful responses have no uniform code/data wrapper; temporary files and image streams return bytes directly.

:::::
::::::
:::::::

## Error responses

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "error_code": "image_analysis_unavailable",
  "message": "示例本地化错误"
}
```

:::::
:::::{tab-item} Fields

| HTTP | code/format | Condition |
| --- | --- | --- |
| 400 | image_analysis_invalid_multipart | Multipart parsing failed. |
| 400 | image_analysis_invalid_fields | Unknown or duplicate fields. |
| 400 | image_analysis_invalid_input | Missing fields, empty question, or invalid text. |
| 400 | image_analysis_invalid_image | Invalid JPEG header, dimensions, or encoding result. |
| 413 | image_analysis_too_large | File, question-byte, or request limit exceeded. |
| 403 | runtime_image_authorization_failed | Handler runtime identity check failed. |
| 503 | image_analysis_unavailable | Model, billing, dependency, or response unavailable. |

Outer identity/task-proof rejection may precede this handler. Retain raw HTTP, machine codes, and actual diagnostics; do not apply other file-protocol error envelopes.

:::::
::::::
:::::::
