Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions packages/ai/changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# changes.md — ai

## Add GLM-5.3 to the Z.AI Coding Plan catalog (2026-08-15)

### What changed

- `scripts/generate-models.ts`: added reviewed `glm-5.3` fallback metadata that live `models.dev` values can override, including the official 1M-token context, 128K-token output limit, and low/high/max reasoning-effort mapping.
- `src/providers/data/{zai,zai-coding-cn}.json`: regenerated the committed Z.AI snapshots and added `glm-5.3` to the global and China Coding Plan catalogs.
- `test/openai-completions-tool-choice.test.ts`: covers the generated catalog values and the exact `reasoning_effort` payload mapping.

### Why

- Z.AI released GLM-5.3 to every Coding Plan tier before adding it to `models.dev`; without a stable fallback, strict generation omits a model that the provider endpoint already serves.
- Z.AI documents the general GLM-5.3 API as coming soon. Coding Plan therefore retains zero metered cost metadata rather than borrowing unannounced API pricing.

### Why this cannot be expressed as an extension

- Built-in model IDs, provider request metadata, and their generated TypeScript types are fixed before coding-agent extensions load.

### Modified upstream files

- `scripts/generate-models.ts`
- `src/providers/data/.manifest.json`
- `src/providers/data/zai.json`
- `src/providers/data/zai-coding-cn.json`
- `test/openai-completions-tool-choice.test.ts`

### Expected merge conflict zones

- MEDIUM: the Z.AI branch in `loadModelsDevData()` when `models.dev` begins publishing GLM-5.3.
- MEDIUM: generated Z.AI provider JSON whenever its live catalog changes.

## Follow Groq Qwen catalog replacement during generation (2026-08-04)

### What changed
Expand Down Expand Up @@ -153,7 +183,6 @@
an import + re-export. If upstream edits those predicates, port the edit into
`src/utils/prompt-cache-ttl.ts` so the resolver and the adapters stay in agreement.


## Cover Claude Opus 5 in Anthropic adaptive-thinking metadata (2026-07-25)

### What changed
Expand All @@ -164,7 +193,7 @@
`mapThinkingLevelToEffort` maps Opus 5 `xhigh`/`max` to native efforts instead of collapsing them to `high`.
- `src/providers/data/*.json`: regenerated so every provider that serves Opus 5 (anthropic, github-copilot,
opencode, vercel-ai-gateway, openrouter, amazon-bedrock) carries `forceAdaptiveThinking`, `supportsTemperature:
false`, and the `xhigh`/`max` thinking level map.
false`, and the `xhigh`/`max` thinking level map.

### Why

Expand Down
38 changes: 34 additions & 4 deletions packages/ai/scripts/generate-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,33 @@ const NVIDIA_NIM_UNSUPPORTED_MODELS = new Set([
"upstage/solar-10.7b-instruct",
]);
const ZAI_TOOL_STREAM_UNSUPPORTED_MODELS = new Set(["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v"]);
const ZAI_CODING_STABLE_MODELS = {
"glm-5.3": {
id: "glm-5.3",
name: "GLM-5.3",
tool_call: true,
reasoning: true,
reasoning_options: [{ type: "effort", values: ["low", "high", "max"] }],
limit: { context: 1_000_000, output: 131_072 },
modalities: { input: ["text"] },
},
} satisfies Record<string, ModelsDevModel>;
const ZAI_GLM52_THINKING_LEVEL_MAP = {
minimal: null,
low: "high",
medium: "high",
high: "high",
max: "max",
} as const;
const ZAI_GLM53_THINKING_LEVEL_MAP = {
off: "low",
minimal: "low",
low: "low",
medium: "high",
high: "high",
xhigh: "max",
max: "max",
} as const;
const OPENCODE_GO_GLM52_THINKING_LEVEL_MAP = {
off: null,
minimal: null,
Expand Down Expand Up @@ -1715,13 +1735,23 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
] as const;

if (data["zai-coding-plan"]?.models) {
const liveZaiModels = data["zai-coding-plan"].models as Record<string, ModelsDevModel>;
const zaiModels: Record<string, ModelsDevModel> = {
...ZAI_CODING_STABLE_MODELS,
...liveZaiModels,
};
for (const { provider, baseUrl } of zaiCodingPlanVariants) {
for (const [modelId, model] of Object.entries(data["zai-coding-plan"].models)) {
for (const [modelId, model] of Object.entries(zaiModels)) {
const m = model as ModelsDevModel;
if (m.tool_call !== true) continue;
const supportsImage = m.modalities?.input?.includes("image");

const isGlm52 = modelId === "glm-5.2";
const thinkingLevelMap =
modelId === "glm-5.2"
? ZAI_GLM52_THINKING_LEVEL_MAP
: modelId === "glm-5.3"
? ZAI_GLM53_THINKING_LEVEL_MAP
: undefined;

models.push({
id: modelId,
Expand All @@ -1730,7 +1760,7 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
provider,
baseUrl,
reasoning: m.reasoning === true,
...(isGlm52 ? { thinkingLevelMap: ZAI_GLM52_THINKING_LEVEL_MAP } : {}),
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
input: supportsImage ? ["text", "image"] : ["text"],
cost: {
input: m.cost?.input || 0,
Expand All @@ -1741,7 +1771,7 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
compat: {
supportsDeveloperRole: false,
thinkingFormat: "zai",
...(isGlm52 ? { supportsReasoningEffort: true } : {}),
...(thinkingLevelMap ? { supportsReasoningEffort: true } : {}),
...(!ZAI_TOOL_STREAM_UNSUPPORTED_MODELS.has(modelId) ? { zaiToolStream: true } : {}),
},
contextWindow: m.limit?.context || 4096,
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/providers/data/.manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schemaVersion":3,"generatedAt":"2026-08-14T05:44:35.418Z","structureHash":"b215358a0059b93146ccfd319ae722a1de8c0c151745ee2930d8c16d1233dc9c","files":{"alibaba-token-plan.json":"e84668baa90b6ea64fbd9a5192bd3945c5011bc79ac2b4f3e7b3b58467d4403d","amazon-bedrock.json":"d6e3da5a005116eafc76e8202e3644b74c8a9ce444204c4ed9840f78ccc5f7ed","ant-ling.json":"4979fe79d99ed97382d7ce40170c6132e932e77906de1eb54464c042e7d63633","anthropic.json":"5bf1deecb96805ccba8ec004680e54b1c73ac29a8bfbbf4adaf7c5e66c1ceef2","azure-openai-responses.json":"5315b6a2299fefbdbb6cc13a720544077c9498132ad5e3a7d76a8c1daa8e9335","baseten.json":"cbf1233893814cf4bd6d874ec854e5f6a6d531c251f916f2b2e5744d771ef48b","cerebras.json":"3fd3e19b83ab4be07d27817e25e5be0ffe4158b1394f0311d6a22d9f03847728","cloudflare-ai-gateway.json":"cd050aa8cf61b73b13d532341639e1d0f22fd29d8a889ca669d412cd4b477d45","cloudflare-workers-ai.json":"e3dd801884fc61e99b2148aa456974335fe25c040c6428f569b83738a594e4b4","deepseek.json":"0dcc807a4e5827b488c6ceac87884ff6e735e01cf4f2ddfec9dd812e6fde041b","fireworks.json":"2d97f1ef72a7b396b4b88ab74b432931792f8367dd0d5db75fd222e0cf6669f0","github-copilot.json":"1f20de3d19aba3eedc996804b410952b3e6b14f7f21ad0c56770ed114caa026e","google-vertex.json":"1f2fb67e61815616f5a243912622b373cb61fe1310c63e620c17b8e86899ce18","google.json":"c6d9822f7eda23cfeb7d29caee0baa7d2fa7bf3561252734a17428937fbcbfd1","groq.json":"f1eb899453e70b5e4479fe6eb78869ee99121fa6d4a019a5a05ab42d2ada8992","huggingface.json":"b48d61ffd7ea6635b8f6132fc3db1eaf94d8db11bccb359a3b7f8cd6d5e59c6d","kimi-coding.json":"9d73ca15313628bb8cf80c21e6466164e350d68471e2d7205b5e21bcd2c141f3","minimax-cn.json":"8ccd71ff838f4b78bb88809babb0dc32a4fcfaec2bc4f4083841000428df4f77","minimax.json":"253edd4c910a41c8bb252400ba099f3a4de0a8900ce154319288ab091b372987","mistral.json":"4f9d84bf1ba10cb14ff2c9e23e77d63441756ef3500375dd4ad10094614b215b","moonshotai-cn.json":"dbf1b71ee36812fe64b014177ff455809a8dd852bbbd584422645beb85635127","moonshotai.json":"2d7518b4769e97ac900366175c8b60ff86a02675bb6f6cc2fffcc6761fda6faa","nvidia.json":"602427f41bc6c23853e329f2eb62c3b054452819115d56db687e559d8938f0ac","openai-codex.json":"4a73818291987693fcb53e9e61b4be3429ffd78b3f64ea877a34c5f9928c89e1","openai.json":"2c5d2354c55a80671f20f555844986ab381fee93da26e03c0e42cbae77b519a5","opencode-go.json":"f6fbfbb03cdd63d97a8c1217fec75ce6f952ff5c92e575e556d5bd942ed8e6a9","opencode.json":"4cc3367c6e55e13a892e2ccf1b03450a599507543f5141129ec4686080590a47","opengateway.json":"33e51de4e9b7808a703d656ef19e7abd804b7556a78a78be1bf80860a2ebdb97","openrouter.json":"cb5e9e0a00217ebc85002c7f0ce6a92840ff1e5e55423e2dd34498d794fce781","qwen-token-plan-cn.json":"bc478981a0786a2c43acffc44846596a8df9c78e583a2348348f6cbf09738b9b","qwen-token-plan-individual.json":"0e1578a5c0e11d65644bb42d1d6efee5af97a55a4881d0421ab68bd970d4d4ef","qwen-token-plan.json":"3fa3afccf5577c73abeb2e4eccd19f07ad4c59c34299b6d6fc284b77da24cd21","together.json":"f8f3f9c49c8ffeb27b57ba547238ffb143a05d727962d016569ff71054314fe1","vercel-ai-gateway.json":"57c75756c05323c3260d95317db51133085a2123f89c3336e3baa45ec37b85dd","xai.json":"282838b0546d63106c81f1703cdf5ed31ebfe0c5f13a4bec0d590472cbbe03f2","xiaomi-token-plan-ams.json":"b1886b741867c90a838c377e86ad64b26ca6b0e349f1a75bc5fd4ed99df03c21","xiaomi-token-plan-cn.json":"11f459b794eddd64a9d9d102f2799c364732b7f0d562e22573f4995a5d1e1a30","xiaomi-token-plan-sgp.json":"0b9953d03b75260aba0ad604cc76d7ed26d6841448819e8c7488bf0d90948d2c","xiaomi.json":"edf39e0edd9dcae23e669635ea782e5870c0b9663d4b918b8ff9bd307cfe35f8","zai-coding-cn.json":"c2d1e137238b6f248b5f620f76b64520aa2ba1543e991dd0d14b708e50c8cd66","zai.json":"cb48b354442f1e49919cd93b928216d5d881d2f98a55349ad592a8e68bb8e6c3"}}
{"schemaVersion":3,"generatedAt":"2026-08-15T05:36:27.227Z","structureHash":"a255250d2e6e34379add154a0b6a9cb38015efae3e22e5bf396d1bcc12575cc5","files":{"alibaba-token-plan.json":"e84668baa90b6ea64fbd9a5192bd3945c5011bc79ac2b4f3e7b3b58467d4403d","amazon-bedrock.json":"d6e3da5a005116eafc76e8202e3644b74c8a9ce444204c4ed9840f78ccc5f7ed","ant-ling.json":"4979fe79d99ed97382d7ce40170c6132e932e77906de1eb54464c042e7d63633","anthropic.json":"5bf1deecb96805ccba8ec004680e54b1c73ac29a8bfbbf4adaf7c5e66c1ceef2","azure-openai-responses.json":"5315b6a2299fefbdbb6cc13a720544077c9498132ad5e3a7d76a8c1daa8e9335","baseten.json":"cbf1233893814cf4bd6d874ec854e5f6a6d531c251f916f2b2e5744d771ef48b","cerebras.json":"3fd3e19b83ab4be07d27817e25e5be0ffe4158b1394f0311d6a22d9f03847728","cloudflare-ai-gateway.json":"cd050aa8cf61b73b13d532341639e1d0f22fd29d8a889ca669d412cd4b477d45","cloudflare-workers-ai.json":"e3dd801884fc61e99b2148aa456974335fe25c040c6428f569b83738a594e4b4","deepseek.json":"0dcc807a4e5827b488c6ceac87884ff6e735e01cf4f2ddfec9dd812e6fde041b","fireworks.json":"2d97f1ef72a7b396b4b88ab74b432931792f8367dd0d5db75fd222e0cf6669f0","github-copilot.json":"1f20de3d19aba3eedc996804b410952b3e6b14f7f21ad0c56770ed114caa026e","google-vertex.json":"1f2fb67e61815616f5a243912622b373cb61fe1310c63e620c17b8e86899ce18","google.json":"c6d9822f7eda23cfeb7d29caee0baa7d2fa7bf3561252734a17428937fbcbfd1","groq.json":"f1eb899453e70b5e4479fe6eb78869ee99121fa6d4a019a5a05ab42d2ada8992","huggingface.json":"b48d61ffd7ea6635b8f6132fc3db1eaf94d8db11bccb359a3b7f8cd6d5e59c6d","kimi-coding.json":"9d73ca15313628bb8cf80c21e6466164e350d68471e2d7205b5e21bcd2c141f3","minimax-cn.json":"8ccd71ff838f4b78bb88809babb0dc32a4fcfaec2bc4f4083841000428df4f77","minimax.json":"253edd4c910a41c8bb252400ba099f3a4de0a8900ce154319288ab091b372987","mistral.json":"4f9d84bf1ba10cb14ff2c9e23e77d63441756ef3500375dd4ad10094614b215b","moonshotai-cn.json":"dbf1b71ee36812fe64b014177ff455809a8dd852bbbd584422645beb85635127","moonshotai.json":"2d7518b4769e97ac900366175c8b60ff86a02675bb6f6cc2fffcc6761fda6faa","nvidia.json":"602427f41bc6c23853e329f2eb62c3b054452819115d56db687e559d8938f0ac","openai-codex.json":"4a73818291987693fcb53e9e61b4be3429ffd78b3f64ea877a34c5f9928c89e1","openai.json":"2c5d2354c55a80671f20f555844986ab381fee93da26e03c0e42cbae77b519a5","opencode-go.json":"f6fbfbb03cdd63d97a8c1217fec75ce6f952ff5c92e575e556d5bd942ed8e6a9","opencode.json":"4cc3367c6e55e13a892e2ccf1b03450a599507543f5141129ec4686080590a47","opengateway.json":"33e51de4e9b7808a703d656ef19e7abd804b7556a78a78be1bf80860a2ebdb97","openrouter.json":"cb5e9e0a00217ebc85002c7f0ce6a92840ff1e5e55423e2dd34498d794fce781","qwen-token-plan-cn.json":"bc478981a0786a2c43acffc44846596a8df9c78e583a2348348f6cbf09738b9b","qwen-token-plan-individual.json":"0e1578a5c0e11d65644bb42d1d6efee5af97a55a4881d0421ab68bd970d4d4ef","qwen-token-plan.json":"3fa3afccf5577c73abeb2e4eccd19f07ad4c59c34299b6d6fc284b77da24cd21","together.json":"f8f3f9c49c8ffeb27b57ba547238ffb143a05d727962d016569ff71054314fe1","vercel-ai-gateway.json":"57c75756c05323c3260d95317db51133085a2123f89c3336e3baa45ec37b85dd","xai.json":"282838b0546d63106c81f1703cdf5ed31ebfe0c5f13a4bec0d590472cbbe03f2","xiaomi-token-plan-ams.json":"b1886b741867c90a838c377e86ad64b26ca6b0e349f1a75bc5fd4ed99df03c21","xiaomi-token-plan-cn.json":"11f459b794eddd64a9d9d102f2799c364732b7f0d562e22573f4995a5d1e1a30","xiaomi-token-plan-sgp.json":"0b9953d03b75260aba0ad604cc76d7ed26d6841448819e8c7488bf0d90948d2c","xiaomi.json":"edf39e0edd9dcae23e669635ea782e5870c0b9663d4b918b8ff9bd307cfe35f8","zai-coding-cn.json":"ce947350fde7e6b8cda77cc9301027c54801b3aec6d15ea945fa9ad075921730","zai.json":"05026fc8e0c7bdae51fdaf8e4757d8a7d34f09c763b63dd3237f8f559e8453b6"}}
2 changes: 1 addition & 1 deletion packages/ai/src/providers/data/zai-coding-cn.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"openai-completions":{"glm-4.7":{"id":"glm-4.7","name":"GLM-4.7","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":204800,"maxTokens":131072},"glm-5-turbo":{"id":"glm-5-turbo","name":"GLM-5-Turbo","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":200000,"maxTokens":131072},"glm-5.2":{"id":"glm-5.2","name":"GLM-5.2","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"thinkingLevelMap":{"minimal":null,"low":"high","medium":"high","high":"high","max":"max"},"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":1000000,"maxTokens":131072},"glm-5.2-highspeed":{"id":"glm-5.2-highspeed","name":"GLM-5.2 Highspeed","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":1000000,"maxTokens":131072}}}
{"openai-completions":{"glm-4.7":{"id":"glm-4.7","name":"GLM-4.7","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":204800,"maxTokens":131072},"glm-5-turbo":{"id":"glm-5-turbo","name":"GLM-5-Turbo","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":200000,"maxTokens":131072},"glm-5.2":{"id":"glm-5.2","name":"GLM-5.2","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"thinkingLevelMap":{"minimal":null,"low":"high","medium":"high","high":"high","max":"max"},"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":1000000,"maxTokens":131072},"glm-5.2-highspeed":{"id":"glm-5.2-highspeed","name":"GLM-5.2 Highspeed","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":1000000,"maxTokens":131072},"glm-5.3":{"id":"glm-5.3","name":"GLM-5.3","api":"openai-completions","provider":"zai-coding-cn","baseUrl":"https://open.bigmodel.cn/api/coding/paas/v4","reasoning":true,"thinkingLevelMap":{"off":"low","minimal":"low","low":"low","medium":"high","high":"high","xhigh":"max","max":"max"},"input":["text"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"compat":{"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","thinkingFormat":"zai","zaiToolStream":true},"contextWindow":1000000,"maxTokens":131072}}}
Loading