Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

dashscope-cn-docs.ts

637 lines23.1 KB

1/** Public Beijing catalog and RMB quotes, without international substitution. */
2import { compileTokenCard } from '@modelschemas/rate-card'
3import type { FactSource, ModelInfo } from './types.ts'
4​
5export const DASHSCOPE_CN_PRICES =
6 'https://help.aliyun.com/zh/model-studio/model-pricing.md'
7export const DASHSCOPE_CN_MODELS =
8 'https://help.aliyun.com/zh/model-studio/models.md'
9export interface CnDoc {
10 text: string
11 url: string
12 hash: string
14function fail(message: string): never {
15 throw new Error(`dashscope-cn: ${message}`)
17export function cnText(value: string): string {
18 return value
19 .replace(/\\</g, '&lt;')
20 .replace(/<[^>]+>/g, ' ')
21 .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
22 .replace(/&lt;/g, '<')
23 .replace(/&gt;/g, '>')
24 .replace(/&amp;/g, '&')
25 .replace(/&nbsp;/g, ' ')
26 .replace(/\\</g, '<')
27 .replace(/\\([_*-])/g, '$1')
28 .replace(/[*`]/g, '')
29 .replace(/\s+/g, ' ')
30 .trim()
32/** Expand actual MDX rowSpan/colSpan values, including self-closing empty cells. */
33export function cnTable(table: string): string[][] {
34 const grid: string[][] = []
35 const pending = new Map<number, { text: string; remaining: number }>()
36 for (const row of table.matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)) {
37 const values: string[] = []
38 let column = 0
39 const fill = () => {
40 while (pending.has(column)) {
41 const span = pending.get(column)!
42 values[column++] = span.text
43 if (--span.remaining === 0) pending.delete(column - 1)
44 }
45 }
46 for (const cell of row[1]!.matchAll(
47 /<t[dh]\b([^>]*?)(?:\/>|>([\s\S]*?)<\/t[dh]>)/gi,
48 )) {
49 fill()
50 const span = (name: string) => {
51 const attrs = cell[1] ?? ''
52 const found = new RegExp(
53 `${name}\\s*=\\s*(?:\\{(\\d+)\\}|"(\\d+)")`,
54 'i',
55 ).exec(attrs)
56 if (new RegExp(name, 'i').test(attrs) && !found)
57 fail('unreadable table span')
58 const value = Number(found?.[1] ?? found?.[2] ?? 1)
59 if (!Number.isSafeInteger(value) || value < 1)
60 fail('invalid table span')
61 return value
62 }
63 const across = span('colspan'),
64 down = span('rowspan')
65 for (let index = 0; index < across; index++) {
66 if (pending.has(column)) fail('overlapping table span')
67 values[column] = cell[2] ?? ''
68 if (down > 1)
69 pending.set(column, { text: cell[2] ?? '', remaining: down - 1 })
70 column++
71 }
72 }
73 fill()
74 if (values.length) grid.push(values)
75 }
76 // A rowSpan past the table's last row is clipped, as a browser shows it.
77 return grid
79function cellIds(cell: string): string[] {
80 const body = cell.split(/\n\s*>/)[0] ?? ''
81 const text = cnText(body.replace(/<\/(?:p|div)>|<br\s*\/?\s*>/gi, '\n'))
82 const ids = [
83 ...new Set(
84 text.split(/\s+/).filter((id) => /^[a-z][a-z0-9_./-]+$/i.test(id)),
85 ),
86 ]
87 if (
88 !ids.length &&
89 /^参见\s*模型列表$/.test(text) &&
90 /(?:\[模型列表\]\([^)]*\)|<a\b[^>]*href=)/.test(body)
91 )
92 return []
93 if (!ids.length) fail(`unreadable model ID cell: ${text}`)
94 return ids
96function activity(heading: string): ModelInfo['activity'] {
97 if (/文本生成/.test(heading)) return 'chat'
98 if (/向量|文本嵌入|多模态嵌入/.test(heading)) return 'embeddings'
99 if (/重排序|排序模型/.test(heading)) return null // The repository has no rerank activity.;
100 if (/图像|图片/.test(heading)) return 'image'
101 if (/视频/.test(heading)) return 'video'
102 if (/音频|语音|音乐/.test(heading)) return 'audio'
103 return null
105function ownSource(doc: CnDoc, path: string): FactSource {
106 return {
107 derivation: 'docs-derived',
108 sourceUrl: doc.url,
109 sourceHash: doc.hash,
110 path,
111 }
113function amount(text: string): number {
114 const match = /^(\d+(?:\.\d+)?)元$/.exec(text)
115 if (!match) fail(`unreadable RMB token quote: ${text}`)
116 const value = Number(match[1]) / 1e6
117 if (!Number.isFinite(value) || value < 0) fail('invalid RMB token quote')
118 return value
120/**
121 * One quote per prompt-size floor. A cell may tier itself, as MiniMax-M3's
122 * does: "输入不超过 512k Token:2.1元 输入超过 512k Token:4.2元".
123 */
124function amounts(cell: string): Map<number, number> {
125 const text = cnText(cell)
126 if (!/Token:/.test(text)) return new Map([[0, amount(text)]])
127 const match =
128 /^输入不超过\s*(\d+(?:\.\d+)?)([KM])\s*Token:(\S+)\s+输入超过\s*(\d+(?:\.\d+)?)([KM])\s*Token:(\S+)$/i.exec(
129 text,
130 )
131 if (!match || match[1] !== match[4] || match[2] !== match[5])
132 fail(`unreadable tiered RMB token quote: ${text}`)
133 const bound = Number(match[1]) * (match[2]!.toUpperCase() === 'M' ? 1e6 : 1e3)
134 if (!Number.isSafeInteger(bound) || bound <= 0)
135 fail('invalid tiered token bound')
136 return new Map([
137 [0, amount(match[3]!)],
138 [bound, amount(match[6]!)],
139 ])
141function floor(cell: string): number {
142 const text = cnText(cell).replace(/\s+/g, '')
143 if (text === '无阶梯计价' || text === '不区分阶梯') return 0
144 const match =
145 /^(\d+(?:\.\d+)?)([KM]?)<Token[≤<](?:=?)(\d+(?:\.\d+)?)([KM]?)$/i.exec(text)
146 if (!match) fail(`unreadable token range: ${text}`)
147 const scale = (unit: string) =>
148 unit.toUpperCase() === 'M' ? 1e6 : unit.toUpperCase() === 'K' ? 1e3 : 1
149 const min = Number(match[1]) * scale(match[2]!),
150 max = Number(match[3]) * scale(match[4]!)
151 if (!Number.isFinite(min) || max <= min) fail('invalid token range')
152 return min
154interface Quoted {
155 models: string[]
156 mode: string
157 floor: number
158 rates: Record<string, number>
160/** Balance nested model-family Tabs inside each explicitly Beijing panel. */
161export function cnBeijingTabs(
162 text: string,
163): Array<{ body: string; start: number }> {
164 const panels: Array<{ body: string; start: number }> = []
165 const stack: Array<{ start: number; bodyAt: number; beijing: boolean }> = []
166 for (const tag of text.matchAll(/<\/?Tab\b[^>]*>/g)) {
167 if (tag[0].startsWith('</')) {
168 const open = stack.pop()
169 if (!open) fail('unbalanced region Tab')
170 if (open.beijing)
171 panels.push({
172 body: text.slice(open.bodyAt, tag.index),
173 start: open.start,
174 })
175 } else
176 stack.push({
177 start: tag.index,
178 bodyAt: tag.index + tag[0].length,
179 beijing: /\btitle="华北2(北京)"/.test(tag[0]),
180 })
181 }
182 if (stack.length) fail('unclosed region Tab')
183 return panels
185export function cnPriceModels(doc: CnDoc): ModelInfo[] {
186 const result = new Map<string, ModelInfo>()
187 const quoted = new Map<string, Quoted[]>()
188 let tabs = 0
189 for (const tab of cnBeijingTabs(doc.text)) {
190 tabs++
191 const prior = doc.text.slice(0, tab.start)
192 const major = [...prior.matchAll(/^## (.*)$/gm)].at(-1)?.[1] ?? ''
193 for (const table of tab.body.matchAll(/<table\b[^>]*>[\s\S]*?<\/table>/g)) {
194 const rows = cnTable(table[0])
195 const head = (rows.shift() ?? []).map(cnText)
196 const idAt = head.findIndex((column) => /模型\s*ID/.test(column))
197 if (idAt < 0) continue // Native cache/promotion tables are not model listings.
198 for (const column of head) {
199 if (
200 /^(?:输入|输出)单价.*Token/.test(column) &&
201 !/^(?:输入|输出)单价\s*(每百万\s*Token)/.test(column)
202 )
203 fail(`unknown token price unit ${column}`)
204 }
205 const inputAt = head.findIndex((column) =>
206 /^输入单价\s*(每百万\s*Token)/.test(column),
207 )
208 const multipleTokenMeters =
209 head.filter((column) => /^输入单价\s*(每百万\s*Token)/.test(column))
210 .length > 1 ||
211 head.filter((column) => /^输出单价\s*(每百万\s*Token)/.test(column))
212 .length > 1
213 while (rows[0] && cnText(rows[0][idAt] ?? '') === head[idAt]) rows.shift()
214 const outputAt = head.findIndex((column) =>
215 /^输出单价\s*(每百万\s*Token)/.test(column),
216 )
217 const rangeAt = head.findIndex((column) =>
218 /输入Token(?:数|范围|数量)/.test(column),
219 )
220 const modeAt = head.indexOf('模式')
221 for (const row of rows) {
222 if (row.length !== head.length)
223 fail(`unequal model table columns ${head.join('|')}`)
224 const ids = cellIds(row[idAt]!)
225 for (const rawId of ids) {
226 if (!result.has(rawId))
227 result.set(rawId, {
228 rawId,
229 displayName: null,
230 activity: activity(major),
231 pricing: null,
232 contextWindow: null,
233 maxOutput: null,
234 capabilities: null,
235 serverTools: null,
236 modalities: null,
237 reasoning: null,
238 requestMap: null,
239 schemaEndpointId: null,
240 absent: { pricing: 'cleared' },
241 providerMetadata: {
242 listingScope: 'public Beijing documentation',
243 nativePricingColumns: head,
244 },
245 })
246 }
247 // Dimensional audio/image/video/size pricing is sourced but requires its
248 // own usage model; it is not a single text token quote. Remain null.
249 if (inputAt < 0 || multipleTokenMeters) continue
250 if (/^已下线(?:[ >]|$)/.test(cnText(row[inputAt]!))) {
251 for (const id of ids) result.get(id)!.deprecated = true
252 continue
253 }
254 if (/^目前仅供免费体验[。.]?|^限时免费$/.test(cnText(row[inputAt]!)))
255 continue
256 if (
257 /忙时.+闲时|^(?:文本|图片|视频|音频)输入:/.test(
258 cnText(row[inputAt]!),
259 )
260 )
261 continue
262 const input = amounts(row[inputAt]!)
263 const output = outputAt >= 0 ? amounts(row[outputAt]!) : null
264 if (
265 output &&
266 JSON.stringify([...input.keys()]) !==
267 JSON.stringify([...output.keys()])
268 )
269 fail(`mismatched input and output price tiers ${ids.join(',')}`)
270 if (input.size > 1 && rangeAt >= 0)
271 fail(`tiered price cell inside a token range row ${ids.join(',')}`)
272 for (const [cellFloor, inputRate] of input) {
273 const rates: Record<string, number> = { input_tokens: inputRate }
274 if (output) rates.output_tokens = output.get(cellFloor)!
275 const quote: Quoted = {
276 models: ids,
277 mode: modeAt >= 0 ? cnText(row[modeAt]!) : '',
278 floor: rangeAt >= 0 ? floor(row[rangeAt]!) : cellFloor,
279 rates,
280 }
281 for (const id of ids)
282 quoted.set(id, [...(quoted.get(id) ?? []), quote])
283 }
284 }
285 }
286 }
287 if (!tabs || !result.size) fail('no Beijing model listing tables')
288 for (const [id, rows] of quoted) {
289 const modes = new Set(rows.map((row) => row.mode))
290 // Distinct thinking-mode prices cannot be selected silently.
291 if (modes.size > 1) continue
292 const tiers = new Map<number, Record<string, number>>()
293 for (const row of rows) {
294 const old = tiers.get(row.floor)
295 if (old && JSON.stringify(old) !== JSON.stringify(row.rates))
296 fail(`conflicting Beijing price ${id}`)
297 tiers.set(row.floor, row.rates)
298 }
299 const base = tiers.get(0)
300 if (
301 base &&
302 [...tiers.values()].some((rates) =>
303 Object.keys(base).some((lever) => rates[lever] === undefined),
304 )
305 )
306 fail(`incomplete price tier ${id}`)
307 if (!base) fail(`missing base price tier ${id}`)
308 const pricing = compileTokenCard(
309 base,
310 [...tiers]
311 .filter(([min]) => min > 0)
312 .sort(([a], [b]) => a - b)
313 .map(([minPromptTokens, rates]) => ({ minPromptTokens, rates })),
314 { url: doc.url, hash: doc.hash, extractedAt: new Date().toISOString() },
315 { currency: 'CNY' },
316 )
317 if (!pricing) fail(`unrepresentable token quote ${id}`)
318 const model = result.get(id)!
319 model.pricing = pricing
320 delete model.absent
321 model.factSources = {
322 pricing: ownSource(doc, '华北2(北京) model pricing table'),
323 }
324 }
325 return [...result.values()]
327​
328/** Exact ids and expressly included snapshots in the provider's Chinese table. */
329export function applyCnTextFacts(models: ModelInfo[], doc: CnDoc): ModelInfo[] {
330 const facts = new Map<
331 string,
332 {
333 contextWindow: number
334 capabilities: string[]
335 unsupportedCapabilities: string[]
336 snapshots: boolean
337 }
338 >()
339 for (const table of doc.text.matchAll(/<table\b[^>]*>[\s\S]*?<\/table>/g)) {
340 const rows = cnTable(table[0]),
341 head = (rows.shift() ?? []).map(cnText)
342 if (head[0] !== '模型ID' || !head.includes('上下文')) continue
343 const contextAt = head.indexOf('上下文')
344 const mapped: Record<string, string> = {
345 思考模式: 'reasoning',
346 'Function Calling': 'tools',
347 结构化输出: 'structured_outputs',
348 }
349 for (const row of rows) {
350 if (row.length !== head.length) fail('unequal native capability table')
351 const ids = [...row[0]!.matchAll(/<code>([^<]+)<\/code>/g)].map(
352 (match) => match[1]!,
353 )
354 if (!ids.length) ids.push(...cellIds(row[0]!))
355 const contextValue = cnText(row[contextAt]!),
356 match = /^(\d+(?:\.\d+)?)([KM])$/i.exec(contextValue)
357 if (!match) fail(`unreadable native context limit ${contextValue}`)
358 const contextWindow =
359 Number(match[1]) * (match[2]!.toUpperCase() === 'M' ? 1e6 : 1e3)
360 if (!Number.isSafeInteger(contextWindow) || contextWindow <= 0)
361 fail('invalid native context limit')
362 const capabilities: string[] = [],
363 unsupportedCapabilities: string[] = []
364 for (let index = 0; index < head.length; index++) {
365 const flag = mapped[head[index]!]
366 if (!flag) continue
367 const value = cnText(row[index]!)
368 if (value !== '支持' && value !== '不支持')
369 fail('unknown capability support value')
370 if (value === '支持') capabilities.push(flag)
371 else unsupportedCapabilities.push(flag)
372 }
373 for (const id of ids) {
374 const fact = {
375 contextWindow,
376 capabilities,
377 unsupportedCapabilities,
378 snapshots: /及其快照版本/.test(cnText(row[0]!)),
379 }
380 if (
381 facts.has(id) &&
382 JSON.stringify(facts.get(id)) !== JSON.stringify(fact)
383 )
384 fail('conflicting native capability rows')
385 facts.set(id, fact)
386 }
387 }
388 }
389 if (!facts.size) fail('native text catalog has no capability tables')
390 return models.map((model) => {
391 const candidates = [...facts].filter(
392 ([id, fact]) =>
393 id === model.rawId ||
394 (fact.snapshots &&
395 model.rawId.startsWith(`${id}-`) &&
396 /^\d{4}-\d{2}-\d{2}$/.test(model.rawId.slice(id.length + 1))),
397 )
398 if (candidates.length > 1) fail('ambiguous native snapshot scope')
399 const fact = candidates[0]?.[1]
400 if (!fact) return model
401 return {
402 ...model,
403 contextWindow: fact.contextWindow,
404 capabilities: fact.capabilities,
405 unsupportedCapabilities: fact.unsupportedCapabilities,
406 factSources: {
407 ...model.factSources,
408 contextWindow: ownSource(doc, '上下文'),
409 capabilities: Object.fromEntries(
410 [...fact.capabilities, ...fact.unsupportedCapabilities].map(
411 (flag) => [flag, ownSource(doc, `model capability table.${flag}`)],
412 ),
413 ),
414 },
415 }
416 })
418​
419/** Own card headings define exact ids; Beijing capability tables alone win. */
420export function applyCnCardFacts(models: ModelInfo[], doc: CnDoc): ModelInfo[] {
421 const byId = new Map<
422 string,
423 Partial<Omit<ModelInfo, 'capabilities'>> & { capabilities?: string[] }
424 >()
425 const completed = new Map<string, Set<string>>()
426 let current: string | null = null
427 const starts = [...doc.text.matchAll(/^#{1,6}\s+([^\n]+)$/gm)]
428 for (let index = 0; index < starts.length; index++) {
429 const heading = cnText(starts[index]![1]!)
430 if (/^[a-z][a-z0-9._-]*-[a-z0-9._-]+$/.test(heading)) current = heading
431 if (!current) continue
432 const section = doc.text.slice(
433 starts[index]!.index + starts[index]![0].length,
434 starts[index + 1]?.index ?? doc.text.length,
435 )
436 const facts = byId.get(current) ?? {}
437 const seen = completed.get(current) ?? new Set<string>()
438 if (heading === '上下文限制') {
439 for (const table of section.matchAll(
440 /<table\b[^>]*>[\s\S]*?<\/table>/g,
441 )) {
442 for (const row of cnTable(table[0]).slice(1))
443 for (let column = 0; column + 1 < row.length; column += 2) {
444 const label = cnText(row[column]!),
445 text = cnText(row[column + 1]!)
446 if (label !== '上下文长度' && label !== '最大输出长度') continue
447 if (
448 !/^\d+$/.test(text) ||
449 !Number.isSafeInteger(Number(text)) ||
450 Number(text) <= 0
451 )
452 fail('unreadable card token limit')
453 const key = label === '上下文长度' ? 'contextWindow' : 'maxOutput'
454 if (facts[key] != null && facts[key] !== Number(text))
455 fail('conflicting card token limit')
456 facts[key] = Number(text)
457 seen.add(key)
458 }
459 }
460 }
461 if (heading === '模型能力') {
462 const modes: Record<string, string> = {
463 Text: 'text',
464 Image: 'image',
465 Audio: 'audio',
466 Video: 'video',
467 }
468 let input: string[] | null = null,
469 output: string[] | null = null
470 const flags = new Set<string>(),
471 unsupported = new Set<string>()
472 const checked = new Set<string>()
473 const panels = cnBeijingTabs(section)
474 if (!panels.length) fail('card has no Beijing capability panel')
475 for (const panel of panels)
476 for (const table of panel.body.matchAll(
477 /<table\b[^>]*>[\s\S]*?<\/table>/g,
478 )) {
479 for (const row of cnTable(table[0]).slice(1))
480 for (let column = 0; column + 1 < row.length; column += 2) {
481 const label = cnText(row[column]!),
482 value = cnText(row[column + 1]!)
483 if (label === '输入模态' || label === '输出模态') {
484 const kinds = value
485 .split(/[,,/\s]+/)
486 .map(
487 (kind) =>
488 modes[kind] ?? fail(`unknown card modality ${kind}`),
489 )
490 const old = label === '输入模态' ? input : output
491 if (old && JSON.stringify(old) !== JSON.stringify(kinds))
492 fail('conflicting card modality')
493 if (label === '输入模态') input = kinds
494 else output = kinds
495 }
496 const flag =
497 label === 'Function Calling'
498 ? 'tools'
499 : label === '结构化输出'
500 ? 'structured_outputs'
501 : null
502 if (flag) {
503 if (value !== '支持' && value !== '不支持')
504 fail('unknown card capability status')
505 if (
506 (flags.has(flag) && value === '不支持') ||
507 (unsupported.has(flag) && value === '支持')
508 )
509 fail('conflicting card capability status')
510 checked.add(flag)
511 if (value === '支持') flags.add(flag)
512 else unsupported.add(flag)
513 }
514 }
515 }
516 if (
517 !input ||
518 !output ||
519 !checked.has('tools') ||
520 !checked.has('structured_outputs')
521 )
522 fail('incomplete Beijing card capability table')
523 facts.modalities = { input, output }
524 facts.capabilities = [...flags]
525 facts.unsupportedCapabilities = [...unsupported]
526 seen.add('capabilities')
527 }
528 byId.set(current, facts)
529 completed.set(current, seen)
530 }
531 if (!byId.size) fail('own card names no model ids')
532 for (const [id, seen] of completed)
533 if (
534 !['contextWindow', 'maxOutput', 'capabilities'].every((key) =>
535 seen.has(key),
536 )
537 )
538 fail(`incomplete native card ${id}`)
539 return models.map((model) => {
540 const fact = byId.get(model.rawId)
541 if (!fact) return model
542 const capabilities = [
543 ...new Set([
544 ...(Array.isArray(model.capabilities)
545 ? (model.capabilities as string[]).filter(
546 (flag) =>
547 !Array.isArray(fact.capabilities) ||
548 (flag !== 'tools' && flag !== 'structured_outputs'),
549 )
550 : []),
551 ...(Array.isArray(fact.capabilities) ? fact.capabilities : []),
552 ]),
553 ]
554 const sources = { ...model.factSources }
555 if (fact.contextWindow != null)
556 sources.contextWindow = ownSource(doc, '上下文限制.上下文长度')
557 if (fact.maxOutput != null)
558 sources.maxOutput = ownSource(doc, '上下文限制.最大输出长度')
559 if (fact.modalities != null)
560 sources.modalities = ownSource(
561 doc,
562 '华北2(北京).模型能力.输入/输出模态',
563 )
564 if (Array.isArray(fact.capabilities))
565 sources.capabilities = {
566 ...Object.fromEntries(
567 Object.entries(model.factSources?.capabilities ?? {}).filter(
568 ([flag]) => flag !== 'tools' && flag !== 'structured_outputs',
569 ),
570 ),
571 ...Object.fromEntries(
572 [...fact.capabilities, ...(fact.unsupportedCapabilities ?? [])].map(
573 (flag) => [flag, ownSource(doc, `华北2(北京).模型能力.${flag}`)],
574 ),
575 ),
576 }
577 const unsupportedCapabilities = [
578 ...new Set([
579 ...(model.unsupportedCapabilities ?? []).filter(
580 (flag) => !['tools', 'structured_outputs'].includes(flag),
581 ),
582 ...(fact.unsupportedCapabilities ?? []),
583 ]),
584 ]
585 return {
586 ...model,
587 ...fact,
588 capabilities,
589 unsupportedCapabilities,
590 factSources: sources,
591 }
592 })
594​
595/** Native CN console links publish their exact encoded model ids. */
596export function applyCnCatalog(models: ModelInfo[], doc: CnDoc): ModelInfo[] {
597 const out = new Map(models.map((model) => [model.rawId, model]))
598 let count = 0
599 for (const anchor of doc.text.matchAll(
600 /<a\b[^>]*href="(https:\/\/bailian\.console\.aliyun\.com\/cn-beijing\/model\/market\/detail\/[^"?#]+)"[^>]*>([\s\S]*?)<\/a>/g,
601 )) {
602 const encoded = new URL(anchor[1]!).pathname.split('/detail/')[1]
603 if (!encoded) fail('empty native console id')
604 const rawId = decodeURIComponent(encoded)
605 if (!/^[a-z][a-z0-9_./-]+$/i.test(rawId))
606 fail('malformed native console id')
607 count++
608 if (out.has(rawId)) {
609 out.get(rawId)!.displayName = cnText(anchor[2]!) || null
610 continue
611 }
612 const prior = doc.text.slice(0, anchor.index)
613 const major = [...prior.matchAll(/^## (.*)$/gm)].at(-1)?.[1] ?? ''
614 const ambiguous = /图像与视频|向量与重排序/.test(major)
615 out.set(rawId, {
616 rawId,
617 displayName: cnText(anchor[2]!) || null,
618 activity: ambiguous ? null : activity(major),
619 pricing: null,
620 absent: { pricing: 'cleared' },
621 contextWindow: null,
622 maxOutput: null,
623 modalities: null,
624 capabilities: null,
625 serverTools: null,
626 reasoning: null,
627 requestMap: null,
628 schemaEndpointId: null,
629 providerMetadata: {
630 listingScope: 'public Beijing console links',
631 catalogSource: doc.url,
632 },
633 })
634 }
635 if (!count) fail('native selection docs have no Beijing console models')
636 return [...out.values()]