Where are Grok image-search executions counted in API results?

The Citead team, updated

In short. Read response.server_side_tool_usage and the SERVER_SIDE_TOOL_IMAGE_SEARCH key for the successful Grok image-search count.

Definition: In xAI SDK chat results, successful Grok image-search executions are counted in response.server_side_tool_usage under SERVER_SIDE_TOOL_IMAGE_SEARCH. The related response.tool_calls collection records attempted calls and can therefore contain attempts that do not appear in the successful-call count.

Key facts

  • xAI's Web Search documentation says that enable_image_search lets Grok search for relevant images and include them in the response as Markdown image embeds.
  • The same documentation identifies response.server_side_tool_usage as the xAI SDK field where successful image-search executions appear, using the key SERVER_SIDE_TOOL_IMAGE_SEARCH.
  • xAI's Tool Usage Details describes server_side_tool_usage as a map of successfully executed tools and their invocation counts.
  • The tool-usage documentation pairs the usage category SERVER_SIDE_TOOL_IMAGE_SEARCH with the function name search_images.

What does SERVER_SIDE_TOOL_IMAGE_SEARCH count?

The count is a successful execution count for the image-search tool. The tool-usage page says that server_side_tool_usage contains tools that returned meaningful responses and determines billing for per-call tools. A failed execution can still appear in response.tool_calls, because that collection contains every attempted call and includes the call identifier, function name and arguments.

The two fields answer different questions. tool_calls helps trace what the model attempted. server_side_tool_usage reports the successful server-side executions that xAI includes in its usage accounting. The xAI Web Search page is last updated October 10, 2026.

How is image search enabled?

Set enable_image_search to true on the Web Search tool. The xAI example uses the Responses API request below:

{
  "tools": [
    {
      "type": "web_search",
      "enable_image_search": true
    }
  ]
}

The documentation says that the returned images are added to the model context used to write the response. It also separates image search from enable_image_understanding, which gives the agent access to view_image for inspecting images found while browsing regular web pages. The Web Search page says that the Vercel AI SDK does not yet expose enableImageSearch; its examples use the Responses API and xAI Python SDK.

Where should an application read the count?

For an xAI SDK chat response, inspect the map after sampling the response:

response = chat.sample()
print(response.server_side_tool_usage)

Read the value associated with SERVER_SIDE_TOOL_IMAGE_SEARCH. If the application also logs response.tool_calls, use the function name search_images to identify the attempted image-search call. The tool-usage documentation says that function names are precise call names, while entries in server_side_tool_usage are higher-level categories aligned with the tool supplied in the tools array.

The documentation used here names the image-search counter on the xAI SDK chat response. It describes Web Search activity in the Responses API as web_search_call output items, but it gives no separate raw Responses API field for the SERVER_SIDE_TOOL_IMAGE_SEARCH count.

FAQ

Does response.tool_calls provide the image-search execution count?

It provides attempted tool calls. Use response.server_side_tool_usage and the SERVER_SIDE_TOOL_IMAGE_SEARCH key for the successful image-search count.

Is image search the same as image understanding?

They are separate Web Search options. Image search returns relevant images for the response, while image understanding uses view_image to analyze images encountered during browsing.

Sources

  1. xAI, "Web Search", 10 October 2026
  2. xAI, "Tool Usage Details", 10 October 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark