Skip to content

AI Gateway REST: xai/grok-4.5 native web_search broken (search_parameters 500s; /responses rejects Responses shape) #621

Description

@elijahbowie

Summary

Native web search for xai/grok-4.5 is broken / unsupported on the documented Cloudflare AI REST path (POST /client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/...), despite the grok-4.5 model page advertising search_parameters, web_search_options, and tools on chat completions.

Basic chat completions for xai/grok-4.5 succeed (HTTP 200). Any attempt to enable native search fails in one of two contradictory ways depending on endpoint/shape.

Root-cause framing

This looks like a docs / gateway wiring gap, not an upstream xAI outage:

  1. The AI Gateway web search docs explicitly state that only xai/grok-4.20-multi-agent-0309 accepts web_search via AI Gateway, on POST /ai/v1/responses with input + tools: [{ "type": "web_search" }].
  2. The same docs list other Grok chat-completions models under “Models without web search support,” but do not mention xai/grok-4.5.
  3. The xai/grok-4.5 model page exposes search_parameters, web_search_options, and tools on the chat-completions schema — implying search is available — but those fields fail in practice.
  4. Sending a Responses-API-shaped body (input + tools: [{type:"web_search"}]) to /ai/v1/responses for xai/grok-4.5 is rejected as if the gateway is treating the request as chat completions (unsupported field input; expects messages).

Hypothesis: AI Gateway only wires native xAI web_search for the multi-agent model on the Responses path. xai/grok-4.5 is catalogued with search-related schema fields, but the gateway does not implement chat-side search_parameters / web_search_options, nor Responses-side web_search for this model ID.

Environment

  • Product: FRAME (Workers / Agents SDK app)
  • Client: @ai-sdk/openai chat completions against Cloudflare OpenAI-compatible AI REST
  • Base URL: https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1
  • Auth: Authorization: Bearer $CLOUDFLARE_API_TOKEN (Unified Billing / account token; no per-vendor xAI key)
  • Model: xai/grok-4.5
  • Date observed: 2026-07-22

Steps to reproduce

1. Baseline — chat without search (works)

curl -sS -X POST "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "xai/grok-4.5",
    "messages": [
      { "role": "user", "content": "Say hello in one sentence." }
    ]
  }'

Actual: HTTP 200 with a normal chat completion.

2. Chat completions with search_parameters (fails — HTTP 500)

curl -sS -X POST "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "xai/grok-4.5",
    "messages": [
      { "role": "user", "content": "What were the top news stories about Cloudflare this week? Summarize in three bullets." }
    ],
    "search_parameters": {
      "mode": "auto",
      "return_citations": true
    }
  }'

Also fails with the equivalent top-level web_search_options body (same endpoint / model).

Actual:

HTTP 500
{
  "errors": [
    {
      "message": "Model execution failed (Error)",
      "code": 2002
    }
  ],
  "success": false
}

3. Responses-shaped request on /ai/v1/responses (fails — HTTP 400)

This is the shape documented for xAI web search on the multi-agent model, adapted to xai/grok-4.5:

curl -sS -X POST "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/responses" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "xai/grok-4.5",
    "input": "What were the top news stories about Cloudflare this week? Summarize in three bullets.",
    "tools": [
      { "type": "web_search" }
    ]
  }'

Actual: HTTP 400 rejecting field input and indicating the gateway expects messages (chat-completions shape), not Responses API input.

Expected

Either:

A (preferred): Native web search works for xai/grok-4.5 on the documented AI REST path — ideally both:

  • Chat completions: search_parameters / web_search_options (as advertised on the model page), and/or
  • Responses: input + tools: [{ "type": "web_search" }] (as documented for xAI in the web search guide)

…and ideally also xAI-native x_search / code_execution tools where applicable.

B: If intentionally unsupported, the grok-4.5 model page should not advertise search_parameters / web_search_options, and the web search docs should list xai/grok-4.5 under “Models without web search support” (or explicitly document the supported model list only). Failures should be a clear 4xx validation error, not an opaque HTTP 500 code: 2002.

Ask

Please support native web_search (and ideally x_search / code_execution) for xai/grok-4.5 on the documented AI REST / AI Gateway path, or clarify the model-page params if they are intentionally unsupported.

If the intended path is only xai/grok-4.20-multi-agent-0309 on /ai/v1/responses, please:

  1. Wire xai/grok-4.5 the same way (or document why it cannot be), and
  2. Align the model-page schema + “Models without web search support” list so developers are not sent down a 500 path.

Related docs

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions