GPT-5 nano·续2
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"annotations": [],
"content": "The rain turned the city into a bleary watercolor, every streetlight smeared into halos that bled down the sidewalks. Detective Isla Voss slipped into the alley behind the Glasswright Gallery, where the security guard stood under a lone lamp, shaking out a soggy notebook. The building loomed quiet and serene, the way a locked box does after a storm. Inside, something had happened, but nothing obvious remained.\n\n“Not a thing missing,” the guard said, eyes wary. “Doors were closed, windows intact. Nothing broken, nothing stolen. Just… not right.”\n\nIsla nodded, stepping under the gallery’s arched doorway where the vestibule held a stale room-temperature hush. The air smelled faintly of varnish and rain—less a crime scene and more a paused painting. The security alarm blinked from red to green as she moved past the lobby into the main hall, where the telltale tremor of a disturbance usually left a visible trace. Here, though, the room wore its normalities as if nothing at all had happened.\n\nIn the center of the hall, where the monumental skylight draped the floor in pale glass, lay the oddity: a perfect ring of soot on the white marble, as if someone had circled the space with a tiny, patient brush of charcoal. No dent in the glass, no broken frame, no shard of glass anywhere to indicate a break-in. Just that ring. And inside the ring, the soot had arranged itself into a meticulous, minuscule map—an urban silhouette, a cityscape drawn in black granules and negative space.\n\nIsla crouched, pulled out her ultraviolet flashlight, and leaned close. The soot glowed faintly blue under the peculiar light, the color of a firefly trapped in dusk. The ring itself wasn’t random; the pattern suggested streets, rooftops, a river that ran like a blue thread through the middle of the composition. It wasn’t a doodle, not a mere prank. It was a clue, and a strange one at that.\n\nThe gallery’s curator, a thin man with a voice like a piano wire, appeared at Isla’s shoulder. “You see?” he whispered. “We deal with paintings here, not disguises. But this—this feels like a message.”\n\nIsla stood, letting the light wash over the ring again. A city map drawn in soot—how could that be? She’d seen fingerprints that spelled out names, footprints that traced a route, but a map formed by ash and pigment and gravity’s small mercy was something else entirely. It demanded a different kind of attention, the sort she reserved for echoes and memory rather than objects.\n\n“Who had access to this room after hours?” she asked the curator, keeping her tone light, as if discussing a curious trick rather than a possible crime.\n\nThe curator scanned the room, as if the answer might be hiding in the corners, the way a receipt might hide between two books on a shelf. “We lock up at six. The security feed is clean. The assistant, Mina, is the only other person who might have wandered in—she cleans up after close. But Mina’s never late, never stops to sketch.” He hesitated. “And she’s… unreliable to strangers’ eyes, if you’ll forgive the honesty.”\n\nIsla offered a small, almost-smile. “People aren’t always what they seem. We’ll talk to Mina. And the feed will tell us whether someone else tried to tamper with the room. But tell me, why a map? Why this room?”\n\nThe curator shrugged, his lips thinning. “We publish nothing here that could draw a map of the city exactly. It’s too precise. The only thing that’s ever aligned as neatly as this is a plan for a private tour—one that never happened, not officially.”\n\nHer eyes drifted to the ring again. The map was too precise to be a prank, too delicate to be a mere coincidence. That was good. Clues should be precise enough to be trusted, but not so obvious they screamed.\n\nIsla stood slowly, letting another breath of rain-salted air slip past her lips. She looked up at the skylight, where the rain pattered on the glass in a pattern that made the room feel almost musical. The glow from the map deepened when she traced a line with her finger, right along the imagined avenue that would pass beneath the museum’s floor if the city’s hidden corridors existed.\n\n“Tell me about the last event here,” she said, her voice deliberately casual. “The last exhibit, the last guest, the last thing anyone talked about.”\n\nThe curator drew in a sharp breath. “A storm of artists. A show that never quite ended. The last thing—the piece that the thief would want: a single painting—a landscape of a street in a city that isn’t ours, a city made of shadows and rumor. The piece was insured for a fortune, yet nobody claimed it as theirs.”\n\nA city map in soot, a password of sorts etched without anyone realizing. Isla turned the ring of ashes, watching the map shift as the light moved, the river’s blue thread glimmering more clearly at one angle than another. The clue wasn’t merely a map; it was a sign that someone who knew the city intimately had walked into this room and left a message that only a person with that same intimacy could decipher.\n\nHer instincts nudged her toward the back corridor, where the staff’s break room met the service stairs. The door had a thin smear of dust along its edge, the kind that builds up when a space isn’t used often enough by more than two or three people. She pressed her gloved finger to the dust, then to her lips, a quick, almost subconscious ritual. The dust retained a faint metallic tang—not obvious, but clear to someone who paid attention to such traces.\n\nBack in the main hall, the guard spoke up again. “Mina, you’re thinking Mina, right? She’s the one who cleans the room and who night shifts some weeks. If anyone could conjure a map out of ash, it would be her.”\n\nIsla considered Mina’s possible motives with the cool precision of a clockmaker adjusting a gear. A map drawn in soot could be a confession, a direction, or a trap. An invitation to follow a path that only someone who knows the city’s more intimate lies would recognize.\n\nShe walked toward the break room doorway, every step measured, listening for the smallest sound—a floorboard sigh, a shifted chair, the whisper of a lung trying not to betray fear. In the quiet, she heard not a noise but a breath—someone’s subtle exhale, a sign of life where there shouldn’t be life in the dead of night.\n\nInside, Mina stood with her back to the door, cleaning a coffee mug with a rag that had seen better days. The mug’s handle rattled faintly as she moved, the sound crisp in the hushed room.\n\n“Good evening,” Isla said, still almost polite, though the room’s air felt charged, like a string about to snap.\n\nMina turned slowly, eyes widening at the sight of the glow from the map still faintly visible on the marble floor. She swallowed, the tremor in her throat betraying her attempt at calm. “I didn’t mean to—” she began, but trailed off when Isla raised a hand.\n\n“Tell me about the map,” Isla said softly. “Why draw a city here, in a place that doesn’t even belong to this room?”\n\nMina’s lips pressed together. She looked at the map, then at Isla, as if weighing whether honesty would survive in the space between them. When she spoke, her voice was little more than a whisper, but it carried the weight of a confession long rehearsed in the quiet corners of the city.\n\nAnd then the room’s lights flickered, briefly bathing them in a cold, blue glare. The map’s glow intensified on the marble floor, suggesting a route, a password, a path through the city’s hidden veins. It wasn’t a trap, not yet. It was an invitation.\n\nIsla realized then what the clue was truly asking: not who would steal or why, but where to begin. The map wasn’t just a message; it was a map of the city’s memory, drawn by someone who knew where every shadow slept and which doors remained unlocked after hours.\n\nIn that moment, she understood that the unusual clue wasn’t merel
... response truncated ...
</details>
<details>
<summary>Streaming Response — Enable streaming for real-time output</summary>
const response = await env.AI.run(
'openai/gpt-5-nano',
{
messages: [{ content: 'Explain the concept of recursion with a simple example.', role: 'user' }],
stream: true,
stream_options: { include_usage: true },
},
)
console.log(response)
curl 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": "openai/gpt-5-nano",
"messages": [
{
"content": "Explain the concept of recursion with a simple example.",
"role": "user"
}
],
"stream": true,
"stream_options": {
"include_usage": true
}
}'
Recursion is when a function solves a problem by calling itself to solve a smaller version of the same problem, and it uses a simple base case to stop.
Key ideas:
- Base case: a simple, known result that ends the recursion.
- Recursive step: the function calls itself with a smaller problem.
- Each call adds a new frame to the call stack, and results are returned back up once the base case is reached.
- Recursion eventually terminates when the base case is reached.
Simple example: factorial
- The factorial of n (written n!) is defined as:
- n! = n × (n-1)! for n > 0
- 0! = 1 (base case)
Example trace for n = 4:
- 4! = 4 × 3!
- 3! = 3 × 2!
- 2! = 2 × 1!
- 1! = 1 × 0!
- 0! = 1
Now compute back up:
- 1! = 1
- 2! = 2 × 1 = 2
- 3! = 3 × 2 = 6
- 4! = 4 × 6 = 24
Python code:
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
print(factorial(5)) # 120
Notes:
- Recursion is elegant and easy to express for problems like factorial, tree traversals, or divide-and-conquer tasks.
- It can use more memory due to the call stack and can hit a recursion depth limit for large inputs.
- An iterative version (loop) can be more memory-efficient if needed. Example:
def factorial_iter(n):
result = 1
for i in range(2, n + 1):
result *= i
return result
If you’d like, I can tailor a recursion example to a different problem.
[
{
"choices": [
{
"delta": {
"content": "",
"refusal": null,
"role": "assistant"
},
"finish_reason": null,
"index": 0
}
],
"created": 1777320010,
"id": "chatcmpl-DZMPiZzou66Tn3iPi5undITqdrV1R",
"model": "gpt-5-nano-2025-08-07",
"obfuscation": "QaiOK",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": null
},
{
"choices": [
{
"delta": {
"content": "Rec"
},
"finish_reason": null,
"index": 0
}
],
"created": 1777320010,
"id": "chatcmpl-DZMPiZzou66Tn3iPi5undITqdrV1R",
"model": "gpt-5-nano-2025-08-07",
"obfuscation": "3fFP",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": null
},
"... 422 more chunks omitted ...",
{
"choices": [],
"created": 1777320010,
"id": "chatcmpl-DZMPiZzou66Tn3iPi5undITqdrV1R",
"model": "gpt-5-nano-2025-08-07",
"obfuscation": "mfrEA02JD9ew9sU",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": null,
"usage": {
"completion_tokens": 2031,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 1600,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 16,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 2047
}
}
]
</details>
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-nano/#page","headline":"GPT-5 nano","description":"GPT-5 Nano is OpenAI’s smallest GPT-5 variant, optimized for low latency and cheap, high-throughput tasks.","url":"https://developers.cloudflare.com/ai/models/openai/gpt-5-nano/","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.1 is OpenAI’s incremental improvement over GPT-5, with stronger coding, reasoning, and writing. title: GPT-5.1 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.

