Files
CherryHQ-cherry-studio/.changeset
SuYao 1f867749b8 fix(anthropic): support Claude Opus 4.7 (#14349)
### What this PR does

Before this PR:
- Selecting Claude Opus 4.7 (`claude-opus-4-7`) in Cherry Studio could
not work:
- The model is not in the catalog, so users could only add it manually
as a custom model.
- With reasoning enabled, Cherry would send `effort: 'max'` (4.6
mapping) instead of the native `xhigh` that 4.7 supports, and
`thinking.display` would default to `omitted` — stripping reasoning text
from the response and breaking Cherry's thinking UI.
- Temperature and top_p were still sent when `reasoning_effort` was
`default` or `none`, which Opus 4.7 rejects with HTTP 400 regardless of
reasoning settings.
- `getMaxTokens` subtracted a thinking budget for 4.6 / 4.7 (both use
adaptive thinking and do not send `budgetTokens`), incorrectly shrinking
`max_tokens`.

After this PR:
- `claude-opus-4-7` is catalogued under the Anthropic provider with a
128K output-token limit, routed through the existing `claude46`
reasoning-effort type so it shares the `[low, medium, high, xhigh]`
option list.
- Opus 4.7 sends native `xhigh` to Anthropic (Opus 4.6 still sends
`max`). Bedrock continues to map `xhigh → 'max'` until
`@ai-sdk/amazon-bedrock` adds `xhigh`.
- Adaptive thinking defaults to `display: 'summarized'` on Opus 4.7, so
reasoning text continues to stream back for Cherry's UI.
- `temperature` and `top_p` are dropped unconditionally for Opus 4.7 in
`getTemperature` / `getTopP`.
- `getMaxTokens` skips the budget subtraction for both 4.6 and 4.7
(shared adaptive-thinking path).
- At the agent-session dispatch site, `effort: 'xhigh'` is mapped to
`'max'` and the `display` field is stripped before reaching the Claude
Agent SDK (whose types do not yet include them).

Fixes #

### Why we need it and why it was done in this way

The following tradeoffs were made:
- Opus 4.7 shares the `claude46` thinking model type (same effort
options) instead of introducing a new `claude47` enum member. This
avoids churn in `ThinkingModelType` / `MODEL_SUPPORTED_OPTIONS`, and the
provider-boundary mapping (xhigh → native on 4.7, xhigh → max on 4.6)
cleanly expresses the only real difference.
- `thinking.display` is defaulted to `'summarized'` so existing Cherry
behavior (reasoning text streamed to the UI) is preserved. The Anthropic
API default is `'omitted'`, which would silently remove reasoning
content.
- `getMaxTokens` fix for 4.6 is applied alongside 4.7 because the same
code path is touched. This is in scope for the hotfix — the 4.7 path
cannot work correctly without it.
- The agent-session call site performs a local narrowing (`xhigh →
'max'`, strip `display`) rather than extending `AgentEffort` /
`AgentThinkingConfig` schemas. This keeps the change small and
compatible with the currently installed `@anthropic-ai/claude-agent-sdk`
type shape.

The following alternatives were considered:
- Introducing a new `claude47` `ThinkingModelType` variant and dedicated
option lists. Rejected — the effort list is identical to 4.6; a new
variant would duplicate data without adding behavior.
- Wiring `taskBudget` support (the agentic-workflow token budget
introduced in the same Vercel AI SDK PR). Intentionally out of scope —
Cherry has no UI or call site that would supply one, and it is not a
hotfix-class concern.
- Extending `AgentEffortSchema` and `AgentThinkingConfigSchema`
end-to-end. Rejected — the Claude Agent SDK still types `effort` as
`'low' | 'medium' | 'high' | 'max'` and `ThinkingAdaptive` as `{ type:
'adaptive' }`, so the schema widening would have to be undone at the SDK
boundary anyway.

Links to places where the discussion took place:
https://github.com/vercel/ai/pull/14529

### Breaking changes

None. Existing Claude 4.6 and earlier Claude models are unchanged.

### Special notes for your reviewer

- Targeted at `main` as a hotfix per the code-freeze policy. The same
fix should probably land on `v2` as well after this merges, but that is
a separate PR.
- `@ai-sdk/anthropic` is bumped to `^3.0.71` (minimum version that
exposes the Opus 4.7 / `xhigh` / `display` / `taskBudget` types). The
lockfile resolves to `3.0.71`. No other `@ai-sdk/*` packages are
touched.
- Added tests:
- `src/renderer/src/config/models/__tests__/utils.test.ts` —
`isClaude47SeriesModel` detection across direct API / Bedrock / Vertex
formats.
- `src/renderer/src/config/models/__tests__/reasoning.test.ts` —
`findTokenLimit` returns 128K for 4.7, and `getThinkModelType` routes
4.7 to `claude46`.
- `src/renderer/src/aiCore/utils/__tests__/reasoning.test.ts` —
`getAnthropicReasoningParams` returns `{ thinking: { type: 'adaptive',
display: 'summarized' }, effort: 'xhigh' }` for Opus 4.7 + xhigh, and
the `display` field is present even when no effort is set.
-
`src/renderer/src/aiCore/prepareParams/__tests__/model-parameters.test.ts`
— `getTemperature` / `getTopP` return `undefined` for Opus 4.7
regardless of reasoning settings.
- `pnpm lint` and `pnpm test` pass locally (3488 passed | 72 skipped).
One pre-existing Shiki tokenizer test is flaky under full-suite ordering
but passes in isolation and on clean `main`; unrelated to this change.

### Checklist

This checklist is not enforcing, but it's a reminder of items that could
be relevant to every PR.
Approvers are expected to review this list.

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [x] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
Add support for Claude Opus 4.7 (`claude-opus-4-7`), including native `xhigh` reasoning effort, adaptive thinking with summarized display (so reasoning text continues to stream to the UI), and the new API requirement that `temperature` / `top_p` be omitted.
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
2026-05-07 13:27:56 +08:00
..

Changesets

This folder contains configuration and changeset files for managing package versioning and publishing in the Cherry Studio monorepo.

What is Changesets?

Changesets is a tool to help manage versioning and publishing for multi-package repositories. It tracks changes to packages and automates:

  • Version bumping based on semantic versioning
  • Changelog generation
  • Package publishing
  • Dependency updates between packages

Quick Start

Adding a changeset

When you make changes that should be published, run:

pnpm changeset add

This will:

  1. Ask which packages have changed
  2. Ask for the type of change (patch/minor/major)
  3. Ask for a description of the change
  4. Create a changeset file in .changeset/

Note

: CI will check that PRs modifying packages include a changeset.

Versioning and publishing

Versioning and publishing are handled automatically by CI — you do not need to run changeset version or changeset publish locally. See the CI/CD Integration section below.

Configuration

See config.json for the changeset configuration:

  • changelog: Uses @changesets/changelog-github to generate GitHub-linked changelogs
  • access: public - packages are published publicly
  • baseBranch: main - PRs target this branch
  • updateInternalDependencies: patch - internal deps are updated on any change

Packages managed

Package Description
@cherrystudio/ai-core Unified AI Provider Interface
@cherrystudio/ai-sdk-provider AI SDK provider bundle with CherryIN routing
@cherrystudio/extension-table-plus Table extension for Tiptap

Dependency relationships

ai-core (peer-depends on) → ai-sdk-provider

Changeset automatically handles updating peer dependency ranges when ai-sdk-provider is published.

CI/CD Integration

The release workflow (.github/workflows/release-packages.yml) uses changesets/action and works in two phases:

Phase 1 — Accumulate changes

When a PR containing changeset files is merged to main, the action detects pending changesets and creates or updates a "Version Packages" PR. This PR:

  • Bumps package versions based on all accumulated changesets
  • Generates/updates CHANGELOG.md for each package
  • Deletes consumed changeset files

Multiple PRs with changesets can merge before a release — the Version Packages PR keeps updating to include all of them.

Phase 2 — Publish

When a maintainer decides it's time to release, they merge the Version Packages PR. This triggers the workflow again, and since there are no more pending changesets, the action runs pnpm changeset:publish to publish the updated packages to npm.

In short: changesets accumulate automatically; you control when to release by merging the Version Packages PR.

Learn more