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(xai): 补齐 Grok 4.6 静态清单与参考价 (#2904)

Dashef31782e1ce6
diff --git a/apps/desktop/src/main/maker-host/__tests__/activeCatalogDiscovery.test.ts b/apps/desktop/src/main/maker-host/__tests__/activeCatalogDiscovery.test.ts
index db5b4ed249..42d47455b4 100644
--- a/apps/desktop/src/main/maker-host/__tests__/activeCatalogDiscovery.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/activeCatalogDiscovery.test.ts
@@ -135,6 +135,18 @@ describe('active-catalog discovered augment', () => {
'grok-build-0.1',
]);
expect(xai?.models.pi).not.toEqual(xai?.models['claude-code']);
+ expect(xai?.models['claude-code']?.find((model) => model.id === 'xai/grok-4.6')).toMatchObject({
+ efforts: ['low', 'medium', 'high'],
+ defaultEffort: 'high',
+ });
+ expect(xai?.models.pi?.find((model) => model.id === 'grok-4.6')).toMatchObject({
+ efforts: [],
+ defaultEffort: null,
+ });
+ expect(xai?.models.pi?.find((model) => model.id === 'grok-4.3')).toMatchObject({
+ efforts: [],
+ defaultEffort: null,
+ });
});
it('xAI account snapshot is authoritative and projects canonical ids per harness', () => {
@@ -150,6 +162,12 @@ describe('active-catalog discovered augment', () => {
expect(xai?.models.pi?.find((model) => model.id === 'grok-4.6')).toMatchObject({
contextWindow: 500_000,
supportsImageInput: true,
+ efforts: [],
+ defaultEffort: null,
+ });
+ expect(xai?.models['claude-code']?.find((model) => model.id === 'xai/grok-4.6')).toMatchObject({
+ efforts: ['low', 'medium', 'high'],
+ defaultEffort: 'high',
});
});
diff --git a/apps/desktop/src/main/maker-host/__tests__/catalogDerivedModels.test.ts b/apps/desktop/src/main/maker-host/__tests__/catalogDerivedModels.test.ts
index a3018ee2e2..54af402e60 100644
--- a/apps/desktop/src/main/maker-host/__tests__/catalogDerivedModels.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/catalogDerivedModels.test.ts
@@ -232,12 +232,12 @@ describe('deriveAvailableModels — dynamic-first catalog contract', () => {
const cc = deriveAvailableModels(BUNDLED_CATALOG, 'claude-code');
const codex = deriveAvailableModels(BUNDLED_CATALOG, 'codex');
expect(cc.map((m) => m.id)).toEqual([
- 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
+ 'xai/grok-4.6', 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
'xai/grok-4.20-multi-agent-0309', 'xai/grok-4.20-0309-reasoning',
'xai/grok-4.20-0309-non-reasoning', 'xai/grok-4.20', 'xai/grok-code-fast',
]);
expect(codex.map((m) => m.id)).toEqual([
- 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
+ 'xai/grok-4.6', 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
'xai/grok-4.20-multi-agent-0309', 'xai/grok-4.20-0309-reasoning',
'xai/grok-4.20-0309-non-reasoning', 'xai/grok-4.20', 'xai/grok-code-fast',
]);
@@ -245,6 +245,13 @@ describe('deriveAvailableModels — dynamic-first catalog contract', () => {
it('xai 静态条目字段透传(窗口 / effort / 分组)', () => {
const codex = deriveAvailableModels(BUNDLED_CATALOG, 'codex');
+ expect(codex.find((m) => m.id === 'xai/grok-4.6')).toMatchObject({
+ displayName: 'Grok 4.6',
+ contextWindow: 500_000,
+ efforts: ['low', 'medium', 'high'],
+ defaultEffort: 'high',
+ group: 'grok',
+ });
expect(codex.find((m) => m.id === 'xai/grok-4.3')).toMatchObject({
displayName: 'Grok 4.3',
contextWindow: 1_000_000,
@@ -279,7 +286,7 @@ describe('deriveAvailableModels — dynamic-first catalog contract', () => {
expect(ids).toEqual([
'claude-opus-4-8',
'chatgpt/gpt-5.5',
- 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
+ 'xai/grok-4.6', 'xai/grok-4.5', 'xai/grok-4.3', 'xai/grok-build-0.1',
'xai/grok-4.20-multi-agent-0309', 'xai/grok-4.20-0309-reasoning',
'xai/grok-4.20-0309-non-reasoning', 'xai/grok-4.20', 'xai/grok-code-fast',
'gpt-5.5',
diff --git a/apps/desktop/src/main/maker-host/__tests__/modelPlane.test.ts b/apps/desktop/src/main/maker-host/__tests__/modelPlane.test.ts
index 8a6dc32013..3e1c270bc8 100644
--- a/apps/desktop/src/main/maker-host/__tests__/modelPlane.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/modelPlane.test.ts
@@ -530,7 +530,23 @@ describe('本地 override(local 永远最高)', () => {
});
it('一条 perAgent.codex patch 只修 xAI Codex 档位,claude root 与 Pi 官方目录不动', () => {
- setActiveCatalog(baseCatalog([grokEntry()]));
+ const catalog = baseCatalog([grokEntry()]);
+ const xai = catalog.providers.find((provider) => provider.id === 'xai');
+ if (!xai) throw new Error('bundled catalog missing xai');
+ // Loaded catalogs keep CC/Codex fallback membership; official Pi extras must not leak.
+ xai.models.pi = [
+ ...(xai.models.pi ?? []),
+ {
+ id: 'grok-pi-only-fixture',
+ name: 'Pi Only Fixture',
+ group: 'grok',
+ contextWindow: 128_000,
+ efforts: ['low'],
+ defaultEffort: 'low',
+ status: 'active',
+ },
+ ];
+ setActiveCatalog(catalog);
setLocalCatalogOverrides(
overridesOf({
patches: {
@@ -549,7 +565,7 @@ describe('本地 override(local 永远最高)', () => {
expect(models('xai', 'pi').find((m) => m.id === 'grok-test')).toMatchObject({
efforts: ['low', 'medium', 'high', 'xhigh'],
});
- expect(models('xai', 'pi').some((m) => m.id === 'grok-4.6')).toBe(false);
+ expect(models('xai', 'pi').some((m) => m.id === 'grok-pi-only-fixture')).toBe(false);
});
it('本地 perAgent 也在 bridge 目标端生效,且不能写展示/status 字段', () => {
diff --git a/apps/desktop/src/main/maker-host/active-catalog.ts b/apps/desktop/src/main/maker-host/active-catalog.ts
index eee748eac1..aa08974988 100644
--- a/apps/desktop/src/main/maker-host/active-catalog.ts
+++ b/apps/desktop/src/main/maker-host/active-catalog.ts
@@ -672,8 +672,8 @@ function projectXaiPiModel(provider: Provider, model: CatalogModel): CatalogMode
? { contextWindowVerified: model.contextWindowVerified }
: {}),
...(model.maxOutput !== undefined ? { maxOutput: model.maxOutput } : {}),
- efforts: model.efforts,
- defaultEffort: model.defaultEffort,
+ // Official Pi effort maps stay authoritative, including explicit empty lists.
+ // CC/Codex root efforts must not leak into the Pi projection.
status: model.status,
defaultEnabled: model.defaultEnabled,
};
diff --git a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx
index 751123b23e..01b64de1d1 100644
--- a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx
+++ b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx
@@ -205,9 +205,12 @@ const OFFICIAL_API_PRESETS: Record<string, ProviderPreset> = {
codex: {
baseUrl: 'https://api.x.ai/v1',
wireProtocol: 'openai-chat',
+ // contextWindow 必须与目录一致:拉取失败时 handleFinish 只读预设窗口,
+ // 缺省会落 toCatalogModel 的 200k 默认。
models: [
- { id: 'grok-4.5', name: 'Grok 4.5' },
- { id: 'grok-4.3', name: 'Grok 4.3' },
+ { id: 'grok-4.6', name: 'Grok 4.6', contextWindow: 500_000 },
+ { id: 'grok-4.5', name: 'Grok 4.5', contextWindow: 500_000 },
+ { id: 'grok-4.3', name: 'Grok 4.3', contextWindow: 1_000_000 },
],
},
},
diff --git a/packages/model-providers/catalog/model-registry.json b/packages/model-providers/catalog/model-registry.json
index 2899947ea4..97251e3951 100644
--- a/packages/model-providers/catalog/model-registry.json
+++ b/packages/model-providers/catalog/model-registry.json
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
- "updatedAt": "2026-08-14T00:00:00.000Z",
+ "updatedAt": "2026-08-17T00:00:00.000Z",
"models": [
{
"id": "openai/gpt-5.6-sol",
@@ -857,12 +857,45 @@
}
]
},
+ {
+ "id": "xai/grok-4.6",
+ "name": "Grok 4.6",
+ "status": "active",
+ "group": "grok",
+ "description": "xAI Grok 4.6 旗舰,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
+ "contextWindow": 500000,
+ "efforts": ["low", "medium", "high"],
+ "defaultEffort": "high",
+ "sortOrder": 48,
+ "routes": [
+ {
+ "providerId": "xai",
+ "modelId": "xai/grok-4.6",
+ "agents": ["claude-code", "codex"],
+ "referencePrices": [
+ {
+ "currency": "USD",
+ "variant": "standard",
+ "inputPerMtok": 2,
+ "outputPerMtok": 6,
+ "cacheReadPerMtok": 0.5,
+ "effectiveFrom": "2026-08-12",
+ "source": {
+ "kind": "provider-official",
+ "url": "https://docs.x.ai/developers/pricing",
+ "verifiedAt": "2026-08-17"
+ }
+ }
+ ]
+ }
+ ]
+ },
{
"id": "xai/grok-4.5",
"name": "Grok 4.5",
"status": "active",
"group": "grok",
- "description": "xAI Grok 4.5 新旗舰,编码/agent 任务最强,500k 上下文(SuperGrok 订阅直连)",
+ "description": "xAI Grok 4.5,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
"contextWindow": 500000,
"efforts": ["low", "medium", "high"],
"defaultEffort": "high",
diff --git a/packages/model-providers/catalog/providers.json b/packages/model-providers/catalog/providers.json
index 1ef4bd9683..9763a359f3 100644
--- a/packages/model-providers/catalog/providers.json
+++ b/packages/model-providers/catalog/providers.json
@@ -62,12 +62,23 @@
},
"models": {
"claude-code": [
+ {
+ "id": "xai/grok-4.6",
+ "name": "Grok 4.6",
+ "group": "grok",
+ "sortOrder": 48,
+ "description": "xAI Grok 4.6 旗舰,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
+ "contextWindow": 500000,
+ "efforts": ["low", "medium", "high"],
+ "defaultEffort": "high",
+ "status": "active"
+ },
{
"id": "xai/grok-4.5",
"name": "Grok 4.5",
"group": "grok",
"sortOrder": 49,
- "description": "xAI Grok 4.5 新旗舰,编码/agent 任务最强,500k 上下文(SuperGrok 订阅直连)",
+ "description": "xAI Grok 4.5,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
"contextWindow": 500000,
"efforts": ["low", "medium", "high"],
"defaultEffort": "high",
@@ -158,12 +169,23 @@
}
],
"codex": [
+ {
+ "id": "xai/grok-4.6",
+ "name": "Grok 4.6",
+ "group": "grok",
+ "sortOrder": 48,
+ "description": "xAI Grok 4.6 旗舰,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
+ "contextWindow": 500000,
+ "efforts": ["low", "medium", "high"],
+ "defaultEffort": "high",
+ "status": "active"
+ },
{
"id": "xai/grok-4.5",
"name": "Grok 4.5",
"group": "grok",
"sortOrder": 49,
- "description": "xAI Grok 4.5 新旗舰,编码/agent 任务最强,500k 上下文(SuperGrok 订阅直连)",
+ "description": "xAI Grok 4.5,编码/agent 任务,500k 上下文(SuperGrok 订阅直连)",
"contextWindow": 500000,
"efforts": ["low", "medium", "high"],
"defaultEffort": "high",
diff --git a/packages/model-providers/src/__tests__/catalog.test.ts b/packages/model-providers/src/__tests__/catalog.test.ts
index cb3bcf57e8..60b4eb21cb 100644
--- a/packages/model-providers/src/__tests__/catalog.test.ts
+++ b/packages/model-providers/src/__tests__/catalog.test.ts
@@ -28,6 +28,7 @@ const DYNAMIC_PROVIDER_IDS = ['anthropic', 'openai', 'xd'] as const;
/** xAI 随包 fallback 元数据清单。 */
const EXPECTED_XAI_IDS = [
+ 'xai/grok-4.6',
'xai/grok-4.5',
'xai/grok-4.3',
'xai/grok-build-0.1',
@@ -150,6 +151,11 @@ describe('bundled catalog validity (dynamic-first contract)', () => {
efforts: [],
defaultEffort: null,
});
+ expect(xai.models['claude-code']?.find((m) => m.id === 'xai/grok-4.6')).toMatchObject({
+ contextWindow: 500_000,
+ efforts: ['low', 'medium', 'high'],
+ defaultEffort: 'high',
+ });
});
it('xai ships both Grok Imagine subscription image models', () => {
diff --git a/packages/model-providers/src/__tests__/modelRegistry.test.ts b/packages/model-providers/src/__tests__/modelRegistry.test.ts
index 06f459724d..9cf3d67ec4 100644
--- a/packages/model-providers/src/__tests__/modelRegistry.test.ts
+++ b/packages/model-providers/src/__tests__/modelRegistry.test.ts
@@ -101,6 +101,16 @@ describe("model registry", () => {
});
it("selects xAI token bands and time-effective Anthropic prices", () => {
+ expect(
+ resolveModelReferencePrice(registry, "xai", "xai/grok-4.6", {
+ inputTokens: 199_999,
+ })?.price,
+ ).toMatchObject({ inputPerMtok: 2, outputPerMtok: 6, cacheReadPerMtok: 0.5 });
+ expect(
+ resolveModelReferencePrice(registry, "xai", "xai/grok-4.6", {
+ inputTokens: 200_000,
+ })?.price,
+ ).toMatchObject({ inputPerMtok: 2, outputPerMtok: 6, cacheReadPerMtok: 0.5 });
expect(
resolveModelReferencePrice(registry, "xai", "xai/grok-4.5", {
inputTokens: 199_999,