# Opus 5

Move an app from Claude Opus 4.8 to Claude Opus 5: the model ID changes, and reasoning turns on by default.

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 | `anthropic/claude-opus-4.8` | `anthropic/claude-opus-5` |
| Context | 1 000 000 tokens | 1 000 000 tokens |
| Longest answer | 128 000 tokens | 128 000 tokens |
| Reasoning | off unless you ask: `default_enabled` is `false` | on unless you turn it off: `default_enabled` is `true` |
| Effort levels | `low` · `medium` · `high` · `xhigh` · `max` | the same five |

[`GET /v1/model/{lab}/{model}`](/docs/reference/model) answers each model's entry: its context, its longest answer, its `reasoning`. The request keeps its shape; `model` changes.

```json
{
  "model": "anthropic/claude-opus-5",
  "messages": [
    {
      "role": "user",
      "content": "Summarise this contract in five points."
    }
  ]
}
```

## 2. Update the request

| You send today | On Opus 5 | Send instead |
|---|---|---|
| no reasoning setting | the model reasons | nothing, or reasoning turned off, as below |
| reasoning off, with effort `xhigh` or `max` | refused | reasoning on at those levels, or effort `high` or lower |

To keep Opus 4.8's behaviour, turn reasoning off in the request, at effort `high` or lower.

| Route | Reasoning off |
|---|---|
| `/v1/chat/completions` | `reasoning: {"enabled": false}` |
| `/v1/messages` | `thinking: {"type": "disabled"}` |

```json
{
  "model": "anthropic/claude-opus-5",
  "reasoning": {
    "enabled": false,
    "effort": "high"
  },
  "messages": [
    {
      "role": "user",
      "content": "Summarise this contract in five points."
    }
  ]
}
```

Two additions, both on `/v1/messages` and both in beta at Anthropic, keep the start of the conversation unchanged, so a cached prompt stays cached: see [Caching](/docs/caching).

| To | Add |
|---|---|
| change the effort for one turn | a `system` message with empty `content` and `output_config.effort`, before that turn |
| add or remove a tool mid-conversation | a `system` message holding a `tool_addition` or `tool_removal` block that names the tool |

## 3. Read the answer

With reasoning on, every answer carries it, and the reasoning shares the ceiling with the reply.

| Route | Where the reasoning lands | Change |
|---|---|---|
| `/v1/chat/completions` | `choices[0].message.reasoning`, counted in `usage.completion_tokens_details.reasoning_tokens` | raise `max_tokens`: too low a ceiling ends with no text |
| `/v1/messages` | `thinking` blocks, ahead of the `text` block | read blocks by `type`, never `content[0]`; send `thinking` blocks back unchanged with tool results |

Reasoning also takes time before the first word: check your timeouts. Both routes: [Chat](/docs/reference/chat-completions) · [Messages](/docs/reference/messages).

## 4. Set the effort

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

Anthropic gives `high` as the default. Set the level in every request: lower it where answers hold, and use `xhigh` for long coding and agent work.

<div class="good-to-know">
<p>At <code>xhigh</code> or <code>max</code>, Anthropic's advice is a <code>max_tokens</code> of 64 000 to start: the reasoning and the reply both fit.</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` |

The script sends one task three ways and prints one line per run: how the answer ended, what the prompt counted, what the model reasoned, and the charge in DA, then the first words of the answer.

| Run | Model | Reasoning |
|---|---|---|
| `old` | `MODEL` | no setting: the model's own default |
| `new, default` | `CANDIDATE` | no setting: the model's own default |
| `new, off` | `CANDIDATE` | off, at effort `high` |

