Skip to content
OpenAI logo

GPT-5.4 Pro

Text GenerationOpenAIProxied

GPT-5.4 Pro uses OpenAI's Responses API with built-in tools, improved reasoning, and stateful context management.

Model Info
Context Window1,000,000 tokens
Terms and Licenselink
More informationlink
PricingView pricing in the Cloudflare dashboard

Usage

TypeScript
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)
Input / Output JSON
{
"input": "What are the three laws of thermodynamics?"
}

Examples

With Instructions — Using instructions to set context
TypeScript
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)
Input / Output JSON
{
"input": "How do I read a JSON file in Python?",
"instructions": "You are a helpful coding assistant specializing in Python."
}
Multi-turn Conversation — Continuing a conversation with message array
TypeScript
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
TypeScript
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)
Input / Output JSON
{
"input": "Write a haiku about artificial intelligence",
"temperature": 1
}
With Reasoning — Using reasoning effort for complex problems
TypeScript
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)
Input / Output JSON
{
"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"
}
}

Parameters

instructions
string
temperature
numberminimum: 0maximum: 2
max_output_tokens
numberexclusiveMinimum: 0
top_p
numberminimum: 0maximum: 1
stream
boolean
tool_choice

API Schemas (Raw)

Input
Output