DEV Community

Cover image for Claude Opus 4.7: What Laravel AI SDK Developers Need to Check Before Upgrading
Hafiz
Hafiz

Posted on • Originally published at hafiz.dev

Claude Opus 4.7: What Laravel AI SDK Developers Need to Check Before Upgrading

Originally published at hafiz.dev


Claude Opus 4.7 dropped on April 16, 2026. If you're using the Laravel AI SDK with the Anthropic driver, there are breaking API changes that will throw 400 errors in your existing setup the moment you swap the model string. Not deprecation warnings. Not behavior shifts. Actual request failures.

This isn't a "what's new" roundup. It's a migration guide for Laravel developers who already have Anthropic agents in production and want to know exactly what to touch before flipping the switch.

The model string and pricing

Start with the easy bit. The API model ID is claude-opus-4-7. In your Laravel AI SDK agent, that's one line:

#[Provider(Lab::Anthropic)]
#[Model('claude-opus-4-7')]  // was: 'claude-opus-4-6'
class YourAgent implements Agent
{
    use Promptable;
}
Enter fullscreen mode Exit fullscreen mode

Pricing is unchanged from Opus 4.6: $5 per million input tokens, $25 per million output. That said, keep reading before you celebrate, because the new tokenizer changes the effective cost even though the per-token rate didn't.

The three breaking changes that will actually bite you

These apply to the Messages API. If you're using Claude Managed Agents, Anthropic says no breaking API changes are required beyond the model name. But the Laravel AI SDK talks to the Messages API under the hood, so you're affected.

1. The #[Temperature] attribute breaks on Opus 4.7

This is the one that will catch most Laravel AI SDK users off guard.

Starting with Opus 4.7, setting temperature, top_p, or top_k to any non-default value returns a 400 error. Not a warning. A hard failure.

The Laravel AI SDK's #[Temperature] attribute passes that value directly to the Anthropic API. So this:

#[Provider(Lab::Anthropic)]
#[Model('claude-opus-4-7')]
#[Temperature(0.7)]  // This will throw a 400 error
class YourAgent implements Agent
{
    use Promptable;
}
Enter fullscreen mode Exit fullscreen mode

Will fail at runtime. The fix is to remove the attribute entirely when using Opus 4.7 with the Anthropic driver:

#[Provider(Lab::Anthropic)]
#[Model('claude-opus-4-7')]
// No #[Temperature] - Anthropic controls this internally on Opus 4.7
class YourAgent implements Agent
{
    use Promptable;
}
Enter fullscreen mode Exit fullscreen mode

Same applies to any code that passes temperature directly through the SDK's fluent interface when calling Anthropic. Omit it.

If you were using temperature: 0 for determinism, note that this never actually guaranteed identical outputs on previous models either. Opus 4.7 just makes it explicit by refusing the parameter.

2. Extended thinking is gone, swap it for adaptive thinking

If you have any agents that used thinking: {type: "enabled", budget_tokens: N}, that now returns a 400 error as well.

Opus 4.7 replaces extended thinking with adaptive thinking. The model decides how much to think based on the task's complexity, guided by the effort level you set. You don't allocate a token budget manually anymore.

For the Anthropic PHP SDK directly, the before/after looks like this:

// Before (Opus 4.6)
$response = $client->messages()->create([
    'model'      => 'claude-opus-4-6',
    'max_tokens' => 64000,
    'thinking'   => ['type' => 'enabled', 'budget_tokens' => 32000],
    'messages'   => [['role' => 'user', 'content' => $prompt]],
]);

// After (Opus 4.7)
$response = $client->messages()->create([
    'model'         => 'claude-opus-4-7',
    'max_tokens'    => 64000,
    'thinking'      => ['type' => 'adaptive'],
    'output_config' => ['effort' => 'high'],
    'messages'      => [['role' => 'user', 'content' => $prompt]],
]);
Enter fullscreen mode Exit fullscreen mode

Adaptive thinking is off by default on Opus 4.7. If you don't set thinking: {type: "adaptive"} explicitly, the model runs without thinking, matching Opus 4.6's default behavior when no thinking was configured. Enable it explicitly when you want it.

3. Thinking content is silently omitted

This one doesn't throw an error, but it can cause a subtle bug if your agent streams reasoning to users or logs thinking blocks.

