Skip to content

Commit c182b69

Browse files
authored
docs(ai-gateway): add model web search tool examples (#32023)
1 parent 48d0c1c commit c182b69

21 files changed

Lines changed: 4576 additions & 1 deletion

src/content/catalog-models/alibaba-qwen3-max.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,64 @@
17441744
"code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"alibaba/qwen3-max\",\n \"messages\": [\n {\n \"content\": \"Explain the concept of recursion with a simple example.\",\n \"role\": \"user\"\n }\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n }\n}'"
17451745
}
17461746
]
1747+
},
1748+
{
1749+
"name": "Web Search",
1750+
"description": "Letting Qwen use DashScope's built-in web search via enable_search",
1751+
"input": {
1752+
"enable_search": true,
1753+
"max_tokens": 4096,
1754+
"messages": [
1755+
{
1756+
"content": "What were the top news stories about Cloudflare this week? Summarise in three bullets.",
1757+
"role": "user"
1758+
}
1759+
]
1760+
},
1761+
"output": {
1762+
"text": "As of the week ending June 23, 2026, the top Cloudflare news stories include:\n\n- **Acquisition of VoidZero**: On June 4, 2026, Cloudflare announced it acquired VoidZero to accelerate development of the AI-native web, enhancing its platform for next-generation agentic applications.\n\n- **Secure Sandboxes for Claude Managed Agents**: On May 19, 2026, Cloudflare introduced secure, scalable sandboxes integrated with Anthropic\u2019s Claude Managed Agents, strengthening runtime security for AI agents\u2014a key update still resonating in early June coverage.\n\n- **Industry Recognition and Strategic Momentum**: Throughout June, Cloudflare continued to be highlighted as a Leader in Edge Development Platforms (per an independent research firm report on May 5, widely cited in June) and maintained media visibility through its ongoing \u201cAgents Week 2026\u201d initiatives, reinforcing its position at the forefront of agentic AI infrastructure."
1763+
},
1764+
"raw_response": {
1765+
"id": "chatcmpl-5860fcba-c7bc-9e5e-afd8-d32376b5a423",
1766+
"object": "chat.completion",
1767+
"created": 1782161284,
1768+
"model": "qwen3-max",
1769+
"choices": [
1770+
{
1771+
"index": 0,
1772+
"message": {
1773+
"role": "assistant",
1774+
"content": "As of the week ending June 23, 2026, the top Cloudflare news stories include:\n\n- **Acquisition of VoidZero**: On June 4, 2026, Cloudflare announced it acquired VoidZero to accelerate development of the AI-native web, enhancing its platform for next-generation agentic applications.\n\n- **Secure Sandboxes for Claude Managed Agents**: On May 19, 2026, Cloudflare introduced secure, scalable sandboxes integrated with Anthropic\u2019s Claude Managed Agents, strengthening runtime security for AI agents\u2014a key update still resonating in early June coverage.\n\n- **Industry Recognition and Strategic Momentum**: Throughout June, Cloudflare continued to be highlighted as a Leader in Edge Development Platforms (per an independent research firm report on May 5, widely cited in June) and maintained media visibility through its ongoing \u201cAgents Week 2026\u201d initiatives, reinforcing its position at the forefront of agentic AI infrastructure."
1775+
},
1776+
"finish_reason": "stop",
1777+
"logprobs": null
1778+
}
1779+
],
1780+
"usage": {
1781+
"prompt_tokens": 3589,
1782+
"completion_tokens": 196,
1783+
"total_tokens": 3785,
1784+
"prompt_tokens_details": {
1785+
"cached_tokens": 0
1786+
}
1787+
},
1788+
"system_fingerprint": null,
1789+
"gatewayMetadata": {
1790+
"keySource": "Unified"
1791+
}
1792+
},
1793+
"code_snippets": [
1794+
{
1795+
"label": "typescript",
1796+
"language": "typescript",
1797+
"code": "const response = await env.AI.run(\n 'alibaba/qwen3-max',\n {\n enable_search: true,\n max_tokens: 4096,\n messages: [\n {\n content:\n 'What were the top news stories about Cloudflare this week? Summarise in three bullets.',\n role: 'user',\n },\n ],\n },\n)\nconsole.log(response)"
1798+
},
1799+
{
1800+
"label": "curl",
1801+
"language": "bash",
1802+
"code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"alibaba/qwen3-max\",\n \"enable_search\": true,\n \"max_tokens\": 4096,\n \"messages\": [\n {\n \"content\": \"What were the top news stories about Cloudflare this week? Summarise in three bullets.\",\n \"role\": \"user\"\n }\n ]\n}'"
1803+
}
1804+
]
17471805
}
17481806
],
17491807
"default_example": null,

