GPT-5 mini·续2
Another simple example — sum of a list: def sum_list(lst): if not lst: # base case: empty list return 0 return lst[0] + sum_list(lst[1:]) # recursive case
Notes: - Always ensure the base case will be reached (otherwise you get infinite recursion and eventually a stack overflow). - Recursion can make code clearer for problems that naturally break into smaller subproblems (tree traversal, divide-and-conquer). For very deep recursion, consider iterative solutions or tail recursion (if the language optimizes it).
```json
[
{
"choices": [
{
"delta": {
"content": "",
"refusal": null,
"role": "assistant"
},
"finish_reason": null,
"index": 0
}
],
"created": 1777320181,
"id": "chatcmpl-DZMSTkAwp2vWq2CMKZi2k62kKUAsk",
"model": "gpt-5-mini-2025-08-07",
"obfuscation": "R7nTj",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": null
},
{
"choices": [
{
"delta": {
"content": "Rec"
},
"finish_reason": null,
"index": 0
}
],
"created": 1777320181,
"id": "chatcmpl-DZMSTkAwp2vWq2CMKZi2k62kKUAsk",
"model": "gpt-5-mini-2025-08-07",
"obfuscation": "tvLc",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": null
},
"... 318 more chunks omitted ...",
{
"choices": [],
"created": 1777320181,
"id": "chatcmpl-DZMSTkAwp2vWq2CMKZi2k62kKUAsk",
"model": "gpt-5-mini-2025-08-07",
"obfuscation": "mJ",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": {
"completion_tokens": 711,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 384,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 16,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 727
}
}
]
**Web Search** — Letting the model use OpenAI's built-in web search tool to answer with current information
const response = await env.AI.run(
'openai/gpt-5-mini',
{
input: 'What were the top news stories about Cloudflare this week? Summarise in three bullets.',
max_output_tokens: 4096,
tools: [{ type: 'web_search_preview' }],
},
)
console.log(response)
curl 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": "openai/gpt-5-mini",
"input": "What were the top news stories about Cloudflare this week? Summarise in three bullets.",
"max_output_tokens": 4096,
"tools": [
{
"type": "web_search_preview"
}
]
}'
Do you mean this calendar week (June 16–22, 2026)? Assuming yes — here are the three top Cloudflare stories from June 16–22, 2026:
- Jun 22, 2026 — Eastern North America fiber cut caused increased error rates/latency and a partial degradation across Cloudflare services; engineers re‑routed traffic and mitigated most impact. ([cloudflarestatus.com](https://www.cloudflarestatus.com/))
- Jun 16, 2026 — Cloudflare reported degraded availability for some Workers AI models (affecting specific @cf/moonshotai models), which Cloudflare investigated and partially mitigated. ([cloudflarestatus.com](https://www.cloudflarestatus.com/))
- Jun 17–18, 2026 — Cloudflare launched a Cloudflare One “Design Partner” designation and an AI‑powered toolkit (Cloudflare One Stack) to speed SASE/Zero‑Trust and AI security migrations via select channel partners. ([itpro.com](https://www.itpro.com/technology/artificial-intelligence/cloudflare-launches-new-partner-initiative-to-support-ai-and-sase-adoption?utm_source=openai))
Want me to expand any item (impacts, affected customers, timelines) or fetch more sources?
{
"id": "resp_0353bf77a6c21bf8016a3990db5a388199857704943aa2bb92",
"object": "response",
"created_at": 1782157531,
"model": "gpt-5-mini-2025-08-07",
"output": [
{
"id": "rs_0353bf77a6c21bf8016a3990dbc7748199b7d16f5b4f7e77ca",
"type": "reasoning",
"content": [],
"summary": []
},
{
"id": "ws_0353bf77a6c21bf8016a3990ddd1c4819998796587f7fb4927",
"type": "web_search_call",
"status": "completed",
"action": {
"type": "search",
"queries": [
"Cloudflare news June 2026",
"Cloudflare this week June 2026 news Cloudflare breach outage June 2026",
"Cloudflare IPO news 2026 June 'Cloudflare' 'June 2026' 'announcement'"
],
"query": "Cloudflare news June 2026"
}
},
{
"id": "rs_0353bf77a6c21bf8016a3990df53dc81999d07483ac94d8c85",
"type": "reasoning",
"content": [],
"summary": []
},
{
"id": "ws_0353bf77a6c21bf8016a3990e126588199944c35eb4b3ce827",
"type": "web_search_call",
"status": "completed",
"action": {
"type": "search",
"queries": [
"Cloudflare news June 2026",
"Cloudflare outage June 2026",
"Cloudflare security incident June 2026"
],
"query": "Cloudflare news June 2026"
}
},
{
"id": "rs_0353bf77a6c21bf8016a3990e34d508199a4144abcd991086c",
"type": "reasoning",
"content": [],
"summary": []
},
{
"id": "ws_0353bf77a6c21bf8016a3990e43d8c8199bc26696b72289725",
"type": "web_search_call",
"status": "completed",
"action": {
"type": "open_page",
"url": "https://www.cloudflarestatus.com/"
}
},
{
"id": "rs_0353bf77a6c21bf8016a3990e59ae48199b6ba9d1f7337f25c",
"type": "reasoning",
"content": [],
"summary": []
},
{
"id": "ws_0353bf77a6c21bf8016a3990e9b440819998ba8376759a1a54",
"type": "web_search_call",
"status": "completed",
"action": {
"type": "search",
"queries": [
"Cloudflare One Design Partner AI toolkit announcement June 2026 Cloudflare press release",
"Cloudflare 'Design Partner' 'Cloudflare One' June 17 2026 press release"
],
"query": "Cloudflare One Design Partner AI toolkit announcement June 2026 Cloudflare press release"
}
},
{
"id": "rs_0353bf77a6c21bf8016a3990ec1a1481998070b84eb2a654a0",
"type": "reasoning",
"content": [],
"summary": []
},
{
"id": "msg_0353bf77a6c21bf8016a3990f499108199bd7021505470de8c",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"annotations": [
{
"type": "url_citation",
"end_index": 386,
"start_index": 327,
"title": "Cloudflare Status",
"url": "https://www.cloudflarestatus.com/"
},
{
"type": "url_citation",
"end_index": 633,
"start_index": 574,
"title": "Cloudflare Status",
"url": "https://www.cloudflarestatus.com/"
},
{
"type": "url_citation",
"end_index": 1016,
"start_index": 852,
"title": "Cloudflare launches new partner initiative to support AI and SASE adoption",
"url": "https://www.itpro.com/technology/artificial-intelligence/cloudflare-launches-new-partner-initiative-to-support-ai-and-sase-adoption?utm_source=openai"
}
],
"logprobs": [],
"text": "Do you mean this calendar week (June 16–22, 2026)? Assuming yes — here are the three top Cloudflare stories from June 16–22, 2026:\n\n- Jun 22, 2026 — Eastern North America fiber cut caused increased error rates/latency and a partial degradation across Cloudflare services; engineers re‑routed traffic and mitigated most impact. ([cloudflarestatus.com](https://www.cloudflarestatus.com/)) \n- Jun 16, 2026 — Cloudflare reported degraded availability for some Workers AI models (affecting specific @cf/moonshotai models), which Cloudflare investigated and partially mitigated. ([cloudflarestatus.com](https://www.cloudflarestatus.com/)) \n- Jun 17–18, 2026 — Cloudflare launched a Cloudflare One “Design Partner” designation and an AI‑powered toolkit (Cloudflare One Stack) to speed SASE/Zero‑Trust and AI security migrations via select channel partners. ([itpro.com](https://www.itpro.com/technology/artificial-intelligence/cloudflare-launches-new-partner-initiative-to-support-ai-and-sase-adoption?utm_source=openai))\n\nWant me to expand any item (impacts, affected customers, timelines) or fetch more sources?"
}
],
"role": "assistant"
}
],
"status": "completed",
"usage": {
"input_tokens": 19586,
"output_tokens": 1796,
"total_tokens": 21382,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 1344
}
},
"background": false,
"billing": {
"payer": "developer"
},
"completed_at": 1782157560,
"error": null,
"frequency_penalty": 0,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": 4096,
"max_tool_calls": null,
"moderation": null,
"parallel_tool_calls": true,
"presence_penalty": 0,
"previous_response_id": null,
"prompt_cache_key": null,
"prompt_cache_retention": "in_memory",
"reasoning": {
"context": "current_turn",
"effort": "medium",
"summary": null
},
"safety_identifier": null,
"service_tier": "default",
"store": false,
"temperature": 1,
"text": {
"format": {
"type": "text"
},
"verbosity": "medium"
},
"tool_choice": "auto",
"tools": [
{
"type": "web_search_preview",
"search_content_types": [
"text"
],
"search_context_size": "medium",
"user_location": {
"type": "approximate",
"city": null,
"country": "US",
"region": null,
"timezone": null
}
}
],
"top_logprobs": 0,
"top_p": 1,
"truncation": "disabled",
"user": null,
"metadata": {},
"gatewayMetadata": {
"keySource": "Unified"
}
}
Parameters
Schema variant
ResponsesChat Completions
▶input
one ofrequired
instructions
string
temperature
numberminimum: 0maximum: 2
max_output_tokens
numberexclusiveMinimum: 0
top_p
numberminimum: 0maximum: 1
stream
boolean
▶tools[]
array
tool_choice
▶text{}
object
▶reasoning{}
object
▶messages[]
arrayrequired
temperature
numberminimum: 0maximum: 2
max_tokens
numberexclusiveMinimum: 0
max_completion_tokens
numberexclusiveMinimum: 0
top_p
numberminimum: 0maximum: 1
frequency_penalty
numberminimum: -2maximum: 2
presence_penalty
numberminimum: -2maximum: 2
stream
boolean
▶stream_options{}
object
▶tools[]
array
tool_choice
response_format
▶modalities[]
array
▶audio{}
object
reasoning_effort
stringOptional reasoning control; availability and accepted values are model-dependent.
id
string
object
stringconst: response
created_at
number
model
string
▶output[]
array
output_text
string
status
stringenum: in_progress, completed, failed, incomplete
▶usage{}
object
id
string
object
string
created
number
model
string
▶choices[]
array
▶usage{}
object
API Schemas (Raw)
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai/models/openai/gpt-5-mini/#page","headline":"GPT-5 mini","description":"GPT-5 Mini is the lightweight, low-cost variant of GPT-5, well suited to high-volume coding and reasoning tasks.","url":"https://developers.cloudflare.com/ai/models/openai/gpt-5-mini/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: GPT-5 Nano is OpenAI’s smallest GPT-5 variant, optimized for low latency and cheap, high-throughput tasks. title: GPT-5 nano image: https://developers.cloudflare.com/og-docs.png
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt
Use this file to discover all available pages before exploring further.

