# GPT-5.4

Move an app from GPT-5.2 to GPT-5.4: the model ID changes, and the rest of the request mostly stays.

1. [Change the model ID](#1-change-the-model-id).
2. [Update the request](#2-update-the-request).
3. [Read the answer](#3-read-the-answer).
4. [Set the effort](#4-set-the-effort).
5. [Compare before you switch](#5-compare-before-you-switch).

## 1. Change the model ID

| | From | To |
|---|---|---|
| Model ID | `openai/gpt-5.2` | `openai/gpt-5.4` |
| Context | 400 000 tokens | 1 050 000 tokens |
| Longest answer | 128 000 tokens | 128 000 tokens |
| Effort levels | `none` · `low` · `medium` · `high` · `xhigh` | the same five |

Both list the same fields in `supported_parameters`. GPT-5.4 comes as five IDs.

| Model ID | For | Context |
|---|---|---|
| `openai/gpt-5.4` | general work: reasoning, knowledge, code, agents | 1 050 000 tokens |
| `openai/gpt-5.4-pro` | hard problems, with more reasoning; always reasons, at `medium`, `high` or `xhigh` | 1 050 000 tokens |
| `openai/gpt-5.4-mini` | high-volume coding and agent work | 400 000 tokens |
| `openai/gpt-5.4-nano` | speed and volume first | 400 000 tokens |
| `openai/gpt-5.4-image-2` | text and pictures in one answer | 272 000 tokens |

Each also exists with `:batch` at its end, for batch work. [`GET /v1/model/{lab}/{model}`](/docs/reference/model) answers each model's entry. The request keeps its shape; `model` changes.

```json
{
  "model": "openai/gpt-5.4",
  "reasoning": {
    "effort": "medium"
  },
  "messages": [
    {
      "role": "user",
      "content": "Draft the release notes from this changelog."
    }
  ]
}
```

## 2. Update the request

| You send today | On GPT-5.4 | Send instead |
|---|---|---|
| `temperature` or `top_p` | not in any GPT-5.4 ID's `supported_parameters`; OpenAI takes them at effort `none` only | nothing: steer with the prompt |
| a model from before GPT-5.2 | — | OpenAI's pairing, in the table below |

| Moving from | OpenAI's advice |
|---|---|
| GPT-5.2 | `openai/gpt-5.4` at its default settings |
| o3 | `openai/gpt-5.4` at effort `medium`, then `high` if answers fall short |
| GPT-4.1 | `openai/gpt-5.4` at effort `none`, then higher if needed |
| o4-mini or GPT-4.1 mini | `openai/gpt-5.4-mini` |
| GPT-4.1 nano | `openai/gpt-5.4-nano` |

## 3. Read the answer

On `/v1/chat/completions`, the answer keeps its shape: one message, the reasoning counted in `usage.completion_tokens_details.reasoning_tokens`. See [Chat](/docs/reference/chat-completions).

On `/v1/responses`, a long or tool-heavy answer can hold several `assistant` messages, each with a `phase`: `commentary` for a note on the way, `final_answer` for the answer. Send every one back with its `phase` unchanged on the next turn. A dropped `phase` can make the model take a note for its answer and stop early.

```json
{
  "model": "openai/gpt-5.4",
  "input": [
    {
      "role": "user",
      "content": "Refactor the auth module."
    },
    {
      "type": "message",
      "role": "assistant",
      "phase": "commentary",
      "content": [
        {
          "type": "output_text",
          "text": "I'll start by reading the module."
        }
      ]
    },
    {
      "type": "message",
      "role": "assistant",
      "phase": "final_answer",
      "content": [
        {
          "type": "output_text",
          "text": "Here is the refactored module: …"
        }
      ]
    },
    {
      "role": "user",
      "content": "Now add the tests."
    }
  ]
}
```

A `phase` goes on `assistant` messages only.

## 4. Set the effort

| Route | Field |
|---|---|
| `/v1/chat/completions` | `reasoning.effort`, or `reasoning_effort` |

OpenAI gives `none` as GPT-5.4's lowest level and its default. Set the level in every request: from GPT-5.2, keep the level you ran; with no level set, start at `none` and raise it where answers fall short.

<div class="good-to-know">
<p>At effort <code>none</code>, ask the model in the prompt to outline its steps before it answers. OpenAI advises it for better reasoning.</p>
</div>

## 5. Compare before you switch

Send the same set of real prompts to both IDs, and compare three things.

| Compare | Where |
|---|---|
| the answers | your own check: a test suite, a reviewer, the task's pass rate |
| what each cost | `usage.cost`, in DA, on every answer |
| how much each reasoned | `usage.completion_tokens_details.reasoning_tokens` |

GPT-5.4 comes as tiers, so the comparison is a sweep: the same prompts to the old ID and to each tier, at one effort level. The script prints one line per run: how the answer ended, what the model reasoned, and the charge in DA, then the first words of the answer. At the end it prints what each tier cost over all the prompts.

| Run | Model |
|---|---|
| `from` | `MODEL` |
| `general` | the `general` tier of `TIERS` |
| `mini` | the `mini` tier |
| `nano` | the `nano` tier |

```python
import os
from openai import OpenAI

API_KEY = os.environ["OPENDUNES_API_KEY"]
BASE_URL = "https://opendunes.com/v1"
MODEL = "anthropic/claude-sonnet-4.5"
TIERS = {
    "general": "anthropic/claude-sonnet-4.5",
    "mini": "anthropic/claude-sonnet-4.5",
    "nano": "anthropic/claude-sonnet-4.5",
}
EFFORT = "medium"
MAX_TOKENS = 4000
PROMPTS = [
    "Draft the release notes from this changelog:\n"
    "- orders export fixed\n- delivery slots added",
    "Is this message an order, a complaint or something else? "
    "Answer in one word.\n'My parcel never came.'",
]
RUNS = [("from", MODEL), *TIERS.items()]

client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
totals = {label: 0.0 for label, _ in RUNS}

for prompt in PROMPTS:
    print(prompt.splitlines()[0])
    for label, model in RUNS:
        reply = client.chat.completions.create(
            model=model,
            max_tokens=MAX_TOKENS,
            messages=[{"role": "user", "content": prompt}],
            extra_body={"reasoning": {"effort": EFFORT}},
        )
        usage = reply.usage
        details = usage.completion_tokens_details
        thought = details.reasoning_tokens if details else 0
        totals[label] += usage.cost
        print(
            f"{label:8} {reply.choices[0].finish_reason:7}",
            f"thought {thought}",
            f"cost {usage.cost}",
        )
        print("   ", (reply.choices[0].message.content or "")[:60])

print(totals)
```

```javascript
import OpenAI from "openai";

const API_KEY = process.env.OPENDUNES_API_KEY;
const BASE_URL = "https://opendunes.com/v1";
const MODEL = "anthropic/claude-sonnet-4.5";
const TIERS = {
  general: "anthropic/claude-sonnet-4.5",
  mini: "anthropic/claude-sonnet-4.5",
  nano: "anthropic/claude-sonnet-4.5",
};
const EFFORT = "medium";
const MAX_TOKENS = 4000;
const PROMPTS = [
  "Draft the release notes from this changelog:\n" +
    "- orders export fixed\n- delivery slots added",
  "Is this message an order, a complaint or something else? " +
    "Answer in one word.\n'My parcel never came.'",
];
const RUNS = [["from", MODEL], ...Object.entries(TIERS)];

const client = new OpenAI({ baseURL: BASE_URL, apiKey: API_KEY });
const totals = Object.fromEntries(RUNS.map(([label]) => [label, 0]));

for (const prompt of PROMPTS) {
  console.log(prompt.split("\n")[0]);
  for (const [label, model] of RUNS) {
    const reply = await client.chat.completions.create({
      model,
      max_tokens: MAX_TOKENS,
      messages: [{ role: "user", content: prompt }],
      reasoning: { effort: EFFORT },
    });
    const { usage, choices } = reply;
    const thought = usage.completion_tokens_details?.reasoning_tokens ?? 0;
    totals[label] += usage.cost;
    console.log(
      label.padEnd(8),
      choices[0].finish_reason.padEnd(7),
      `thought ${thought}`,
      `cost ${usage.cost}`,
    );
    console.log("   ", (choices[0].message.content ?? "").slice(0, 60));
  }
}

console.log(totals);
```

```go
package main

import (
	"context"
	"fmt"
	"os"
	"strconv"
	"strings"

	"github.com/openai/openai-go/v3"
	"github.com/openai/openai-go/v3/option"
)

const (
	baseURL   = "https://opendunes.com/v1"
	model     = "anthropic/claude-sonnet-4.5"
	general   = "anthropic/claude-sonnet-4.5"
	mini      = "anthropic/claude-sonnet-4.5"
	nano      = "anthropic/claude-sonnet-4.5"
	effort    = "medium"
	maxTokens = 4000
)

type run struct {
	label string
	model string
}

func main() {
	apiKey := os.Getenv("OPENDUNES_API_KEY")

	prompts := []string{
		"Draft the release notes from this changelog:\n" +
			"- orders export fixed\n- delivery slots added",
		"Is this message an order, a complaint or something else? " +
			"Answer in one word.\n'My parcel never came.'",
	}
	runs := []run{
		{"from", model},
		{"general", general},
		{"mini", mini},
		{"nano", nano},
	}
	fields := map[string]any{
		"reasoning": map[string]any{"effort": effort},
	}

	client := openai.NewClient(
		option.WithBaseURL(baseURL),
		option.WithAPIKey(apiKey),
	)
	totals := map[string]float64{}
	for _, prompt := range prompts {
		fmt.Println(strings.Split(prompt, "\n")[0])
		for _, r := range runs {
			params := openai.ChatCompletionNewParams{
				Model:     openai.ChatModel(r.model),
				MaxTokens: openai.Int(maxTokens),
				Messages: []openai.ChatCompletionMessageParamUnion{
					openai.UserMessage(prompt),
				},
			}
			params.SetExtraFields(fields)
			reply, err := client.Chat.Completions.New(
				context.TODO(), params)
			if err != nil {
				panic(err)
			}
			choice := reply.Choices[0]
			cost := charge(reply)
			totals[r.label] += cost
			fmt.Printf("%-8s %-7s thought %d cost %v\n",
				r.label, choice.FinishReason,
				reply.Usage.CompletionTokensDetails.ReasoningTokens,
				cost)
			fmt.Printf("    %.60s\n", choice.Message.Content)
		}
	}

	fmt.Println(totals)
}

func charge(reply *openai.ChatCompletion) float64 {
	cost := reply.Usage.JSON.ExtraFields["cost"].Raw()
	value, _ := strconv.ParseFloat(cost, 64)
	return value
}
```

```bash cURL
ADDRESS="https://opendunes.com/v1/chat/completions"
MODEL="anthropic/claude-sonnet-4.5"
GENERAL="anthropic/claude-sonnet-4.5"
MINI="anthropic/claude-sonnet-4.5"
NANO="anthropic/claude-sonnet-4.5"
EFFORT="medium"
NOTES="Draft the release notes from this changelog: \
- orders export fixed - delivery slots added"
SORT="Is this message an order, a complaint or something else? \
Answer in one word. 'My parcel never came.'"

run() {
  jq -n --arg model "$2" --arg prompt "$PROMPT" --arg effort "$EFFORT" \
    '{model: $model, max_tokens: 4000,
      reasoning: {effort: $effort},
      messages: [{role: "user", content: $prompt}]}' |
    curl -s "$ADDRESS" \
      -H "Authorization: Bearer $OPENDUNES_API_KEY" \
      -H "Content-Type: application/json" \
      -d @- |
    jq -c --arg label "$1" '{label: $label,
      finish: .choices[0].finish_reason,
      thought: .usage.completion_tokens_details.reasoning_tokens,
      cost: .usage.cost,
      answer: ((.choices[0].message.content // "") | .[:60])}'
}

for PROMPT in "$NOTES" "$SORT"; do
  run "from" "$MODEL"
  run "general" "$GENERAL"
  run "mini" "$MINI"
  run "nano" "$NANO"
done | tee /dev/stderr |
  jq -sc 'group_by(.label) | map({label: .[0].label,
    cost: (map(.cost) | add)})'
```

The samples put `anthropic/claude-sonnet-4.5` in every seat, so they run as they stand. Set `MODEL` to `openai/gpt-5.2`, and the three tiers to the IDs below.

| Tier | Model ID |
|---|---|
| `general` | `openai/gpt-5.4` |
| `mini` | `openai/gpt-5.4-mini` |
| `nano` | `openai/gpt-5.4-nano` |

Read the totals against your own check on the answers: the cheapest tier whose answers hold is the one to switch to. The one-word classification is the work `nano` is for, where speed and volume come first.

Switch once the new ID holds; going back is the same one-line change. Run your red-team suite on the new ID too: [Red teaming](/docs/cookbook/red-teaming).