src/content/catalog-models/alibaba-qwen3.5-397b-a17b.json

Lines changed: 63 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-haiku-4.5.json

Lines changed: 286 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-opus-4.5.json

Lines changed: 235 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-opus-4.6.json

Lines changed: 346 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-opus-4.7.json

Lines changed: 209 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-opus-4.8.json

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/anthropic-claude-sonnet-4.5.json

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.

src/content/catalog-models/bytedance-seedance-2.0-fast.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"type": "string"
124124
},
125125
"reference_images": {
126-
"description": "Reference images (1-4, HTTP(S) URLs or base64 data URIs) to guide video generation for characters, avatars, clothing, or environments. Cannot be used with 1080p resolution or first/last frame images.",
126+
"description": "Reference images (1-4, HTTP(S) URLs or base64 data URIs) to guide video generation for characters, avatars, clothing, or environments. Cannot be used with first/last frame images.",
127127
"maxItems": 4,
128128
"type": "array",
129129
"items": {

src/content/catalog-models/openai-gpt-4.1-mini.json

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7151,6 +7151,159 @@
71517151
"code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"openai/gpt-4.1-mini\",\n \"messages\": [\n {\n \"content\": \"Explain the concept of recursion with a simple example.\",\n \"role\": \"user\"\n }\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n }\n}'"
71527152
}
71537153
]
7154+
},
7155+
{
7156+
"name": "Web Search",
7157+
"description": "Letting the model use OpenAI's built-in web search tool to answer with current information",
7158+
"input": {
7159+
"input": "What were the top news stories about Cloudflare this week? Summarise in three bullets.",
7160+
"max_output_tokens": 4096,
7161+
"tools": [
7162+
{
7163+
"type": "web_search_preview"
7164+
}
7165+
]
7166+
},
7167+
"output": {
7168+
"text": "Here are the top news stories about Cloudflare from June 15 to June 22, 2026:\n\n- **Cloudflare Launches Partner Program for SASE and AI Security Deployment**: On June 17, 2026, Cloudflare introduced the Cloudflare One Design Partner Designation, a channel program providing select global partners with technical resources and financial support to deploy its Secure Access Service Edge (SASE) platform. The initial partners include Arctiq, Consortium, CMT, Presidio, and The Missing Link. Additionally, Cloudflare unveiled the Cloudflare One Stack, a library of AI tools designed to assist security teams in evaluating, deploying, and managing the Cloudflare One platform. ([streetinsider.com](https://www.streetinsider.com/Corporate%2BNews/Cloudflare%2Blaunches%2Bpartner%2Bprogram%2Bfor%2BSASE%2Band%2BAI%2Bsecurity%2Bdeployment/26657730.html?utm_source=openai))\n\n- **Cloudflare Expands AI Security with Ping Identity Partnership at the Edge**: On June 17, 2026, Cloudflare announced a partnership with Ping Identity to enhance AI security by extending enterprise-scale identity enforcement to the edge. This collaboration focuses on real-time authorization, monitoring, and policy enforcement for AI agents running on Cloudflare\u2019s global network, expanding Zero Trust controls to AI-powered edge workloads outside traditional cloud environments. ([simplywall.st](https://simplywall.st/stocks/us/software/nyse-net/cloudflare/news/cloudflare-net-expands-ai-security-with-ping-identity-partne?utm_source=openai))\n\n- **Cloudflare Network Disruption Triggers Widespread Internet Outages**: On June 22, 2026, a significant global network disruption at Cloudflare caused widespread outages for millions of internet users, affecting major platforms like X, Reddit, and Zoom. The incident began around 10 a.m. EST, with users reporting persistent API authorization errors and dashboard issues. Cloudflare identified the technical issue and implemented a fix across the network. ([harianbasis.co](https://www.harianbasis.co/en/cloudflare-network-disruption-internet-outage?utm_source=openai)) "
7169+
},
7170+
"raw_response": {
7171+
"id": "resp_0cab0a66e314d8de016a398f5f89108199976c9781f9d62782",
7172+
"object": "response",
7173+
"created_at": 1782157151,
7174+
"model": "gpt-4.1-mini-2025-04-14",
7175+
"output": [
7176+
{
7177+
"id": "ws_0cab0a66e314d8de016a398f607314819994386a4692610288",
7178+
"type": "web_search_call",
7179+
"status": "completed",
7180+
"action": {
7181+
"type": "search",
7182+
"queries": [
7183+
"Cloudflare news April 2024"
7184+
],
7185+
"query": "Cloudflare news April 2024"
7186+
}
7187+
},
7188+
{
7189+
"id": "msg_0cab0a66e314d8de016a398f6195c08199b60676eda470d4ad",
7190+
"type": "message",
7191+
"status": "completed",
7192+
"content": [
7193+
{
7194+
"type": "output_text",
7195+
"annotations": [
7196+
{
7197+
"type": "url_citation",
7198+
"end_index": 862,
7199+
"start_index": 671,
7200+
"title": "Cloudflare launches partner program for SASE and AI security deployment",
7201+
"url": "https://www.streetinsider.com/Corporate%2BNews/Cloudflare%2Blaunches%2Bpartner%2Bprogram%2Bfor%2BSASE%2Band%2BAI%2Bsecurity%2Bdeployment/26657730.html?utm_source=openai"
7202+
},
7203+
{
7204+
"type": "url_citation",
7205+
"end_index": 1510,
7206+
"start_index": 1347,
7207+
"title": "Cloudflare (NET) Expands AI Security With Ping Identity Partnership At The Edge - Simply Wall St News",
7208+
"url": "https://simplywall.st/stocks/us/software/nyse-net/cloudflare/news/cloudflare-net-expands-ai-security-with-ping-identity-partne?utm_source=openai"
7209+
},
7210+
{
7211+
"type": "url_citation",
7212+
"end_index": 2083,
7213+
"start_index": 1970,
7214+
"title": "Cloudflare Network Disruption Triggers Widespread Internet Outages",
7215+
"url": "https://www.harianbasis.co/en/cloudflare-network-disruption-internet-outage?utm_source=openai"
7216+
}
7217+
],
7218+
"logprobs": [],
7219+
"text": "Here are the top news stories about Cloudflare from June 15 to June 22, 2026:\n\n- **Cloudflare Launches Partner Program for SASE and AI Security Deployment**: On June 17, 2026, Cloudflare introduced the Cloudflare One Design Partner Designation, a channel program providing select global partners with technical resources and financial support to deploy its Secure Access Service Edge (SASE) platform. The initial partners include Arctiq, Consortium, CMT, Presidio, and The Missing Link. Additionally, Cloudflare unveiled the Cloudflare One Stack, a library of AI tools designed to assist security teams in evaluating, deploying, and managing the Cloudflare One platform. ([streetinsider.com](https://www.streetinsider.com/Corporate%2BNews/Cloudflare%2Blaunches%2Bpartner%2Bprogram%2Bfor%2BSASE%2Band%2BAI%2Bsecurity%2Bdeployment/26657730.html?utm_source=openai))\n\n- **Cloudflare Expands AI Security with Ping Identity Partnership at the Edge**: On June 17, 2026, Cloudflare announced a partnership with Ping Identity to enhance AI security by extending enterprise-scale identity enforcement to the edge. This collaboration focuses on real-time authorization, monitoring, and policy enforcement for AI agents running on Cloudflare\u2019s global network, expanding Zero Trust controls to AI-powered edge workloads outside traditional cloud environments. ([simplywall.st](https://simplywall.st/stocks/us/software/nyse-net/cloudflare/news/cloudflare-net-expands-ai-security-with-ping-identity-partne?utm_source=openai))\n\n- **Cloudflare Network Disruption Triggers Widespread Internet Outages**: On June 22, 2026, a significant global network disruption at Cloudflare caused widespread outages for millions of internet users, affecting major platforms like X, Reddit, and Zoom. The incident began around 10 a.m. EST, with users reporting persistent API authorization errors and dashboard issues. Cloudflare identified the technical issue and implemented a fix across the network. ([harianbasis.co](https://www.harianbasis.co/en/cloudflare-network-disruption-internet-outage?utm_source=openai)) "
7220+
}
7221+
],
7222+
"role": "assistant"
7223+
}
7224+
],
7225+
"status": "completed",
7226+
"usage": {
7227+
"input_tokens": 320,
7228+
"output_tokens": 477,
7229+
"total_tokens": 797,
7230+
"input_tokens_details": {
7231+
"cached_tokens": 0
7232+
},
7233+
"output_tokens_details": {
7234+
"reasoning_tokens": 0
7235+
}
7236+
},
7237+
"background": false,
7238+
"billing": {
7239+
"payer": "developer"
7240+
},
7241+
"completed_at": 1782157156,
7242+
"error": null,
7243+
"frequency_penalty": 0,
7244+
"incomplete_details": null,
7245+
"instructions": null,
7246+
"max_output_tokens": 4096,
7247+
"max_tool_calls": null,
7248+
"moderation": null,
7249+
"parallel_tool_calls": true,
7250+
"presence_penalty": 0,
7251+
"previous_response_id": null,
7252+
"prompt_cache_key": null,
7253+
"prompt_cache_retention": "in_memory",
7254+
"reasoning": {
7255+
"context": null,
7256+
"effort": null,
7257+
"summary": null
7258+
},
7259+
"safety_identifier": null,
7260+
"service_tier": "default",
7261+
"store": false,
7262+
"temperature": 1,
7263+
"text": {
7264+
"format": {
7265+
"type": "text"
7266+
},
7267+
"verbosity": "medium"
7268+
},
7269+
"tool_choice": "auto",
7270+
"tools": [
7271+
{
7272+
"type": "web_search_preview",
7273+
"search_content_types": [
7274+
"text"
7275+
],
7276+
"search_context_size": "medium",
7277+
"user_location": {
7278+
"type": "approximate",
7279+
"city": null,
7280+
"country": "US",
7281+
"region": null,
7282+
"timezone": null
7283+
}
7284+
}
7285+
],
7286+
"top_logprobs": 0,
7287+
"top_p": 1,
7288+
"truncation": "disabled",
7289+
"user": null,
7290+
"metadata": {},
7291+
"gatewayMetadata": {
7292+
"keySource": "Unified"
7293+
}
7294+
},
7295+
"code_snippets": [
7296+
{
7297+
"label": "typescript",
7298+
"language": "typescript",
7299+
"code": "const response = await env.AI.run(\n 'openai/gpt-4.1-mini',\n {\n input: 'What were the top news stories about Cloudflare this week? Summarise in three bullets.',\n max_output_tokens: 4096,\n tools: [{ type: 'web_search_preview' }],\n },\n)\nconsole.log(response)"
7300+
},
7301+
{
7302+
"label": "curl",
7303+
"language": "bash",
7304+
"code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/responses \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"openai/gpt-4.1-mini\",\n \"input\": \"What were the top news stories about Cloudflare this week? Summarise in three bullets.\",\n \"max_output_tokens\": 4096,\n \"tools\": [\n {\n \"type\": \"web_search_preview\"\n }\n ]\n}'"
7305+
}
7306+
]
71547307
}
71557308
],
71567309
"default_example": null,

0 commit comments

Comments
 (0)