Claude 4.7
Move an app from Claude Opus 4.6 to Claude Opus 4.7: the model IDModel IDThe name a request calls a model by, lab/model, copied from Models.More on Models → changes, three sampling fields and the thinking budget go.
- Change the model ID.
- Update the request.
- Read the answer.
- Set the effort.
- Compare before you switch.
1. Change the model ID
Claude 4.7 is one model, Opus. For Sonnet, see Sonnet 5.
| From | To | |
|---|---|---|
| Model ID | anthropic/claude-opus-4.6 | anthropic/claude-opus-4.7 |
| Context | 1 000 000 tokens | 1 000 000 tokens |
| Longest answer | 128 000 tokens | 128 000 tokens |
| Reasoning | off unless you ask | off unless you ask |
| Effort levels | low · medium · high · max | low · medium · high · xhigh · max |
supported_parameters | holds temperature, top_p, top_k | holds none of the three |
GET /v1/model/{lab}/{model} answers each model's entry: its context, its longest answer, its fields, its reasoning. The request keeps its shape; model changes.
{
"model": "anthropic/claude-opus-4.7",
"reasoning": {
"enabled": true,
"effort": "xhigh"
},
"max_tokens": 64000,
"messages": [
{
"role": "user",
"content": "Refactor the payment module and list what changed."
}
]
}2. Update the request
| You send today | On Opus 4.7 | Send instead |
|---|---|---|
temperature, top_p or top_k | not taken; Anthropic refuses any value but the default | nothing: steer with the prompt |
a thinking budget: reasoning.max_tokens or thinking.budget_tokens | not honoured: reasoning is adaptive only | reasoning on, with an effort level |
| Route | Reasoning on, adaptive |
|---|---|
/v1/chat/completions | reasoning: {"enabled": true, "effort": "high"} |
/v1/messages | thinking: {"type": "adaptive"} and output_config.effort |
Keep temperature: 0 to make answers repeat. Opus 4.7 does not take it.
Ask for a fixed shape with Structured outputs, and state in the prompt what must not vary.
3. Read the answer
Anthropic lists four changes in what comes back.
| Change | What to do |
|---|---|
| a new tokenizer: the same text counts up to about 35 % more tokens | recount what your prompts hold, and check max_tokens |
on /v1/messages, thinking blocks come back with their text left out unless you ask | send thinking.display: "summarized" where you show the reasoning |
| pictures read up to 2 576 pixels on the long side, where 1 568 was the limit | shrink pictures that need no more detail: a larger one counts more tokens |
| requests on some security topics can be refused | treat a refusal as an answer, not a failure to retry: see Errors and retries |
Opus 4.7 also writes progress notes during long agent runs on its own. Remove any prompt line that forces them. Both routes: Chat · 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, and advises xhigh as the start for coding and agent work, high for most other work. xhigh is new, between high and max.
At xhigh or max, Anthropic's advice is a max_tokens of 64 000 to start: the reasoning and the reply both fit.
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 DADAThe Algerian dinar, the one currency the docs show.More on Balance and charges →, on every answer |
| how much each reasoned | usage.completion_tokens_details.reasoning_tokens |
The script sends each prompt to both IDs at one effort level, 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. After each pair it prints the recount: the new ID's prompt tokens over the old one's. Prose, French and code are counted differently, so the three prompts are of the three kinds.
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"
EFFORT = "high"
MAX_TOKENS = 16000
PROMPTS = [
"Explain in three lines why a parcel can be late on its way to Oran.",
"Le burnous existe en quelle taille, et en quelle couleur ?",
"Explain this function:\n"
"def total(items):\n"
" return sum(item.price * item.count for item in items)",
]
RUNS = [("old", MODEL), ("new", CANDIDATE)]
FIELDS = {"reasoning": {"enabled": True, "effort": EFFORT}}
client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
for prompt in PROMPTS:
print(prompt.splitlines()[0])
counted = {}
for label, model in RUNS:
reply = client.chat.completions.create(
model=model,
max_tokens=MAX_TOKENS,
messages=[{"role": "user", "content": prompt}],
extra_body=FIELDS,
)
usage = reply.usage
counted[label] = usage.prompt_tokens
details = usage.completion_tokens_details
thought = details.reasoning_tokens if details else 0
print(
f"{label:4} {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])
print("prompt tokens, new over old:", counted["new"] / counted["old"])The samples put anthropic/claude-sonnet-4.5 in both seats, so they run as they stand, and the recount reads 1. Set MODEL to anthropic/claude-opus-4.6 and CANDIDATE to anthropic/claude-opus-4.7.
Apply the recount to your own prompts: where it passes 1, raise max_tokens by the same share, and check what a long prompt now counts against the context.
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.
Last modified on