token-speed-tester 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > A CLI tool to measure and analyze LLM API token streaming performance
4
4
 
5
- [中文文档](README.md) |
5
+ [Chinese README](README.md)
6
6
 
7
7
  [![npm version](https://badge.fury.io/js/token-speed-tester.svg)](https://www.npmjs.com/package/token-speed-tester)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -51,7 +51,8 @@ npm install token-speed-tester
51
51
  ```bash
52
52
  # Test Anthropic API (default)
53
53
  token-speed-test --api-key sk-ant-xxx
54
-
54
+ # English output
55
+ token-speed-test --api-key sk-ant-xxx --lang en
55
56
  # Test OpenAI API
56
57
  token-speed-test --api-key sk-xxx --provider openai
57
58
  ```
@@ -102,8 +103,11 @@ node dist/index.js --api-key sk-ant-xxx
102
103
  | `--model` | `-m` | Model name | Auto-selected by provider |
103
104
  | `--url` | `-u` | Custom API endpoint | Official endpoint |
104
105
  | `--runs` | `-r` | Number of test runs | `3` |
105
- | `--prompt` | | Test prompt | "写一篇关于 AI 的短文" |
106
+ | `--prompt` | | Test prompt | Language-specific |
106
107
  | `--max-tokens` | | Maximum output tokens | `1024` |
108
+ | `--lang` | | Output language: `zh` or `en` | `zh` |
109
+
110
+ Note: The default prompt follows the selected language. Use `--lang en` for the English default prompt.
107
111
 
108
112
  ### Default Models
109
113
 
@@ -113,89 +117,57 @@ node dist/index.js --api-key sk-ant-xxx
113
117
  ## Output Example
114
118
 
115
119
  ```
116
- 🚀 Token 速度测试工具
117
- ──────────────────────────────────────────
120
+ Token Speed Test
121
+ --------------------------------------------------
118
122
  Provider: anthropic
119
123
  Model: claude-opus-4-5-20251101
120
124
  Max Tokens: 1024
121
125
  Runs: 3
122
- Prompt: 写一篇关于 AI 的短文
123
- ──────────────────────────────────────────
124
-
125
- 正在运行测试...
126
-
127
- 模型输出 (流式):
128
-
129
- [运行 1]
126
+ Prompt: Write a short essay about AI
127
+ --------------------------------------------------
128
+ Running tests...
129
+ Model output (streaming):
130
+ [Run 1]
130
131
  TTFT: 523ms
131
- 总耗时: 3245ms
132
- Token 数: 412
133
- 平均速度: 126.96 tokens/s
134
- 峰值速度: 156.32 tokens/s
135
- 峰值 TPS: 168.00 tokens/s
136
-
137
- [运行 2]
132
+ Total Time: 3245ms
133
+ Total Tokens: 412
134
+ Avg Speed: 126.96 tokens/s
135
+ Peak Speed: 156.32 tokens/s
136
+ Peak TPS: 168.00 tokens/s
137
+ [Run 2]
138
138
  TTFT: 487ms
139
- 总耗时: 3189ms
140
- Token 数: 398
141
- 平均速度: 124.84 tokens/s
142
- 峰值速度: 158.41 tokens/s
143
- 峰值 TPS: 171.00 tokens/s
144
-
145
- [运行 3]
139
+ Total Time: 3189ms
140
+ Total Tokens: 398
141
+ Avg Speed: 124.84 tokens/s
142
+ Peak Speed: 158.41 tokens/s
143
+ Peak TPS: 171.00 tokens/s
144
+ [Run 3]
146
145
  TTFT: 501ms
147
- 总耗时: 3312ms
148
- Token 数: 405
149
- 平均速度: 122.28 tokens/s
150
- 峰值速度: 154.23 tokens/s
151
- 峰值 TPS: 166.00 tokens/s
152
-
146
+ Total Time: 3312ms
147
+ Total Tokens: 405
148
+ Avg Speed: 122.28 tokens/s
149
+ Peak Speed: 154.23 tokens/s
150
+ Peak TPS: 166.00 tokens/s
153
151
  ======================================================================
154
- Token 速度测试报告
152
+ Token Speed Test Report
155
153
  ======================================================================
154
+ Summary (N=3)
155
+ +-----------------+--------+-------+-------+---------+
156
+ | Metric | Mean | Min | Max | Std Dev |
157
+ +-----------------+--------+-------+-------+---------+
158
+ | TTFT (ms) | 503.67 | 487.00| 523.00| 14.57 |
159
+ | Total Time (ms) | 3248.67| 3189.00|3312.00|51.92 |
160
+ | Total Tokens | 405.00 | 398.00| 412.00| 5.35 |
161
+ | Avg Speed | 124.69 | 122.28| 126.96| 1.88 |
162
+ | Peak Speed | 156.32 | 154.23| 158.41| 1.82 |
163
+ | Peak TPS | 168.33 | 166.00| 171.00| 2.05 |
164
+ +-----------------+--------+-------+-------+---------+
165
+ Token Speed Trend (TPS)
166
+ [chart omitted]
167
+ TPS Distribution
168
+ [histogram omitted]
169
+ Tests complete!
156
170
 
157
- 统计汇总 (N=3)
158
- ┌──────────────────────────────────────────────────────────────────────┐
159
- │ 指标 │ 均值 │ 最小值 │ 最大值 │ 标准差 │
160
- ├──────────────────────────────────────────────────────────────────────┤
161
- │ TTFT (ms) │ 503.67 │ 487.00 │ 523.00 │ 14.57 │
162
- ├──────────────────────────────────────────────────────────────────────┤
163
- │ 总耗时 (ms) │ 3248.67 │ 3189.00 │ 3312.00 │ 51.92 │
164
- ├──────────────────────────────────────────────────────────────────────┤
165
- │ 总 Token 数 │ 405.00 │ 398.00 │ 412.00 │ 5.35 │
166
- ├──────────────────────────────────────────────────────────────────────┤
167
- │ 平均速度 │ 124.69 │ 122.28 │ 126.96 │ 1.88 │
168
- ├──────────────────────────────────────────────────────────────────────┤
169
- │ 峰值速度 │ 156.32 │ 154.23 │ 158.41 │ 1.82 │
170
- ├──────────────────────────────────────────────────────────────────────┤
171
- │ 峰值 TPS │ 168.33 │ 166.00 │ 171.00 │ 2.05 │
172
- └──────────────────────────────────────────────────────────────────────┘
173
-
174
- Token 速度趋势图 (TPS)
175
- ┌────────────────────────────────────────┐
176
- │ 120 ┤ █ │
177
- │ 100 ┤ █ █ █ █ │
178
- │ 80 ┤ █ █ █ █ █ █ █ │
179
- │ 60 ┤ █ █ █ █ █ █ █ █ █ █ │
180
- │ 40 ┤ █ █ █ █ █ █ █ █ █ █ █ █ │
181
- │ 20 ┤ █ █ █ █ █ █ █ █ █ █ █ █ █ █ │
182
- │ 0 └────────────────────────────────── │
183
- │ 0s 1s 2s 3s 4s 5s 6s │
184
- └────────────────────────────────────────┘
185
-
186
- TPS 分布
187
- 0.0-12.0 │██████████████████████████████████████████████████ 45
188
- 12.0-24.0 │██ 3
189
- 24.0-36.0 │ 0
190
- 36.0-48.0 │ 0
191
- 48.0-60.0 │ 0
192
- 60.0-72.0 │ 0
193
- 72.0-84.0 │ 0
194
- 84.0-96.0 │ 0
195
- 96.0-108.0 │ 0
196
- 108.0-120.0 │ 0
197
-
198
- ✅ 测试完成!
199
171
  ```
200
172
 
201
173
  ## Metrics Explained
@@ -205,7 +177,7 @@ TPS 分布
205
177
  | **TTFT** | Time to First Token - latency from request to first token arrival |
206
178
  | **Total Time** | Complete duration from request to stream completion |
207
179
  | **Total Tokens** | Number of output tokens received |
208
- | **Average Speed** | Mean tokens per second (totalTokens / totalTime × 1000) |
180
+ | **Average Speed** | Mean tokens per second (totalTokens / totalTime x 1000) |
209
181
  | **Peak Speed** | Fastest speed measured over a sliding 10-token window |
210
182
  | **Peak TPS** | Highest tokens received within a single second |
211
183
  | **TPS Curve** | Tokens received per second throughout the streaming response |
@@ -270,7 +242,7 @@ This project maintains high code coverage:
270
242
 
271
243
  ## License
272
244
 
273
- MIT © [Cansiny0320](https://github.com/Cansiny0320)
245
+ MIT (c) [Cansiny0320](https://github.com/Cansiny0320)
274
246
 
275
247
  ## Contributing
276
248
 
package/README.md CHANGED
@@ -51,6 +51,8 @@ npm install token-speed-tester
51
51
  ```bash
52
52
  # 测试 Anthropic API(默认)
53
53
  token-speed-test --api-key sk-ant-xxx
54
+ # 输出英文结果
55
+ token-speed-test --api-key sk-ant-xxx --lang en
54
56
 
55
57
  # 测试 OpenAI API
56
58
  token-speed-test --api-key sk-xxx --provider openai
@@ -104,6 +106,7 @@ node dist/index.js --api-key sk-ant-xxx
104
106
  | `--runs` | `-r` | 测试次数 | `3` |
105
107
  | `--prompt` | | 测试提示词 | "写一篇关于 AI 的短文" |
106
108
  | `--max-tokens` | | 最大输出 Token 数 | `1024` |
109
+ | `--lang` | | 输出语言: `zh` 或 `en` | `zh` |
107
110
 
108
111
  ### 默认模型
109
112