GPT-5.4 Pro
Text Generation • OpenAI • ProxiedGPT-5.4 Pro uses OpenAI's Responses API with built-in tools, improved reasoning, and stateful context management.
| Model Info | |
|---|---|
| Context Window ↗ | 1,000,000 tokens |
| Terms and License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
Usage
const response = await env.AI.run( 'openai/gpt-5.4-pro', { input: 'What are the three laws of thermodynamics?', }, { gateway: { id: 'default' }, })console.log(response)Examples
With Instructions — Using instructions to set context
const response = await env.AI.run( 'openai/gpt-5.4-pro', { input: 'How do I read a JSON file in Python?', instructions: 'You are a helpful coding assistant specializing in Python.', }, { gateway: { id: 'default' }, })console.log(response)Multi-turn Conversation — Continuing a conversation with message array
const response = await env.AI.run( 'openai/gpt-5.4-pro', { input: [ { role: 'user', content: 'I need help planning a road trip from San Francisco to Los Angeles.', }, { role: 'assistant', content: "I'd be happy to help! The drive is about 380 miles and takes roughly 5-6 hours. Would you like suggestions for scenic routes or interesting stops along the way?", }, { role: 'user', content: 'Yes, what are some good places to stop?', }, ], max_output_tokens: 150, }, { gateway: { id: 'default' }, })console.log(response)Input / Output JSON
{ "input": [ { "role": "user", "content": "I need help planning a road trip from San Francisco to Los Angeles." }, { "role": "assistant", "content": "I'd be happy to help! The drive is about 380 miles and takes roughly 5-6 hours. Would you like suggestions for scenic routes or interesting stops along the way?" }, { "role": "user", "content": "Yes, what are some good places to stop?" } ], "max_output_tokens": 150}{}Temperature Control — Using temperature for creative responses
const response = await env.AI.run( 'openai/gpt-5.4-pro', { input: 'Write a haiku about artificial intelligence', temperature: 1, }, { gateway: { id: 'default' }, })console.log(response)With Reasoning — Using reasoning effort for complex problems
const response = await env.AI.run( 'openai/gpt-5.4-pro', { input: 'Solve this problem step by step: A train leaves Chicago at 60mph heading east. Another train leaves New York at 80mph heading west. They are 900 miles apart. When do they meet?', reasoning: { effort: 'medium', }, }, { gateway: { id: 'default' }, })console.log(response)Parameters
one ofrequiredstringnumberminimum: 0maximum: 2numberexclusiveMinimum: 0numberminimum: 0maximum: 1booleanarrayobjectobjectstringstringconst: responsenumberstringarraystringstringenum: in_progress, completed, failed, incompleteobject