Enable image search in web search
Enable image search in web search
Set enable_image_search to true on the web_search tool. Grok searches for images and embeds them in the response as Markdown (). Those images also enter the model context used to write the answer. Base setup: Add web search to a Grok API request.
curl
curl https://api.x.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $XAI_API_KEY" \
-d '{
"model": "grok-4.6",
"input": [
{
"role": "user",
"content": "Show me images of Starship on the launch pad."
}
],
"tools": [
{
"type": "web_search",
"enable_image_search": true
}
]
}'
xAI SDK
import os
from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import web_search
client = Client(api_key=os.getenv("XAI_API_KEY"))
chat = client.chat.create(
model="grok-4.6",
tools=[
web_search(enable_image_search=True),
],
)
chat.append(user("Show me images of Starship on the launch pad."))
response = chat.sample()
print(response.content)
print(response.server_side_tool_usage)
Usage includes SERVER_SIDE_TOOL_IMAGE_SEARCH when image search ran.
OpenAI Responses client
response = client.responses.create(
model="grok-4.6",
input=[
{
"role": "user",
"content": "Show me images of Starship on the launch pad.",
},
],
tools=[
{
"type": "web_search",
"enable_image_search": True,
},
],
)
print(response)
Example output

Here are several high-quality images of SpaceX's Starship on the launch pad at Starbase in Boca Chica, Texas.
Pitfalls
- The Vercel AI SDK does not yet expose
enableImageSearch. Use the Responses API or the xAI Python SDK. enable_image_understandingequips the agent with theview_imagetool for pages already being browsed (usage keySERVER_SIDE_TOOL_VIEW_IMAGE). Enabling it on Web Search also enables image understanding for X Search when that tool is on the same request.- Markdown embeds live in the response text.
- Console API credits are separate from SuperGrok's weekly pool on grok.com.