On Opus 4.7, thinking blocks still appear in the response stream, but their thinking field is empty by default. The previous default was to return summarized thinking text. If you have frontend code or logging that reads reasoning content from the response, it will now receive an empty string without any error telling you why.

To restore visible reasoning, opt in explicitly:

'thinking' => [
    'type'    => 'adaptive',
    'display' => 'summarized',  // default is 'omitted'
],
Enter fullscreen mode Exit fullscreen mode

If you're streaming responses and your UI shows a long pause before output starts, this is the cause. The model is thinking but not emitting visible progress. Set display: 'summarized' and the progress comes back.

The tokenizer change: your bill may go up

Opus 4.7 uses a new tokenizer. The same text now tokenizes to roughly 1x to 1.35x as many tokens as it did on Opus 4.6, varying by content. The per-token price didn't change. The token count for the same input did.

On a small single-turn prompt this is negligible. For multi-turn conversations, long system prompts, or agentic loops with large tool results, the compounding effect is real. A workflow that cost $10/day on Opus 4.6 could cost up to $13.50/day on Opus 4.7 without changing a single line of prompt.

Anthropic recommends updating your max_tokens to give extra headroom, including any context compaction triggers you have set. The 1M context window is unchanged and comes with no long-context premium.

Run your common prompts through /v1/messages/count_tokens on claude-opus-4-7 before and after to see your actual multiplier. It varies by content type, and code-heavy prompts tend to tokenize differently than prose. Dense PHP files and long Blade templates may be closer to the 1.35x ceiling, while short conversational messages sit nearer 1x. Check before you ship.

New features worth actually using

The xhigh effort level

Opus 4.7 adds xhigh as a new effort level above high. Anthropic recommends starting with xhigh for coding and agentic use cases, and a minimum of high for most intelligence-sensitive tasks. Lower effort levels (medium, low) trade quality for speed and cost.

This matters practically for the kind of agents covered in the multi-agent patterns post. A research agent that runs for several minutes benefits from xhigh. A quick classification call doesn't need more than medium.

The effort parameter is Messages API only. Claude Managed Agents handles effort automatically.

Task budgets for long agentic loops

This is worth knowing for anyone building workflows like the RAG support bot in part two of the AI SDK tutorial.

A task budget is an advisory token cap across the entire agentic loop, not per request. The model sees a running countdown and uses it to scope and prioritize work. It's distinct from max_tokens, which is a hard per-request cap the model never sees.

// Task budgets require the beta header + output_config
$response = $client->beta()->messages()->create([
    'model'         => 'claude-opus-4-7',
    'max_tokens'    => 128000,
    'output_config' => [
        'effort'      => 'high',
        'task_budget' => ['type' => 'tokens', 'total' => 128000],
    ],
    'messages'      => [['role' => 'user', 'content' => $prompt]],
    'betas'         => ['task-budgets-2026-03-13'],
]);
Enter fullscreen mode Exit fullscreen mode

Use task budgets when you need the model to self-moderate on a token allowance. Skip them for open-ended quality-first tasks where you don't care about scoping. The minimum value is 20k tokens.

High-resolution image support

If your agent processes screenshots, documents, or charts, this matters. Max image resolution went from 1568px to 2576px on the long edge. That's a jump from 1.15MP to 3.75MP. Coordinate mapping is now 1:1 with actual pixels, so no more scale-factor math when using computer use workflows.

High-res images use more tokens though. If you're sending images where the extra detail isn't needed, downsample before sending to avoid unnecessary token cost.

Behavior changes that might need prompt updates

These aren't breaking changes, but they can make existing prompts behave differently.

More literal instruction following. Opus 4.7 will not silently generalize an instruction from one item to another. If your prompt says "summarize the first document," it won't infer you also want the second one summarized. This is actually a net positive for structured workflows, but you might need to be more explicit in prompts that relied on the old model filling in gaps.

Fewer tool calls by default. The model uses reasoning more and makes fewer tool calls at lower effort levels. If your agent is not invoking tools as expected after upgrading, raise the effort level.

Response length calibrates to task complexity. Opus 4.7 doesn't default to a fixed verbosity. Short tasks get shorter responses, complex ones get longer. If you had prompts that said "be concise" to fight verbose defaults, try removing that scaffolding after upgrading and see if it's still needed.