```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"
CANDIDATE = "anthropic/claude-sonnet-4.5"
MAX_TOKENS = 8000
TASK = (
    "Summarise this contract in five points.\n\n"
    "The supplier delivers 200 kilos of dates to Biskra each month. "
    "Payment is due 30 days after delivery, and a late payment adds "
    "a fee. Either side may end the contract with 60 days' notice."
)
DEFAULT = {}
OFF = {"reasoning": {"enabled": False, "effort": "high"}}
RUNS = [
    ("old", MODEL, DEFAULT),
    ("new, default", CANDIDATE, DEFAULT),
    ("new, off", CANDIDATE, OFF),
]

client = OpenAI(base_url=BASE_URL, api_key=API_KEY)

for label, model, fields in RUNS:
    reply = client.chat.completions.create(
        model=model,
        max_tokens=MAX_TOKENS,
        messages=[{"role": "user", "content": TASK}],
        extra_body=fields,
    )
    usage = reply.usage
    details = usage.completion_tokens_details
    thought = details.reasoning_tokens if details else 0
    print(
        f"{label:13} {reply.choices[0].finish_reason:7}",
        f"in {usage.prompt_tokens}",
        f"thought {thought}",
        f"cost {usage.cost}",
    )
    print("   ", (reply.choices[0].message.content or "")[:60])
```

```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 CANDIDATE = "anthropic/claude-sonnet-4.5";
const MAX_TOKENS = 8000;
const TASK =
  "Summarise this contract in five points.\n\n" +
  "The supplier delivers 200 kilos of dates to Biskra each month. " +
  "Payment is due 30 days after delivery, and a late payment adds " +
  "a fee. Either side may end the contract with 60 days' notice.";
const DEFAULT = {};
const OFF = { reasoning: { enabled: false, effort: "high" } };
const RUNS = [
  ["old", MODEL, DEFAULT],
  ["new, default", CANDIDATE, DEFAULT],
  ["new, off", CANDIDATE, OFF],
];

const client = new OpenAI({ baseURL: BASE_URL, apiKey: API_KEY });

for (const [label, model, fields] of RUNS) {
  const reply = await client.chat.completions.create({
    model,
    max_tokens: MAX_TOKENS,
    messages: [{ role: "user", content: TASK }],
    ...fields,
  });
  const { usage, choices } = reply;
  const thought = usage.completion_tokens_details?.reasoning_tokens ?? 0;
  console.log(
    label.padEnd(13),
    choices[0].finish_reason.padEnd(7),
    `in ${usage.prompt_tokens}`,
    `thought ${thought}`,
    `cost ${usage.cost}`,
  );
  console.log("   ", (choices[0].message.content ?? "").slice(0, 60));
}
```

```go
package main

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

	"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"
	candidate = "anthropic/claude-sonnet-4.5"
	maxTokens = 8000
	task      = "Summarise this contract in five points.\n\n" +
		"The supplier delivers 200 kilos of dates to Biskra each " +
		"month. Payment is due 30 days after delivery, and a late " +
		"payment adds a fee. Either side may end the contract " +
		"with 60 days' notice."
)

type run struct {
	label  string
	model  string
	fields map[string]any
}

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

	def := map[string]any{}
	off := map[string]any{
		"reasoning": map[string]any{"enabled": false, "effort": "high"},
	}
	runs := []run{
		{"old", model, def},
		{"new, default", candidate, def},
		{"new, off", candidate, off},
	}

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

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"
CANDIDATE="anthropic/claude-sonnet-4.5"
TASK="Summarise this contract in five points. \
The supplier delivers 200 kilos of dates to Biskra each month. \
Payment is due 30 days after delivery, and a late payment adds a fee. \
Either side may end the contract with 60 days' notice."
DEFAULT='{}'
OFF='{"reasoning": {"enabled": false, "effort": "high"}}'

run() {
  jq -n --arg model "$2" --arg task "$TASK" --argjson fields "$3" \
    '{model: $model, max_tokens: 8000,
      messages: [{role: "user", content: $task}]} + $fields' |
    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,
      in: .usage.prompt_tokens,
      thought: .usage.completion_tokens_details.reasoning_tokens,
      cost: .usage.cost,
      answer: ((.choices[0].message.content // "") | .[:60])}'
}

run "old" "$MODEL" "$DEFAULT"
run "new, default" "$CANDIDATE" "$DEFAULT"
run "new, off" "$CANDIDATE" "$OFF"
```

The samples put `anthropic/claude-sonnet-4.5` in both seats, so they run as they stand. Set `MODEL` to `anthropic/claude-opus-4.8` and `CANDIDATE` to `anthropic/claude-opus-5`.

The first two lines differ in the model alone: `thought` shows the change of default, from none to some. The third line is Opus 4.8's behaviour kept on Opus 5, at an effort `high` or lower.

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).
