Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(models): 更新 GPT-6 Sol、Luna 与 Opus 5.5 参数和适配 (#4898)

Dash97c2439383a6
diff --git a/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts b/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
index a3d6c987dc..862c239f6a 100644
--- a/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
+++ b/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
@@ -88,6 +88,9 @@ function createLocalDb(): Database.Database {
feishu_bot_app_id TEXT,
used_project_context INTEGER NOT NULL DEFAULT 0,
extra_dirs TEXT NOT NULL DEFAULT '[]',
+ list_preview TEXT,
+ list_preview_role TEXT,
+ list_message_count INTEGER,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);
@@ -375,6 +378,39 @@ describe('parseClaudeCodeMessageLine', () => {
expect(rows[0].agentMeta).toMatchObject({ model: 'claude-opus-4-8' });
});
+ it.each([
+ 'claude-opus-5-5',
+ 'claude-opus-5-5-20260922',
+ 'claude-opus-5-5[1m]',
+ 'claude-opus-5-5-20260922[1m]',
+ ])('preserves %s in imported session and message models', async (model) => {
+ const home = fs.mkdtempSync(path.join(os.tmpdir(), 'claude-opus55-import-'));
+ const projectDir = path.join(home, '.claude', 'projects', '-tmp-project');
+ fs.mkdirSync(projectDir, { recursive: true });
+ fs.writeFileSync(path.join(projectDir, `${sdkSessionId}.jsonl`), line({
+ type: 'assistant', uuid: 'assistant-opus55', cwd: '/tmp/project',
+ message: { role: 'assistant', model, content: [{ type: 'text', text: 'ok' }] },
+ }) + '\n');
+ const db = createLocalDb();
+ const homedir = vi.spyOn(os, 'homedir').mockReturnValue(home);
+ setLocalDb(db);
+ try {
+ expect(await importExternalClaudeCodeSessions([sdkSessionId])).toMatchObject({ inserted: 1 });
+ expect(db.prepare('SELECT model FROM sessions WHERE id = ?').get(`claude-${sdkSessionId}`))
+ .toEqual({ model: 'claude-opus-5-5' });
+ await importExternalClaudeCodeMessagesForSession(`claude-${sdkSessionId}`);
+ const rows = db.prepare('SELECT agent_meta AS agentMeta FROM messages WHERE session_id = ?')
+ .all(`claude-${sdkSessionId}`) as { agentMeta: string }[];
+ expect(rows).toHaveLength(1);
+ expect(JSON.parse(rows[0].agentMeta)).toMatchObject({ model: 'claude-opus-5-5' });
+ } finally {
+ homedir.mockRestore();
+ resetLocalDb();
+ db.close();
+ fs.rmSync(home, { recursive: true, force: true });
+ }
+ });
+
it('normalizes opus-5 [1m] wire model id to catalog id', () => {
const rows = parseClaudeCodeMessageLine(
line({
diff --git a/apps/desktop/src/main/maker-host/claude-local-sessions.ts b/apps/desktop/src/main/maker-host/claude-local-sessions.ts
index 0553333992..d8c6e9b622 100644
--- a/apps/desktop/src/main/maker-host/claude-local-sessions.ts
+++ b/apps/desktop/src/main/maker-host/claude-local-sessions.ts
@@ -1032,6 +1032,7 @@ function usageTokenCount(usage: unknown): number {
function normalizeClaudeModel(raw: string): string {
const model = raw.trim();
if (!model) return '';
+ if (model.includes('opus-5-5')) return 'claude-opus-5-5';
if (model.includes('opus-5')) return 'claude-opus-5';
if (model.includes('opus-4-8')) return 'claude-opus-4-8';
if (model.includes('opus-4-7')) return 'claude-opus-4-7';
diff --git a/docs/dev-rules/model-catalog-maintenance.md b/docs/dev-rules/model-catalog-maintenance.md
index b6fd0f3e81..a3855edfc8 100644
--- a/docs/dev-rules/model-catalog-maintenance.md
+++ b/docs/dev-rules/model-catalog-maintenance.md
@@ -154,7 +154,9 @@ app-server 的完整 `model/list`,不使用控制端 OpenAI 登录或网关目
优先于该组,整组替换,不逐字段补齐。订阅价值估算指定 `officialOnly`,仅取厂商参考价,
用户显式价格覆盖仍优先,账号归属不变。XD 计费继续只读 Gateway 实报。
-新客户端请求 `registrySchemaVersion=5`。服务端向 V1–V4 展开官方参考价到原路由字段,
+新客户端请求 `registrySchemaVersion=5&registryMedia=1`。无媒体能力标识的请求保持服务端
+冻结兼容快照,不跟随完整正本更新;正本与客户端离线 Registry 仍保持完整一致。
+服务端向 V1–V4 展开官方参考价到原路由字段,
剥离新增组与引用字段;V4 保留公共资料、本地域及原覆盖语义。各版本响应有独立 ETag。
旧服务端仍可返回旧目录,新客户端保留旧格式读取;应先部署服务端再发布客户端。
本次只迁移已有、已核实的价格,不补猜测价格,不改变 XD 的缺价处理。
diff --git a/docs/model-catalog-history.md b/docs/model-catalog-history.md
index a6715c308e..49cd7cffa0 100644
--- a/docs/model-catalog-history.md
+++ b/docs/model-catalog-history.md
@@ -3,6 +3,45 @@
> 参考记录,不是当前配置或部署状态。当前维护规则见 [模型配置与下发](dev-rules/model-catalog-maintenance.md)。
> 下列文字记录各批次当时的事实,不能相互当作后续状态的证明。引用时须带日期、来源和验证范围。
+## GPT-6 Sol / Luna 与 Claude Opus 5.5(2026-09-23)
+
+客户端离线 Registry revision 更新为 `2026-09-23T00:00:00.003Z`,新增
+`openai/gpt-6-sol`、`openai/gpt-6-luna`、`anthropic/claude-opus-5-5` 公共资料和官方接入路由。
+保留既有型号、参考价历史及用户已选型号;不新增未经实报的 XD 路由。
+沿用最新家族成员推荐规则,Claude Code 的 Opus 推荐项会从 5 自动更新为 5.5。
+
+依据 [OpenAI 发布记录](https://developers.openai.com/api/docs/changelog)、
+[Sol 规格](https://developers.openai.com/api/docs/models/gpt-6-sol)、
+[Luna 规格](https://developers.openai.com/api/docs/models/gpt-6-luna)、
+[Opus 5.5 规格](https://platform.claude.com/docs/en/models/opus-5-5/overview),
+三个型号均于 2026-09-22 发布,支持文本/图片输入、文本输出和 128K 最大输出。
+GPT 容量为 1,050,000,Claude 为 1,000,000;GPT 的 Claude Code / Codex 工作默认仍为 272,000。
+三者均登记 low / medium / high / xhigh / max,默认 medium;GPT 官方另支持 none,
+但现有 Registry effort 枚举不能表达,本批不扩展协议,也不把 none 错映为 minimal。
+GPT 原生接口采用 Responses,避免 Chat Completions 在非 none 档位下不支持工具调用的限制。
+Opus 5.5 的 adaptive thinking 始终开启,不能发送 disabled;Responses→Anthropic 桥沿用
+已有 always-on 处理,显式关闭降到 low,并保留 xhigh 参数;真实引擎调用仍需验证。
+
+参考价依据 [OpenAI 定价](https://developers.openai.com/api/docs/pricing)与
+[Claude 定价](https://platform.claude.com/docs/en/about-claude/pricing),核验日 2026-09-23,
+生效日 2026-09-22。每百万 tokens 标准输入/输出:Sol $2/$10,Luna $0.10/$0.50,
+Opus 5.5 $4/$20;包含缓存读写、Claude 1h 写入、标准/Fast 价格及 GPT 的 272K 分档。
+Claude Fast 参考价不等于订阅账号具备 Fast 权限,本批不强制开启该能力。
+
+配套 Server PR 同步三个型号的完整公共资料/路由/参考价,并补 Pi 显式成员。
+后续收口将此前仅在客户端的 13 个公共型号、8 个媒体接入条目及 Cyber 能力补项并入
+Server 正本,两端完整 Registry 内容与 revision `2026-09-23T00:00:00.003Z` 一致。
+客户端目录请求新增 `registryMedia=1`(见 [媒体发布前置条件](model-registry-v4-media.md#发布前置条件))。
+服务端仅向明确支持媒体扩展的 V4/V5 请求返回完整正本;无标识或未知标识保持更新前的
+固定兼容快照及其 revision,避免不完整的新版本整表覆盖旧客户端内置媒体资料。
+旧兼容快照不继续加型号、抬 revision;后续维护只更新完整正本,再同步客户端离线副本。
+旧模型与价格均保留;两端修改与生产部署须分别核验。
+尚未发布或验证账号调用。
+核对 Global 公共接口 `/api/model-catalog/catalog?registrySchemaVersion=5` 时,线上 revision 为
+`2026-09-22T00:00:00.000Z`,三个新公共型号均缺失。合并部署后还需验证实际下发;
+Pi 成员沿服务端显式列表/账号发现,不复制订阅名单到公共 API。客户端离线 Pi 快照仍由
+固定版本上游生成,本次没有伪造上游生成数据;新型号可由服务端目录或账号发现补入。
+
## 小米 MiMo V2.6 系列(2026-09-22,同日第一批)
客户端 `catalog/providers.json` 两个 MiMo 预设(`xiaomi-mimo-api-cn` / `xiaomi-mimo-token-plan-cn`)
diff --git a/docs/model-registry-v4-media.md b/docs/model-registry-v4-media.md
index 834db78d3f..c1a0327f8c 100644
--- a/docs/model-registry-v4-media.md
+++ b/docs/model-registry-v4-media.md
@@ -98,12 +98,15 @@ V1–V3 解析保持原有契约;新媒体字段、媒体原生协议和空 Ag
### 发布前置条件
相同 `registrySchemaVersion=4` 或 `schemaVersion=5` 请求不能证明
-客户端认识本次扩展。服务端在没有独立、可验证的客户端能力协商前,必须继续对这些
-请求返回已发布客户端能解析的旧形状,不得直接全量下发新增音频空 Agent 条目、新
-Registry 字段或原生协议枚举。LKG/内置兜底不能当作兼容方案。未来下发实现需补充
-能力识别及旧形状投影,并用已发布客户端严格解析器验证;本地消费与管理实现
-不代表该服务端发布前置条件已经满足。Registry 维持 V4,不因这些媒体扩展
-递增版本;在上述发布条件完成前,新增目录资料只在本地配置/内置路径生效。
+客户端认识本次扩展。公共目录请求必须同时声明 `registryMedia=1`,服务端只向明确声明
+该能力的 V4/V5 请求返回完整目录(V4 仍展开 V5 官方价格)。无标识、未知标识、重复参数
+及 V1–V3 请求维持更新前的固定兼容快照,不跟随正本 revision 前进;不能仅剥离媒体字段
+后抬高旧响应 revision,否则仍会整表覆盖已带本地媒体资料的旧客户端。
+完整正本与客户端离线副本须保持一致;旧响应是冻结兼容产物,不是另一份维护源。
+URL 包含能力标识,客户端 LKG 按完整 URL 隔离;服务端按实际响应计算 ETag。
+旧服务端忽略新参数时仍返回旧目录,新客户端保持旧格式读取。发布时必须分别验证旧端
+严格解析、整表择新保留行为和新端完整下发;本地实现不代表服务端已部署。
+Registry 不因这项能力标识递增 schema 版本,已有 V4/V5 语义保持。
本地离线目录把 OpenAI GPT Image 2.5 Sunburst / Flare(以及旧代 GPT Image 2)、Gemini/xAI 图像、xAI 视频资料纳入 Registry,并补入
已有音频、识别、实时与向量型号的公共资料。公共音频/向量资料不虚构订阅接入路由。
diff --git a/packages/model-providers/src/__tests__/modelRegistry.test.ts b/packages/model-providers/src/__tests__/modelRegistry.test.ts
index 22c56ba23c..650d0c3307 100644
--- a/packages/model-providers/src/__tests__/modelRegistry.test.ts
+++ b/packages/model-providers/src/__tests__/modelRegistry.test.ts
@@ -11,6 +11,90 @@ import {
const registry = BUNDLED_CATALOG.modelRegistry;
describe("model registry", () => {
+ it.each([
+ ["openai", "gpt-6-sol", "gpt-5.6-sol"],
+ ["openai", "gpt-6-luna", "gpt-5.6-luna"],
+ ["anthropic", "claude-opus-5-5", "claude-opus-5"],
+ ])("orders %s/%s before its previous generation", (provider, model, previous) => {
+ const current = findModelRegistryRoute(registry, provider, model)?.entry.sortOrder;
+ const prior = findModelRegistryRoute(registry, provider, previous)?.entry.sortOrder;
+ expect(Number.isFinite(current)).toBe(true);
+ expect(current).toBeLessThan(prior!);
+ });
+
+ it.each([
+ { model: "gpt-6-sol", input: 2, output: 10 },
+ { model: "gpt-6-luna", input: 0.1, output: 0.5 },
+ ])(
+ "resolves $model launch prices across the exact 272K boundary",
+ ({ model, input, output }) => {
+ for (const variant of ["standard", "fast"] as const) {
+ const multiplier = variant === "fast" ? 2 : 1;
+ const options = { at: "2026-09-22", variant, inputTokens: 272_000 };
+ expect(
+ resolveModelReferencePrice(registry, "openai", model, {
+ ...options,
+ at: "2026-09-21",
+ }),
+ ).toBeUndefined();
+ expect(
+ resolveModelReferencePrice(
+ registry,
+ "openai",
+ `chatgpt/${model}`,
+ options,
+ )?.price,
+ ).toMatchObject({
+ inputPerMtok: input * multiplier,
+ outputPerMtok: output * multiplier,
+ });
+ expect(
+ resolveModelReferencePrice(registry, "openai", model, {
+ ...options,
+ inputTokens: 272_001,
+ })?.price,
+ ).toMatchObject({
+ inputPerMtok: input * multiplier * 2,
+ outputPerMtok: output * multiplier * 1.5,
+ });
+ expect(
+ resolveModelReferencePrice(registry, "xd", model, options),
+ ).toBeUndefined();
+ }
+ expect(
+ findModelRegistryRoute(registry, "openai", model, "codex")?.entry,
+ ).toMatchObject({
+ contextWindow: 1_050_000,
+ supportsImageInput: true,
+ perAgent: {
+ codex: { contextWindow: 272_000 },
+ "claude-code": { contextWindow: 272_000 },
+ },
+ });
+ },
+ );
+
+ it("keeps Opus 5.5 cache prices valid across its full window", () => {
+ for (const inputTokens of [1, 200_001, 900_000]) {
+ for (const variant of ["standard", "fast"] as const) {
+ const multiplier = variant === "fast" ? 2 : 1;
+ expect(
+ resolveModelReferencePrice(registry, "anthropic", "claude-opus-5-5", {
+ at: "2026-09-22",
+ variant,
+ inputTokens,
+ })?.price,
+ ).toMatchObject({
+ inputPerMtok: 4 * multiplier,
+ outputPerMtok: 20 * multiplier,
+ cacheReadPerMtok: 0.2 * multiplier,
+ cacheWritePerMtok: 5 * multiplier,
+ cacheWrite1hPerMtok: 8 * multiplier,
+ });
+ }
+ }
+ });
+
it.each([
{ variant: "standard" as const, inputPerMtok: 10, cacheWritePerMtok: 12.5 },
{ variant: "fast" as const, inputPerMtok: 20, cacheWritePerMtok: 25 },
diff --git a/packages/model-providers/src/__tests__/source-registry.test.ts b/packages/model-providers/src/__tests__/source-registry.test.ts
index 7e187539b5..eb19b3bb74 100644
--- a/packages/model-providers/src/__tests__/source-registry.test.ts
+++ b/packages/model-providers/src/__tests__/source-registry.test.ts
@@ -106,6 +106,37 @@ function runtimeCatalog(): Catalog {
}
describe("resolveCatalogUrl", () => {
+ it("opts explicit catalog endpoints into media without changing unrelated query parameters", () => {
+ const resolved = new URL(
+ resolveCatalogUrl({
+ url: "https://example.com/api/model-catalog/catalog?region=cn&registryMedia=0&registrySchemaVersion=4",
+ })!,
+ );
+ expect(Object.fromEntries(resolved.searchParams)).toEqual({
+ region: "cn",
+ registryMedia: "1",
+ registrySchemaVersion: "5",
+ });
+ });
+
+ it("scopes LKG reads and writes to the media-capable URL", async () => {
+ const cfg = { baseUrl: "https://model-access.example.com" };
+ const readCache = vi.fn().mockResolvedValue(null);
+ const writeCache = vi.fn();
+ await loadCatalog(cfg, {
+ fetchText: vi.fn().mockResolvedValue(JSON.stringify(MINIMAL)),
+ readCache,
+ writeCache,
+ });
+ expect(readCache).toHaveBeenCalledWith(resolveCatalogUrl(cfg));
+ expect(writeCache).toHaveBeenCalledWith(
+ resolveCatalogUrl(cfg),
+ expect.any(String),
+ );
+ expect(readCache).not.toHaveBeenCalledWith(
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ );
+ });
it("prefers explicit url", () => {
expect(
resolveCatalogUrl({ url: "https://x/y.json", baseUrl: "https://b" }),
@@ -115,7 +146,7 @@ describe("resolveCatalogUrl", () => {
expect(
resolveCatalogUrl({ baseUrl: "https://model-access.example.com/" }),
).toBe(
- "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1",
);
});
it("builds the migration OSS fallback URL", () => {
@@ -1042,7 +1073,7 @@ describe("loadCatalog", () => {
);
expect(fetchText).toHaveBeenNthCalledWith(
1,
- "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1",
15_000,
);
expect(fetchText).toHaveBeenNthCalledWith(
@@ -1102,7 +1133,7 @@ describe("loadCatalog", () => {
);
expect(fetchText).toHaveBeenNthCalledWith(
1,
- "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1",
15_000,
);
expect(fetchText).toHaveBeenNthCalledWith(
@@ -1160,7 +1191,7 @@ describe("loadCatalog", () => {
);
expect(fetchText).toHaveBeenNthCalledWith(
1,
- "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1",
15_000,
);
expect(fetchText).toHaveBeenNthCalledWith(
@@ -1189,7 +1220,7 @@ describe("loadCatalog", () => {
);
expect(fetchText).toHaveBeenCalledTimes(1);
expect(fetchText).toHaveBeenCalledWith(
- "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5",
+ "https://model-access.example.com/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1",
15_000,
);
expect(cat.version).toBe(BUNDLED_CATALOG.version);
diff --git a/packages/model-providers/src/source.ts b/packages/model-providers/src/source.ts
index f87b2e9721..8b4301447d 100644
--- a/packages/model-providers/src/source.ts
+++ b/packages/model-providers/src/source.ts
@@ -1,4 +1,4 @@
-import { withClaudeProviderRuntime } from './piProviderPresets.js';
+import { withClaudeProviderRuntime } from "./piProviderPresets.js";
/**
* 目录源解析与加载(纯逻辑,IO 由 host 注入,零 Electron / node 依赖)。
*
@@ -23,7 +23,7 @@ import type { AgentKind, Catalog, Provider, ProviderPreset } from "./types.js";
/** 公共模型目录 API 路径。发布版由 model-access-server 匿名提供完整 Catalog。 */
export const CATALOG_API_PATH =
- "/api/model-catalog/catalog?registrySchemaVersion=5";
+ "/api/model-catalog/catalog?registrySchemaVersion=5&registryMedia=1";
/** 旧客户端目录的 OSS 相对路径。迁移期作为公共 API 失败后的兼容回退。 */
export const CATALOG_CFG_PATH = "/cfg/providers.json";
@@ -126,6 +126,7 @@ export function resolveCatalogUrl(cfg: CatalogSourceConfig): string | null {
const url = new URL(explicit);
if (url.pathname.endsWith("/api/model-catalog/catalog")) {
url.searchParams.set("registrySchemaVersion", "5");
+ url.searchParams.set("registryMedia", "1");
return url.toString();
}
} catch {
@@ -489,7 +490,9 @@ export function mergeWithBundled(primary: Catalog): Catalog {
const presets = bundledPresets.map((bundled) => {
const remote = primaryPresetsById.get(bundled.id);
return remote
- ? withClaudeProviderRuntime(backfillPresetMetadata(remote, bundled, allowLegacyPiBackfill))
+ ? withClaudeProviderRuntime(
+ backfillPresetMetadata(remote, bundled, allowLegacyPiBackfill),
+ )
: bundled;
});
for (const preset of primaryPresets) {
diff --git a/packages/responses-anthropic-bridge/src/__tests__/translate-request.test.ts b/packages/responses-anthropic-bridge/src/__tests__/translate-request.test.ts
index 7c783305b3..1cd7278dc9 100644
--- a/packages/responses-anthropic-bridge/src/__tests__/translate-request.test.ts
+++ b/packages/responses-anthropic-bridge/src/__tests__/translate-request.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, it } from 'vitest';
+import { InvalidResponsesRequestError } from '../types.js';
import {
decodeThinkingBlock,
@@ -966,8 +967,8 @@ describe('Responses → Anthropic request translation', () => {
expect(result.request.thinking).toBeUndefined();
});
- it('cannot disable thinking on fable and mythos models', () => {
- for (const model of ['claude-fable-5', 'claude-mythos-5']) {
+ it('cannot disable thinking on always-on models', () => {
+ for (const model of ['claude-fable-5', 'claude-mythos-5', 'claude-opus-5-5']) {
const result = translateResponsesRequest({
model,
reasoning: { effort: 'none' },
@@ -978,6 +979,42 @@ describe('Responses → Anthropic request translation', () => {
}
});
+ it('uses adaptive thinking for Opus 5.5 with default and explicit efforts', () => {
+ for (const model of ['claude-opus-5-5', 'anthropic/claude-opus-5.5', 'claude-opus-5-5-20260922']) {
+ for (const effort of [undefined, 'low', 'medium', 'high', 'xhigh', 'max']) {
+ const result = translateResponsesRequest({
+ model,
+ ...(effort ? { reasoning: { effort } } : {}),
+ input: [{ role: 'user', content: 'hi' }],
+ });
+ expect(result.request.thinking).toEqual({ type: 'adaptive' });
+ if (effort) expect(result.request.output_config).toEqual({ effort });
+ else expect(result.request.output_config).toBeUndefined();
+ }
+ }
+ });
+
+ it.each(['claude-opus-5-5', 'anthropic/claude-opus-5.5', 'claude-opus-5-5-20260922'])(
+ 'rejects incompatible tool requests without disabling thinking for %s', (model) => {
+ const tools = [{ type: 'function', name: 'run', parameters: { type: 'object' } }];
+ const expected = new InvalidResponsesRequestError(
+ 'This Anthropic model requires signed thinking history for tool continuation or forced tool choice',
+ );
+ for (const effort of [undefined, 'none', 'high']) {
+ const request = { model, tools, ...(effort ? { reasoning: { effort } } : {}) };
+ for (const tool_choice of ['required', { type: 'function', name: 'run' }]) {
+ expect(() => translateResponsesRequest({ ...request,
+ input: [{ role: 'user', content: 'run the tool' }], tool_choice,
+ })).toThrowError(expected);
+ }
+ expect(() => translateResponsesRequest({ ...request, input: [
+ { type: 'function_call', call_id: 'c1', name: 'run', arguments: '{}' },
+ { type: 'function_call_output', call_id: 'c1', output: 'ok' },
+ ] })).toThrowError(expected);
+ }
+ },
+ );
+
it('keeps automatic prompt caching off the moving last user block', () => {
const result = translateResponsesRequest({
model: 'claude-sonnet-5',
diff --git a/packages/responses-anthropic-bridge/src/translate-request.ts b/packages/responses-anthropic-bridge/src/translate-request.ts
index 614118265a..a9ea250a52 100644
--- a/packages/responses-anthropic-bridge/src/translate-request.ts
+++ b/packages/responses-anthropic-bridge/src/translate-request.ts
@@ -901,13 +901,13 @@ function effortBudget(effort: string | undefined): number | null {
}
}
-function normalizedEffort(effort: string | undefined): string | null {
+function normalizedEffort(effort: string | undefined, model: string): string | null {
switch ((effort ?? '').trim().toLowerCase()) {
case 'minimal':
case 'low': return 'low';
case 'medium': return 'medium';
case 'high': return 'high';
- case 'xhigh':
+ case 'xhigh': return isOpus55(model) ? 'xhigh' : 'max';
case 'max':
case 'ultra': return 'max';
default: return null;
@@ -916,7 +916,7 @@ function normalizedEffort(effort: string | undefined): string | null {
function supportsAdaptiveThinkingByModel(model: string): boolean {
const normalized = model.trim().toLowerCase().replace(/[._]/g, '-');
- return ['fable-5', 'mythos-5', 'mythos-preview', 'sonnet-5']
+ return thinkingCannotBeDisabled(model) || ['fable-5', 'mythos-5', 'mythos-preview', 'sonnet-5']
.some((needle) => normalized.includes(needle))
|| /claude-opus-4-(?:7|8)(?:-|$)/.test(normalized)
|| /claude-sonnet-5(?:-|$)/.test(normalized);
@@ -924,13 +924,18 @@ function supportsAdaptiveThinkingByModel(model: string): boolean {
function adaptiveThinkingByDefault(model: string): boolean {
const normalized = model.trim().toLowerCase().replace(/[._]/g, '-');
- return ['fable-5', 'mythos-5', 'mythos-preview', 'sonnet-5']
+ return thinkingCannotBeDisabled(model) || ['fable-5', 'mythos-5', 'mythos-preview', 'sonnet-5']
.some((needle) => normalized.includes(needle));
}
function thinkingCannotBeDisabled(model: string): boolean {
const normalized = model.trim().toLowerCase().replace(/[._]/g, '-');
- return normalized.includes('fable-5') || normalized.includes('mythos-5');
+ return normalized.includes('fable-5') || normalized.includes('mythos-5')
+ || isOpus55(model);
+}
+
+function isOpus55(model: string): boolean {
+ return /claude-opus-5-5(?:-|$)/.test(model.trim().toLowerCase().replace(/[._]/g, '-'));
}
function mapToolChoice(value: unknown, context: ToolContext, oauth: boolean): unknown {
@@ -1324,7 +1329,7 @@ export function translateResponsesRequest(
anth.thinking = { type: 'disabled' };
} else if (adaptive) {
anth.thinking = { type: 'adaptive' };
- const normalized = normalizedEffort(effort);
+ const normalized = normalizedEffort(effort, model);
if (normalized) anth.output_config = { effort: normalized };
if (numberValue(raw.max_output_tokens) === undefined) {
anth.max_tokens = Math.max(anth.max_tokens, (budget ?? 8192) + OUTPUT_HEADROOM);