More direct tone. Opus 4.7 is more opinionated and less validation-forward than 4.6. Fewer filler phrases, fewer emoji. For most developer-facing agents this is an improvement. If your product intentionally used a warmer persona, you may need to reinforce that in the system prompt.

Migration checklist

Before upgrading any production agent to claude-opus-4-7:

API breaking changes (fix these first):

  • [ ] Remove #[Temperature] attribute on all Anthropic agents, or confirm your SDK version handles this automatically
  • [ ] Search for temperature, top_p, top_k in any direct Anthropic API calls and remove them
  • [ ] Search for thinking: enabled or budget_tokens patterns and migrate to thinking: adaptive
  • [ ] Check any code that reads thinking content from responses and add display: "summarized" if needed

Token budget:

  • [ ] Run your heaviest prompts through count_tokens on claude-opus-4-7 and compare with 4.6
  • [ ] Update max_tokens to give extra headroom on long agentic loops
  • [ ] Adjust context compaction triggers if you have them

Behavior validation:

  • [ ] Run your existing eval suite or a sample of real prompts through Opus 4.7 before switching production traffic
  • [ ] Check tool-call rates in agentic workflows, raise effort if the model is under-calling
  • [ ] Review any prompts that relied on the model generalizing instructions across items

Automate the code changes:
Anthropic ships a Claude API skill for Claude Code that applies the model ID swap, breaking parameter changes, and effort calibration across your codebase automatically. In Claude Code, run:

/claude-api migrate this project to claude-opus-4-7
Enter fullscreen mode Exit fullscreen mode

It covers the same steps as the manual checklist above and outputs a list of items to verify manually after. Worth running before you do anything by hand.

Is the upgrade worth it?

For agentic coding workflows: yes, without much debate. Opus 4.7 records 64.3% on SWE-bench Pro and 87.6% on SWE-bench Verified. If you're building agents that write, review, or refactor Laravel code (the kind of thing covered in the complete Laravel AI SDK guide), the improvement on long-horizon autonomy is real.

For simple single-turn assistants: the breaking changes create migration work for no benefit if your use case doesn't involve agentic loops or vision. You can stay on Opus 4.6 for now. The model is not deprecated.

For anything processing images or documents: the resolution jump makes this worth it. 2576px is meaningfully better for reading dense screenshots, technical diagrams, and multi-column PDFs.

FAQ

Do the breaking changes apply if I'm using Claude Managed Agents instead of the Messages API?

No. Anthropic explicitly states that Claude Managed Agents has no breaking API changes for Opus 4.7. You only need to update the model name. The parameter changes described in this post apply to the Messages API, which is what the Laravel AI SDK uses under the hood.

Can I run Opus 4.6 and Opus 4.7 in the same Laravel app?

Yes. The model string is a per-agent attribute in the Laravel AI SDK, so you can point different agents at different models. Keep critical production agents on 4.6, migrate lower-stakes agents first, and validate before switching over.

If I remove #[Temperature], how do I control the model's behavior?

Prompting and the effort parameter. Anthropic's official guidance is to use prompting to guide behavior on Opus 4.7 rather than sampling parameters. If you need more creative outputs, say so in the system prompt. If you need more deterministic outputs, use stricter instructions and structured output schemas.

Will the tokenizer change affect my context window usage?

Yes. With up to 35% more tokens for the same input, you'll hit compaction or truncation thresholds sooner on long conversations. If you have logic that triggers a context summary at a specific token threshold, lower that threshold to compensate for the new tokenizer.

Is temperature still available on other Anthropic models like Haiku 4.5?

Probably, but I wouldn't assume it. The official docs say "Starting with Claude Opus 4.7, setting temperature, top_p, or top_k to any non-default value will return a 400 error," which reads like it's scoped to Opus 4.7 specifically for now. Before removing #[Temperature] from agents running Haiku or Sonnet, check the models overview directly rather than taking my word for it.

Conclusion

The summary is short: three things break, one of them silently. Remove #[Temperature] from Anthropic agents, update the extended thinking syntax if you use it, and check whether anything reads thinking content from responses. After that, Opus 4.7 is a meaningful upgrade for anything involving agentic coding or vision.

Run the migration on a staging environment first, validate with real traffic, then switch production. The /claude-api migrate skill handles most of the mechanical changes automatically.

Building something with the Laravel AI SDK that needs an architecture review before you push to production? Get in touch and let's talk through it.

Top comments (0)