Python 88.3%
TypeScript 7.6%
Shell 4.1%
1# xAI image understanding — direct image input vs. `view_image` / `view_x_video` sub-tools23**Status:** DOCUMENTED · LIVE_VERIFIED for direct image input (2026-09-19, grok-4.3: 32×32 PNG data URL on Chat (`image_url`, `image_tokens: 3`), Responses (`input_image`) and Messages (`image` url + base64)); `enable_image_understanding` flags accepted; no `view_image` call triggered.4**Sources:** https://docs.x.ai/developers/model-capabilities/images/understanding · https://docs.x.ai/developers/model-capabilities/legacy/chat-completions#image-understanding · https://docs.x.ai/developers/tools/web-search#enable-image-understanding · https://docs.x.ai/developers/tools/x-search · https://docs.x.ai/developers/pricing#tools-pricing5**Last verified:** 2026-09-1967## Direct image input (not a tool)8| API | Part | Live |9|---|---|---|10| Responses | `{"type":"input_image","image_url":"https://…" \| "data:image/png;base64,…","detail":"auto\|low\|high"}` | ✅ (`file_id` variant → 400 "image_url must either be a base64-encoded image or a URL") |11| Chat Completions | `{"type":"image_url","image_url":{"url":…,"detail":…}}` | ✅ |12| Messages | `{"type":"image","source":{"type":"url","url"} \| {"type":"base64","media_type","data"}}` | ✅ |1314Limits: jpg/jpeg/png; ≤20 MiB; unlimited count; any text/image order; **≥512 total pixels** (live 400 `invalid_image` for 8×8); `detail` low = fewer tokens, high = more. Docs advise `store:false` when sending images to Responses. All live text models list `input_modalities: ["text","image"]`.1516## Media understanding during search (server sub-tools)17- `web_search.enable_image_understanding: true` → agent may call `view_image` on pages it browses (also enables it for x_search in the same request). `web_search.enable_image_search: true` → `search_images`, results embedded as `` markdown + annotations.18- `x_search.enable_image_understanding` / `enable_video_understanding` → `view_image` / `view_x_video` on posts.19- Usage appears in the xai-sdk `server_side_tool_usage` map as `SERVER_SIDE_TOOL_VIEW_IMAGE`, `SERVER_SIDE_TOOL_VIEW_X_VIDEO`, `SERVER_SIDE_TOOL_IMAGE_SEARCH`. Billing: no invocation fee — image tokens only (image search billed as web search).2021Examples: `examples/xai/chat/image_input.py`, `examples/xai/responses/image_input.sh`.22