Skip to content
AIAI Tools Hub
Tutorial

Claude Opus 5 API: A Practical Getting-Started Guide

Model ID, parameters, and the four API defaults that surprise people migrating to Claude Opus 5.

AI Tools Hub Editorial TeamUpdated July 27, 20264 min read

The Claude Opus 5 API is the same Messages API you already know, with one model ID and a handful of defaults worth knowing before you ship. This is the short version of what actually changes for a developer.

The essentials

Model IDclaude-opus-5
EndpointMessages API (/v1/messages)
Context1M tokens, default and maximum
Max output128K tokens
Official SDKsPython, TypeScript, Java, Go, Ruby, C#, PHP

Model IDs carry no date suffix — claude-opus-5 is complete as written. On Amazon Bedrock the same model takes an anthropic. prefix.

Four defaults that catch people out

  1. Thinking is on by default. Omitting the thinking parameter runs adaptive thinking, unlike Opus 4.8 where omitting it meant no thinking. Since your max-token budget covers thinking and response text together, a tightly-sized limit can now truncate.
  2. Disabling thinking is capped at high effort. Combining disabled thinking with xhigh or max returns a 400, and the check runs on every request.
  3. Sampling parameters are gone. temperature, top_p, and top_k are rejected. Steer behaviour with prompting and the effort level instead.
  4. No assistant prefill. Ending your messages array with an assistant turn returns a 400. Use structured outputs or a system-prompt instruction to control response format.

Parameters worth setting deliberately

  • output_config.effortlow through max, defaulting to high. This is the main quality-versus-cost dial.
  • max_tokens — stream anything above roughly 16K to avoid HTTP timeouts; 128K is the ceiling.
  • cache_control — caches from 512 tokens up on this model, half the previous minimum.
  • speed: "fast" — fast mode, at double the price, on the Claude API only.

Handle refusals before reading content

Opus 5 ships with elevated safety classifiers that can decline a request. A refusal returns a normal HTTP 200 with stop_reason: "refusal" and an empty or partial content array — so code that reads content[0] unconditionally will break rather than fail cleanly.

Check stop_reason first. The API also offers a server-side fallback option that re-runs a declined request on another model automatically, which is worth enabling by default for production traffic: cyber-category refusals route to Opus 4.8.

More on Claude Opus 5

Start with the complete Claude Opus 5 guide for the overview, or go deeper:

Frequently Asked Questions

What is the model ID for Claude Opus 5?

`claude-opus-5` on the Claude API, Google Cloud Vertex AI, and Microsoft Foundry. On Amazon Bedrock it is `anthropic.claude-opus-5`. There is no date suffix — the ID is complete as written.

Why does my Claude Opus 5 request return a 400?

The most common causes are parameters that were removed: `temperature`, `top_p`, `top_k`, and the old `budget_tokens` thinking configuration all return 400. Two others are specific to Opus 5 — an assistant-turn prefill, and disabling thinking while requesting `xhigh` or `max` effort.

Do I need to change my code to migrate from Opus 4.8?

Usually only the model ID string. The bigger risks are behavioural: thinking is now on by default, which changes how your max-token budget is consumed, and prompts that instruct the model to verify its own work now cause redundant effort.

Tools Mentioned

Related Articles