Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2
3import {
4 dashscopeModelPageUrl,
5 loadDashscopeModelLimits,
6 parseDashscopeModelLimits,
7} from './dashscope-model-limits.ts'
8
9/** Context limits from qwen3-omni-flash.md, checked 2026-10-08. */
10const OMNI_FIXTURE = `# qwen3-omni-flash
11
12## Context Limits <span id="h-4b8ebeae72" />
13
14<table><thead><tr><th>Parameter</th><th>Value</th><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td><p>Max Input Length</p></td><td><p>49152</p></td><td><p>Max Output Length</p></td><td><p>16384</p></td></tr><tr><td><p>Context Window</p></td><td><p>65536</p></td><td><p>Max Input Length (Thinking Mode)</p></td><td><p>16384</p></td></tr><tr><td><p>Max Output Length (Thinking Mode)</p></td><td><p>16384</p></td><td><p>Max Chain-of-Thought Length</p></td><td><p>32768</p></td></tr></tbody></table>
15
16## Pricing <span id="h-d72e94e06d" />
17
18### qwen3-omni-flash-2025-09-15 <span id="h-0c5c74dc20" />
19
20#### Model Capabilities <span id="h-eca28b5fa5" />
21
22<table><thead><tr><th>Capability</th><th>Support</th></tr></thead><tbody><tr><td><p>Function Calling</p></td><td><p>Supported</p></td></tr></tbody></table>
23
24#### Context Limits <span id="h-8a43bf5ab2" />
25
26<table><thead><tr><th>Parameter</th><th>Value</th><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td><p>Max Input Length</p></td><td><p>49152</p></td><td><p>Max Output Length</p></td><td><p>16384</p></td></tr><tr><td><p>Context Window</p></td><td><p>65536</p></td><td><p>Max Input Length (Thinking Mode)</p></td><td><p>16384</p></td></tr></tbody></table>
27`
28
29/** Context limits from qwen3-8-omni-flash-realtime.md, checked 2026-10-08. */
30const REALTIME_FIXTURE = `# qwen3.8-omni-flash-realtime
31
32## Model capabilities
33
34| Capability | Support | Capability | Support |
35| --- | --- | --- | --- |
36| Input modalities | Text, streaming audio, and video | Output modalities | Text and audio |
37
38## Context limits
39
40| Parameter | Value | Parameter | Value |
41| -------------------------- | --------------------------------------- | --------------------- | ---------------------------------------- |
42| Maximum total input tokens | 196608 | Audio history | Up to 100 turns and 600 seconds in total |
43| Video history | Up to 50 turns and 240 seconds in total | Maximum output tokens | 65536 |
44
45## Model pricing
46`
47
48/** Context limits from decision-model-preview.md, checked 2026-10-08. */
49const DECISION_FIXTURE = `# decision-model-preview
50
51## Context Limits <span id="h-dm-ctx" />
52
53<table><thead><tr><th>Parameter</th><th>Value</th><th>Parameter</th><th>Value</th></tr></thead><tbody><tr><td><p>Max Input Length</p></td><td><p>65,536</p></td><td><p>Max Output Length</p></td><td><p>0</p></td></tr><tr><td><p>Context Window</p></td><td><p>65,536</p></td><td /><td /></tr></tbody></table>
54`
55
56describe('dashscope model limits', () => {
57 it('reads context and non-thinking max output, including snapshot sections', () => {
58 const models = parseDashscopeModelLimits(OMNI_FIXTURE)
59 expect(models['qwen3-omni-flash']).toEqual({
60 contextWindow: 65536,
61 maxOutput: 16384,
62 })
63 expect(models['qwen3-omni-flash-2025-09-15']).toEqual({
64 contextWindow: 65536,
65 maxOutput: 16384,
66 })
67 })
68
69 it('does not treat maximum input as the context window', () => {
70 expect(parseDashscopeModelLimits(REALTIME_FIXTURE)).toEqual({
71 'qwen3.8-omni-flash-realtime': {
72 contextWindow: null,
73 maxOutput: 65536,
74 },
75 })
76 })
77
78 it('keeps a published max output of zero', () => {
79 expect(parseDashscopeModelLimits(DECISION_FIXTURE)).toEqual({
80 'decision-model-preview': { contextWindow: 65536, maxOutput: 0 },
81 })
82 })
83
84 it('throws when the page has no context-limit row', () => {
85 expect(() => parseDashscopeModelLimits('# qwen-plus\n\nno table')).toThrow(
86 /parsed 0 context-limit rows/,
87 )
88 })
89
90 it('rejects an HTML shell', async () => {
91 await expect(
92 loadDashscopeModelLimits(
93 '<!DOCTYPE html><html><head>\n<title>Access denied</title></head></html>',
94 ),
95 ).rejects.toThrow(
96 /not markdown \(title: Access denied\): <!DOCTYPE html><html><head> <title>/,
97 )
98 })
99
100 it('points a dated snapshot at the stable model page', () => {
101 expect(dashscopeModelPageUrl('qwen3-omni-flash-2025-09-15')).toBe(
102 'https://www.alibabacloud.com/help/en/model-studio/qwen3-omni-flash.md',
103 )
104 expect(dashscopeModelPageUrl('qwen3.8-omni-flash-realtime')).toBe(
105 'https://www.alibabacloud.com/help/en/model-studio/qwen3-8-omni-flash-realtime.md',
106 )
107 })
108})