diff --git a/docs/claude-official-capacity-2026-11-06.json b/docs/claude-official-capacity-2026-11-06.json new file mode 100644 index 00000000..63656ba2 --- /dev/null +++ b/docs/claude-official-capacity-2026-11-06.json @@ -0,0 +1,201 @@ +{ + "scope": "Exact official synchronous capacity declarations and independent product verification", + "checkedAt": "2026-11-06", + "officialPage": "https://platform.claude.com/docs/en/models/overview", + "extractionSource": { + "url": "https://platform.claude.com/llms-full.txt", + "finalUrl": "https://platform.claude.com/llms-full.txt", + "contentType": "text/plain; charset=utf-8", + "receivedBytes": 1769472, + "observedPlainBytes": 9034056, + "sha256": "76854bfc5b7d670bc96b8fe8074a7709bf7dc1ad04826cf083ada4e6137a427d", + "partial": true, + "modelsOverviewFound": true + }, + "officialExcerpt": { + "file": "models-overview-excerpt.md", + "sha256": "af537b1ed95a9db9ee6614f11f6070227586d39f1ea915d28c120d944a3926ea" + }, + "statements": { + "outputRow": "| Max output | 128K tokens | 128K tokens | 128K tokens | 128K tokens |", + "contextRow": "| [Context window](https://platform.claude.com/docs/en/build-with-claude/context-windows) | 1M tokens | 1M tokens | 1M tokens | 1M tokens |", + "numericalExample": "model: claude-opus-5-5\n max_tokens: 128000", + "limitScope": "Synchronous Messages; 300K Message Batches beta is separate" + }, + "models": [ + { + "model": "claude-fable-5-1", + "contextLimit": 1000000, + "maxOutputTokens": 128000, + "sourceUrl": "https://platform.claude.com/docs/en/models/overview", + "checkedAt": "2026-11-06", + "source": "official_model_spec" + }, + { + "model": "claude-opus-5-5", + "contextLimit": 1000000, + "maxOutputTokens": 128000, + "sourceUrl": "https://platform.claude.com/docs/en/models/overview", + "checkedAt": "2026-11-06", + "source": "official_model_spec" + }, + { + "model": "claude-sonnet-5-5", + "contextLimit": 1000000, + "maxOutputTokens": 128000, + "sourceUrl": "https://platform.claude.com/docs/en/models/overview", + "checkedAt": "2026-11-06", + "source": "official_model_spec" + }, + { + "model": "claude-haiku-5-5", + "contextLimit": 1000000, + "maxOutputTokens": 128000, + "sourceUrl": "https://platform.claude.com/docs/en/models/overview", + "checkedAt": "2026-11-06", + "source": "official_model_spec" + } + ], + "directPageCaptures": [ + { + "name": "overview", + "url": "https://platform.claude.com/docs/en/models/overview.md", + "finalUrl": "https://claude.com/app-unavailable-in-region", + "status": 200, + "bytes": 306528, + "sha256": "77a6e0ca863148104852d7dcc974d50cac8d2afd86b2bd1d81ab149b2f8774e4", + "capturedAt": "2026-11-06T12:40:04.698587+00:00", + "documentContent": false, + "reason": "These captures redirected to app-unavailable-in-region; HTTP 200 is not documentation evidence." + }, + { + "name": "opus-4-8", + "url": "https://platform.claude.com/docs/en/models/opus-4-8/overview.md", + "finalUrl": "https://claude.com/app-unavailable-in-region", + "status": 200, + "bytes": 308044, + "sha256": "5945edfad974f39df5610bc2b22686250bf3c732a14dfe385a8674a3c6657b5c", + "capturedAt": "2026-11-06T12:39:59.219661+00:00", + "documentContent": false, + "reason": "These captures redirected to app-unavailable-in-region; HTTP 200 is not documentation evidence." + }, + { + "name": "sonnet-4-6", + "url": "https://platform.claude.com/docs/en/models/sonnet-4-6/overview.md", + "finalUrl": "https://claude.com/app-unavailable-in-region", + "status": 200, + "bytes": 306528, + "sha256": "5a1a735648cc0b271e8304b650b776fd5d217ac9df56ed9676f7b96155f26004", + "capturedAt": "2026-11-06T12:39:57.228635+00:00", + "documentContent": false, + "reason": "These captures redirected to app-unavailable-in-region; HTTP 200 is not documentation evidence." + }, + { + "name": "haiku-5-5", + "url": "https://platform.claude.com/docs/en/models/haiku-5-5/overview.md", + "finalUrl": "https://claude.com/app-unavailable-in-region", + "status": 200, + "bytes": 307892, + "sha256": "3d852360aa31bb4f6928e8a1859a33e812e71de39d63671dfe7520505892d747", + "capturedAt": "2026-11-06T12:39:53.219614+00:00", + "documentContent": false, + "reason": "These captures redirected to app-unavailable-in-region; HTTP 200 is not documentation evidence." + } + ], + "evidenceRoot": ".qa/claude-output-capacity-2026-11-06", + "runs": [ + { + "file": "official-before.tap", + "bytes": 5179, + "sha256": "7a47c9212a9c558b8644a8399184137d611f07a71595a1c9c440ffa79f60f38d" + }, + { + "file": "official-after.tap", + "bytes": 763, + "sha256": "9c980fec7eb9285078e4d3f9722b2ef0073c3932d859c17a40534138a815babf" + }, + { + "file": "build-1.log", + "bytes": 1122, + "sha256": "0048e15cfb66e9316d1167d1a919e74d99c6498bf025160181d17f81c9b5e611" + }, + { + "file": "build-2.log", + "bytes": 1122, + "sha256": "87fd8330d1a26c2cbbf20b178a309a89f0ad91d83df4de5921052f76eec9a740" + }, + { + "file": "related-1.tap", + "bytes": 6988, + "sha256": "46b22ad34c867256d52595782495362caa6d3da89328896ef6e5810a958c50dd" + }, + { + "file": "ui-1.log", + "bytes": 398, + "sha256": "e00cbe426df89ff6a9df74947434367c14f9661522c4f184e7f80a92dcfc88bf" + }, + { + "file": "ui-result.json", + "bytes": 681, + "sha256": "db715c24c1ef8d9b011dc68d5d1f69f6b93ab8b4ea1c2ff44da7aa6cda56ece5" + }, + { + "file": "model-center-1280.png", + "bytes": 116673, + "sha256": "d539c0f4e871a7070ed1b1a17992516c00da6321138738bc1998f35859b9572c" + }, + { + "file": "model-center-390.png", + "bytes": 56585, + "sha256": "a5d6dba00d166ffbbd6e77ae366bb9f2ce79967396994b8a2d835736787de49a" + }, + { + "file": "candidate-build.json", + "bytes": 5613, + "sha256": "8a5fa1fe43f1eb091c28951f0c5bf80e5c9a89cbd6192b80cbce9971f89b942b" + } + ], + "buildInputs": [ + { + "file": "src/shared/contracts/official-model-capacity.mjs", + "sha256": "8598a295b3674745d5bf1c10d172c583d45de2f8ced10c49830720280425480e" + }, + { + "file": "src/shared/contracts/model-capacity.mjs", + "sha256": "9ea3e58e0d8d0140f6970f1ad5bb9132100c5a7c84de9cf761ccfcace5863a1f" + }, + { + "file": "src/shared/contracts/model-capacity.d.mts", + "sha256": "731f8af8e114e6332bf57b0d3aa06d5484fa1eb3f3761740ac4b7943f2f3f9ee" + }, + { + "file": "src/client/ModelCenter.tsx", + "sha256": "1b9a21774438727b56d1223d8b2e4af032690933c38c2cda6ec147b631a71d03" + }, + { + "file": "src/client/NativeParameters.tsx", + "sha256": "3468ab04ef3764c9f1457a21841356896b454558bf9e850cbf724f002d4a9a16" + }, + { + "file": "tests/official-model-capacity.test.mjs", + "sha256": "b8591872ac81dea479770b53734091d964de458aa4a87054fbbdb16071055c88" + }, + { + "file": "scripts/verify-official-model-capacity-ui.mjs", + "sha256": "bd12e08239f589199b16d110ce8cf1c3b6d1821a684d643e67cf133dcdfb576a" + } + ], + "tests": { + "related": 67, + "pass": 67, + "fail": 0, + "UI": 4, + "viewportWidths": [ + 1280, + 390 + ] + }, + "realModelRequests": 0, + "formalDeployment": false, + "claim": "Official specifications are known; actual gateway compatibility is not established here." +} diff --git a/scripts/verify-official-model-capacity-ui.mjs b/scripts/verify-official-model-capacity-ui.mjs new file mode 100644 index 00000000..91af307c --- /dev/null +++ b/scripts/verify-official-model-capacity-ui.mjs @@ -0,0 +1,72 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import assert from 'node:assert/strict'; +import { chromium, expect } from 'playwright/test'; +import { fixture, launchWorkbench } from '../tests/helpers.mjs'; +import { Provider } from '../src/server/provider.mjs'; +import { openWorkbenchTool } from './ui-navigation.mjs'; + +const evidence = path.resolve('.qa/claude-output-capacity-2026-11-06'); +const disposers = [], t = { after: fn => disposers.push(fn) }; +const f = fixture(t, { modernDefaults: true }), provider = new Provider(), hub = provider.modelHub(f.store); +const profile = { baseUrl: 'http://127.0.0.1:9/v1', protocol: 'anthropic-messages', requiresKey: false, maxOutputTokens: 2048 }; +const official = hub.upsert({ ...profile, name: 'Owned official Claude', model: 'claude-opus-5-5' }); +const gateway = hub.upsert({ ...profile, name: 'Owned gateway declaration', model: 'claude-opus-5-5' }); +hub.connection(gateway.id).upstreamModel = { id: 'claude-opus-5-5', maxOutputTokens: 64000, contextLimit: 200000 }; +const unknown = hub.upsert({ ...profile, name: 'Owned unknown model', model: 'owned-unknown' }); +hub.save(); const before = structuredClone(hub.state); f.store.close(); +let browser, host; +const errors = [], marks = []; +try { + host = await launchWorkbench(t, f.data); assert.notEqual(new URL(host.url).port, '4318'); + browser = await chromium.launch({ channel: 'msedge', headless: true }); + const page = await browser.newPage({ viewport: { width: 1280, height: 900 } }); + page.on('pageerror', cause => errors.push(cause.message)); + const open = async () => { await openWorkbenchTool(page, '打开模型中心'); await expect(page.getByRole('dialog', { name: '模型中心', exact: true })).toBeVisible(); }; + const card = id => page.locator('.mc-connection[data-connection-id="' + id + '"]'); + const mark = value => { marks.push(value); console.log('PASS ' + value); }; + await page.goto(host.url); await open(); + await expect(card(official.id)).toContainText('128,000 tokens · Anthropic 官方规格'); + await expect(card(official.id)).toContainText('1,000,000 tokens · Anthropic 官方规格'); + await expect(card(official.id)).toContainText('max_tokens = 128000 · Anthropic 官方同步输出规格'); + await expect(card(gateway.id)).toContainText('64,000 tokens · 上游目录'); + await expect(card(unknown.id)).toContainText('本地无限制 · 由上游决定'); + mark('official model and gateway declarations are distinct; unknown model stays unknown'); + await page.screenshot({ path: path.join(evidence, 'model-center-1280.png') }); + await card(official.id).getByRole('button', { name: '编辑', exact: true }).click(); + const editor = page.getByRole('form', { name: '编辑模型连接', exact: true }); + await expect(editor.getByLabel('模型最大输出', { exact: true })).toContainText('128,000'); + await expect(editor.getByLabel('模型最大上下文', { exact: true })).toContainText('1,000,000'); + await expect(editor.getByLabel('连接容量策略')).toContainText('Messages 按协议带 max_tokens'); + await editor.getByRole('button', { name: '取消', exact: true }).click(); + await card(official.id).getByRole('button', { name: '推理与能力', exact: true }).click(); + const native = page.getByRole('form', { name: '原生请求参数', exact: true }); + await expect(native).toContainText('当前 128000(Anthropic 官方同步输出规格)'); + await native.getByLabel('原生参数 JSON').fill('{"max_tokens":300000}'); + await native.getByRole('button', { name: '保存原生参数', exact: true }).click(); + await expect(native).not.toBeVisible(); + await expect(card(official.id)).toContainText('max_tokens = 300000 · 显式原生参数'); + await page.reload(); await open(); + await expect(card(official.id)).toContainText('max_tokens = 300000 · 显式原生参数'); + await expect(card(official.id)).toContainText('128,000 tokens · Anthropic 官方规格'); + mark('capacity editor and native settings show the same source; explicit user output survives refresh without changing the official maximum'); + await page.setViewportSize({ width: 390, height: 844 }); + await card(official.id).scrollIntoViewIfNeeded(); + await expect(card(official.id)).toContainText('128,000 tokens · Anthropic 官方规格'); + assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)); + await page.screenshot({ path: path.join(evidence, 'model-center-390.png') }); + mark('390px model source and output value remain readable without page overflow'); + const after = await host.api('/model-center'); + assert.equal(after.connections.find(value => value.id === official.id).maxOutputTokens, 2048); + assert.equal(after.connections.find(value => value.id === official.id).nativeParameters.max_tokens, 300000); + for (const id of [gateway.id, unknown.id]) assert.deepEqual(after.connections.find(value => value.id === id).upstreamModel, before.connections.find(value => value.id === id).upstreamModel); + assert.equal(after.attempts.length, 0); assert.deepEqual(errors, []); + mark('saved user declaration and other models are preserved; UI makes zero model requests'); + fs.writeFileSync(path.join(evidence, 'ui-result.json'), JSON.stringify({ marks, errors, viewportWidths: [1280, 390], realModelRequests: 0, + appRoot: process.env.AGENT_WORKBENCH_TEST_APP_ROOT, officialDeclaredOutput: 128000, explicitOutput: 300000 }, null, 2) + '\n', { flag: 'wx' }); +} catch (cause) { + fs.writeFileSync(path.join(evidence, 'ui-failure.txt'), cause.stack ?? String(cause), { flag: 'wx' }); throw cause; +} finally { + await browser?.close(); await host?.close(); + for (const dispose of disposers.reverse()) await dispose(); +} diff --git a/src/client/ModelCenter.tsx b/src/client/ModelCenter.tsx index 4cb27164..f5873df3 100644 --- a/src/client/ModelCenter.tsx +++ b/src/client/ModelCenter.tsx @@ -9,7 +9,7 @@ import { ModelWaitSettings, type WaitSettings } from './ModelWaitSettings'; import { NativeParameters } from './NativeParameters'; import { ModelErrorDetails } from './ModelErrorDetails'; import { ModelBudgetSettings } from './ModelBudgetSettings'; -import { DEFAULT_MODEL_CAPACITY, messagesOutputSetting } from '../shared/contracts/model-capacity.mjs'; +import { DEFAULT_MODEL_CAPACITY, messagesOutputSetting, modelCapacityDeclaration } from '../shared/contracts/model-capacity.mjs'; import { modelRequestUrl, protocolLabel } from '../shared/contracts/model-endpoint.mjs'; import { ModelNetworkDiagnostics } from './ModelNetworkDiagnostics'; import { ModelCatalog } from './ModelCatalog'; @@ -17,8 +17,8 @@ import type { CatalogModel } from '../shared/contracts/model-catalog.mjs'; const previewUrl = (value: { protocol: string; baseUrl: string }) => { try { return modelRequestUrl(value); } catch { return '请填写有效的接口根地址'; } }; const upstreamCapacity = (value: { model: string; upstreamModel?: CatalogModel }, field: 'contextLimit' | 'maxOutputTokens') => { - const tokens = value.upstreamModel?.id === value.model ? value.upstreamModel[field] : undefined; - return typeof tokens === 'number' && tokens > 0 ? tokens.toLocaleString() + ' tokens' : '本地无限制 · 由上游决定'; + const declaration = modelCapacityDeclaration(value, field); + return declaration ? declaration.value.toLocaleString() + ' tokens · ' + (declaration.source === 'official_model_spec' ? 'Anthropic 官方规格' : '上游目录') : '本地无限制 · 由上游决定'; }; type Connection = { id: string; name: string; brand: string; protocol: string; parameterProfile?: string; messagesAuth?: string; baseUrl: string; model: string; enabled: boolean; revision: number; hasKey: boolean; credentialSource?: { connectionId: string }; upstreamModel?: CatalogModel; @@ -125,7 +125,7 @@ export function ModelCenter({ onConfig, busy, runModel }: { onConfig: (value: Co {!connections.length && catalogSource === null && !editing &&
还没有模型连接

从上游获取可用型号,选择后即可开始开发。

}
{connections.map(value =>

{value.name}

{value.brand} · {protocolLabel(value.protocol)}{value.streaming ? ' · 流式开启' : ''}
{states[value.status]}
-
模型
{value.model || '尚未填写'}
请求地址
{previewUrl(value)}
{value.protocol === 'anthropic-messages' && <>
协议必填输出
max_tokens = {String(messagesOutputSetting(value).value)} · {messagesOutputSetting(value).source === 'upstream_catalog' ? '上游目录最大值' : messagesOutputSetting(value).source === 'explicit_native' ? '显式原生参数' : '连接声明,最大值未验证'}
鉴权
{value.messagesAuth === 'bearer' ? 'Bearer' : 'x-api-key'} · anthropic-version 2023-06-01
}
凭据
{value.credentialSource ? '共用 ' + (connections.find(source => source.id === value.credentialSource!.connectionId)?.name ?? '源连接') + (value.hasKey ? ' 的上游凭据' : ';请核对源连接是否启用及凭据') : value.hasKey ? value.savedCredential?.status === 'saved' ? '已设置,可从本机加密保存加载' : '已设置,重启需重新填写' : value.requiresKey ? '尚未填写' : '此服务可不填'}
当前请求
{value.activeRequests} 在途 · 并发 {value.concurrency === 0 ? '不限' : value.concurrency}
{passthrough ? <>
模型最大上下文
{upstreamCapacity(value, 'contextLimit')}
模型最大输出
{upstreamCapacity(value, 'maxOutputTokens')}
: <>
连接容量声明
上下文 {value.contextLimit.toLocaleString()} · 输出 {value.maxOutputTokens.toLocaleString()}
}
+
模型
{value.model || '尚未填写'}
请求地址
{previewUrl(value)}
{value.protocol === 'anthropic-messages' && <>
协议必填输出
max_tokens = {String(messagesOutputSetting(value).value)} · {messagesOutputSetting(value).source === 'upstream_catalog' ? '上游目录最大值' : messagesOutputSetting(value).source === 'official_model_spec' ? 'Anthropic 官方同步输出规格' : messagesOutputSetting(value).source === 'explicit_native' ? '显式原生参数' : '连接声明,最大值未验证'}
鉴权
{value.messagesAuth === 'bearer' ? 'Bearer' : 'x-api-key'} · anthropic-version 2023-06-01
}
凭据
{value.credentialSource ? '共用 ' + (connections.find(source => source.id === value.credentialSource!.connectionId)?.name ?? '源连接') + (value.hasKey ? ' 的上游凭据' : ';请核对源连接是否启用及凭据') : value.hasKey ? value.savedCredential?.status === 'saved' ? '已设置,可从本机加密保存加载' : '已设置,重启需重新填写' : value.requiresKey ? '尚未填写' : '此服务可不填'}
当前请求
{value.activeRequests} 在途 · 并发 {value.concurrency === 0 ? '不限' : value.concurrency}
{passthrough ? <>
模型最大上下文
{upstreamCapacity(value, 'contextLimit')}
模型最大输出
{upstreamCapacity(value, 'maxOutputTokens')}
: <>
连接容量声明
上下文 {value.contextLimit.toLocaleString()} · 输出 {value.maxOutputTokens.toLocaleString()}
}
{value.upstreamModel &&

型号来自上游目录,能力按目录声明与显式设置保存;可在“推理与能力”查看已接入范围。

}
{Object.entries(capabilityLabels).map(([key, title]) => {title}:{capabilityStates[value.capabilities?.[key] ?? 'unknown']})}
{value.health.reason &&

{value.health.reason}{!!value.health.cooldownUntil && value.health.cooldownUntil > Date.now() && ' · 冷却至 ' + new Date(value.health.cooldownUntil).toLocaleTimeString()}

} @@ -154,10 +154,10 @@ export function ModelCenter({ onConfig, busy, runModel }: { onConfig: (value: Co - {passthrough ?
默认透传 · 不设本地上限
模型最大上下文
{upstreamCapacity(draft, 'contextLimit')}
模型最大输出
{upstreamCapacity(draft, 'maxOutputTokens')}

容量数值来自当前型号的上游目录,仅供查看;上游未提供时显示本地无限制。完整发送上下文,不附加输出 token 上限,上游错误原文保留。

: <> + {passthrough ?
默认透传 · 不设本地上限
模型最大上下文
{upstreamCapacity(draft, 'contextLimit')}
模型最大输出
{upstreamCapacity(draft, 'maxOutputTokens')}

容量来自当前型号的上游目录或官方规格,仅供查看;未公开时本地无限制。完整发送上下文;Messages 按协议带 max_tokens,其它协议默认不附加输出上限,上游错误原文保留。

: <> -

容量优先使用上游目录声明;未提供时需要按供应商核对。推理可能共享输出额度。

+

容量优先使用上游目录,缺项时采用已知型号的官方规格;未知型号由上游决定。推理可能共享输出额度。

}
diff --git a/src/client/NativeParameters.tsx b/src/client/NativeParameters.tsx index 41c1dc32..7501956b 100644 --- a/src/client/NativeParameters.tsx +++ b/src/client/NativeParameters.tsx @@ -34,7 +34,7 @@ export function NativeParameters({ connection, busy, onCancel, onSave, execution setProfile(value); }} /> -

{connection.protocol === 'anthropic-messages' ? 'Messages 协议必须带 max_tokens;当前 ' + String(messagesOutputSetting(connection).value) + '(' + ({ explicit_native: '显式原生参数', upstream_catalog: '上游目录最大输出', connection_declaration: '连接声明,非已验证最大值' }[messagesOutputSetting(connection).source] ?? '') + ')。可在 JSON 中显式设置;本地不裁剪输出。' : executionMode === 'unrestricted' ? '默认不附加输出上限;可在 JSON 中显式填写上游参数,服务是否接受以原始响应为准。' : '数值沿用当前任务和连接的输出预算。'}消息、工具、接口和凭据由各自设置管理。

+

{connection.protocol === 'anthropic-messages' ? 'Messages 协议必须带 max_tokens;当前 ' + String(messagesOutputSetting(connection).value) + '(' + ({ explicit_native: '显式原生参数', upstream_catalog: '上游目录最大输出', official_model_spec: 'Anthropic 官方同步输出规格', connection_declaration: '连接声明,非已验证最大值' }[messagesOutputSetting(connection).source] ?? '') + ')。可在 JSON 中显式设置;本地不裁剪输出。' : executionMode === 'unrestricted' ? '默认不附加输出上限;可在 JSON 中显式填写上游参数,服务是否接受以原始响应为准。' : '数值沿用当前任务和连接的输出预算。'}消息、工具、接口和凭据由各自设置管理。