@goliapkg/tiktoken-wasm 4.1.2 → 5.0.1
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/LICENSE-3RD-PARTY +117 -0
- package/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +20 -0
- package/README.md +31 -24
- package/licenses/deepseek-LICENSE-MODEL.txt +91 -0
- package/licenses/meta-llama3-LICENSE.txt +84 -0
- package/licenses/meta-llama4-LICENSE.txt +70 -0
- package/licenses/minimax-m2-LICENSE.txt +28 -0
- package/licenses/mistral-ecosystem-open-weight-LICENSE.txt +18 -0
- package/licenses/moonshot-kimi-k2-LICENSE.txt +27 -0
- package/licenses/openai-tiktoken-MIT.txt +21 -0
- package/licenses/zhipu-glm-MIT.txt +21 -0
- package/package.json +7 -2
- package/tiktoken_wasm.d.ts +26 -18
- package/tiktoken_wasm.js +106 -103
- package/tiktoken_wasm_bg.wasm +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Third-Party Licenses
|
|
2
|
+
|
|
3
|
+
This crate embeds tokenizer vocabularies published by other parties. The
|
|
4
|
+
crate's own code is licensed MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE);
|
|
5
|
+
each vocabulary stays under its publisher's license, listed below. The full
|
|
6
|
+
texts are in the `licenses/` directory next to this file, and the attribution
|
|
7
|
+
notices the licenses require are collected in NOTICE.
|
|
8
|
+
|
|
9
|
+
Modification notice: every vocabulary was converted from its published format
|
|
10
|
+
(tiktoken `.tiktoken` files, Hugging Face `tokenizer.json`, Mistral
|
|
11
|
+
`tekken.json`) into this crate's compressed TKV1 format. Token bytes and ranks
|
|
12
|
+
are unchanged; for llama3, glm5 and p50k_base only the tokens beyond the
|
|
13
|
+
vocabulary they extend are stored.
|
|
14
|
+
|
|
15
|
+
Some licenses attach conditions to how the vocabulary, or the model it belongs
|
|
16
|
+
to, is used. They are quoted under each entry; read the full text before
|
|
17
|
+
relying on a vocabulary in a product.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## OpenAI tiktoken — cl100k_base, o200k_base, o200k_harmony, p50k_base, p50k_edit, r50k_base (gpt2)
|
|
21
|
+
|
|
22
|
+
- Source: https://github.com/openai/tiktoken
|
|
23
|
+
- License: MIT — licenses/openai-tiktoken-MIT.txt
|
|
24
|
+
- Copyright (c) 2022 OpenAI, Shantanu Jain
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Meta Llama 3 — llama3
|
|
28
|
+
|
|
29
|
+
- Source: https://huggingface.co/meta-llama/Meta-Llama-3-8B
|
|
30
|
+
- License: Meta Llama 3 Community License Agreement — licenses/meta-llama3-LICENSE.txt
|
|
31
|
+
- Copyright © Meta Platforms, Inc. All Rights Reserved.
|
|
32
|
+
- Built with Meta Llama 3.
|
|
33
|
+
- Conditions: the agreement must accompany any distribution and the notice in
|
|
34
|
+
NOTICE must be kept; licensees whose products had more than 700 million
|
|
35
|
+
monthly active users on the release date need a separate license from Meta
|
|
36
|
+
(section 2); use must follow the Llama 3 Acceptable Use Policy.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Meta Llama 4 — llama4 (also used by Meta's Muse models)
|
|
40
|
+
|
|
41
|
+
- Source: https://huggingface.co/meta-llama/Llama-4-Scout-17B-16E-Instruct
|
|
42
|
+
- License: Llama 4 Community License Agreement — licenses/meta-llama4-LICENSE.txt
|
|
43
|
+
- Copyright © Meta Platforms, Inc. All Rights Reserved.
|
|
44
|
+
- Built with Llama.
|
|
45
|
+
- Conditions: the agreement must accompany any distribution, "Built with Llama"
|
|
46
|
+
must be displayed, and the notice in NOTICE must be kept; licensees whose
|
|
47
|
+
products had more than 700 million monthly active users on the release date
|
|
48
|
+
need a separate license from Meta (section 2); use must follow the Llama 4
|
|
49
|
+
Acceptable Use Policy.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## DeepSeek — deepseek_v3, deepseek_v4
|
|
53
|
+
|
|
54
|
+
- Source: https://huggingface.co/deepseek-ai/DeepSeek-V3 (deepseek_v4 uses the
|
|
55
|
+
same vocabulary)
|
|
56
|
+
- License: DeepSeek License Agreement, Version 1.0 — licenses/deepseek-LICENSE-MODEL.txt
|
|
57
|
+
- Copyright (c) 2023 DeepSeek
|
|
58
|
+
- Conditions: the use-based restrictions of paragraph 5 and Attachment A apply
|
|
59
|
+
to anyone receiving this vocabulary, and must be passed on to anyone you
|
|
60
|
+
distribute it to, together with a copy of the license (paragraph 4).
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Alibaba Qwen — qwen2, qwen3_5
|
|
64
|
+
|
|
65
|
+
- Source: https://huggingface.co/Qwen/Qwen2.5-7B (qwen2),
|
|
66
|
+
https://huggingface.co/Qwen/Qwen3.5-27B (qwen3_5)
|
|
67
|
+
- License: Apache License 2.0 — LICENSE-APACHE
|
|
68
|
+
- Copyright (c) Alibaba Cloud
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Mistral AI Tekken v3 — mistral_v3
|
|
72
|
+
|
|
73
|
+
- Source: https://huggingface.co/mistralai/Mistral-Nemo-Base-2407
|
|
74
|
+
- License: Apache License 2.0 — LICENSE-APACHE
|
|
75
|
+
- Copyright (c) Mistral AI
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Mistral AI Tekken v15 — mistral_v15
|
|
79
|
+
|
|
80
|
+
- Source: https://huggingface.co/mistralai/Mistral-Large-4-1T-A52B
|
|
81
|
+
- License: Mistral Ecosystem Open-Weight License — licenses/mistral-ecosystem-open-weight-LICENSE.txt
|
|
82
|
+
- Attribution notice: 2026 - Mistral
|
|
83
|
+
- Conditions: the license text must be included in all copies; a licensee (or
|
|
84
|
+
affiliate) that operates a "Model as a Service" business must enter into a
|
|
85
|
+
separate commercial license with Mistral before using the Model or its
|
|
86
|
+
derivative works for any commercial purpose (section 2, with the exceptions
|
|
87
|
+
in section 3).
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## Moonshot AI Kimi — kimi_k2, kimi_k3
|
|
91
|
+
|
|
92
|
+
- Source: https://huggingface.co/moonshotai/Kimi-K2-Instruct (`tiktoken.model`;
|
|
93
|
+
the file in moonshotai/Kimi-K3 is byte-identical)
|
|
94
|
+
- License: Modified MIT License — licenses/moonshot-kimi-k2-LICENSE.txt
|
|
95
|
+
- Copyright (c) 2025 Moonshot AI
|
|
96
|
+
- Conditions: commercial products or services with more than 100 million
|
|
97
|
+
monthly active users or more than 20 million US dollars in monthly revenue
|
|
98
|
+
must prominently display "Kimi K2" in their user interface.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Zhipu AI GLM — glm4, glm5
|
|
102
|
+
|
|
103
|
+
- Source: https://huggingface.co/zai-org/GLM-4.5 (glm4),
|
|
104
|
+
https://huggingface.co/zai-org/GLM-5.2 (glm5)
|
|
105
|
+
- License: MIT (as declared on both model cards) — licenses/zhipu-glm-MIT.txt,
|
|
106
|
+
copied from the GLM-5.2 repository
|
|
107
|
+
- Copyright (c) Zhipu AI
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## MiniMax — minimax_m2
|
|
111
|
+
|
|
112
|
+
- Source: https://huggingface.co/MiniMaxAI/MiniMax-M2
|
|
113
|
+
- License: Modified MIT License — licenses/minimax-m2-LICENSE.txt
|
|
114
|
+
- Copyright 2025 MiniMax AI
|
|
115
|
+
- Conditions: commercial products or services with more than 100 million
|
|
116
|
+
monthly active users or more than 30 million US dollars in annual recurring
|
|
117
|
+
revenue must prominently display "MiniMax M2" in their user interface.
|
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-2026 GOLIA株式会社
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
tiktoken
|
|
2
|
+
Copyright GOLIA株式会社. Licensed MIT OR Apache-2.0.
|
|
3
|
+
|
|
4
|
+
This product embeds tokenizer vocabularies from third parties, each under its
|
|
5
|
+
publisher's license. See LICENSE-3RD-PARTY and the licenses/ directory.
|
|
6
|
+
|
|
7
|
+
Built with Llama.
|
|
8
|
+
Llama 4 is licensed under the Llama 4 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.
|
|
9
|
+
|
|
10
|
+
Built with Meta Llama 3.
|
|
11
|
+
Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.
|
|
12
|
+
|
|
13
|
+
The deepseek_v3 and deepseek_v4 vocabulary is subject to the use-based
|
|
14
|
+
restrictions in paragraph 5 and Attachment A of the DeepSeek License
|
|
15
|
+
Agreement (licenses/deepseek-LICENSE-MODEL.txt).
|
|
16
|
+
|
|
17
|
+
Mistral Ecosystem Open-Weight License attribution notice: 2026 - Mistral
|
|
18
|
+
|
|
19
|
+
The vocabularies were converted from their published formats into this
|
|
20
|
+
crate's TKV1 format; token bytes and ranks are unchanged.
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ wasm-pack build --target web --release
|
|
|
23
23
|
|
|
24
24
|
Output is in `pkg/` — a complete npm-ready package containing:
|
|
25
25
|
- `tiktoken_wasm.js` — ES module with WASM loader
|
|
26
|
-
- `tiktoken_wasm_bg.wasm` — compiled WASM binary (
|
|
26
|
+
- `tiktoken_wasm_bg.wasm` — compiled WASM binary (8.96 MB, 8.22 MB gzipped, all 20 vocabularies)
|
|
27
27
|
|
|
28
28
|
Building it yourself, `--no-default-features --features vocab-o200k_base` (or
|
|
29
29
|
any other `vocab-*` / vendor group forwarded from `tiktoken`) drops that to
|
|
@@ -53,7 +53,7 @@ await init()
|
|
|
53
53
|
|
|
54
54
|
// discover available encodings
|
|
55
55
|
const names: string[] = listEncodings()
|
|
56
|
-
// ["cl100k_base", "o200k_base", ..., "
|
|
56
|
+
// ["cl100k_base", "o200k_base", ..., "minimax_m2"]
|
|
57
57
|
|
|
58
58
|
// encode / decode
|
|
59
59
|
const enc: Encoding = getEncoding('cl100k_base')
|
|
@@ -70,7 +70,7 @@ console.log(enc.numSpecialTokens) // 5
|
|
|
70
70
|
|
|
71
71
|
// by model name — supports OpenAI, Meta, DeepSeek, Qwen, Mistral
|
|
72
72
|
const enc2 = encodingForModel('gpt-4o')
|
|
73
|
-
const encName = modelToEncoding('llama-4-scout') // "
|
|
73
|
+
const encName = modelToEncoding('llama-4-scout') // "llama4"
|
|
74
74
|
|
|
75
75
|
// cost estimation (USD)
|
|
76
76
|
const cost: number = estimateCost('gpt-4o', 1000, 500)
|
|
@@ -132,22 +132,25 @@ List all available encoding names (17 encodings).
|
|
|
132
132
|
|
|
133
133
|
Get a tokenizer by encoding name. Supported:
|
|
134
134
|
- `cl100k_base` — GPT-4, GPT-3.5-turbo
|
|
135
|
-
- `o200k_base` — GPT-4o, GPT-4.1, GPT-5–5.6, o1, o3, o4-mini
|
|
135
|
+
- `o200k_base` — GPT-4o, GPT-4.1, GPT-5–5.6, GPT-6 (unconfirmed), o1, o3, o4-mini
|
|
136
136
|
- `o200k_harmony` — gpt-oss (harmony chat format)
|
|
137
137
|
- `p50k_base` — text-davinci-002/003
|
|
138
138
|
- `p50k_edit` — text-davinci-edit
|
|
139
139
|
- `r50k_base` — GPT-3 (davinci, curie, etc.)
|
|
140
140
|
- `gpt2` — GPT-2 (alias for `r50k_base`)
|
|
141
|
-
- `llama3` — Meta Llama 3
|
|
141
|
+
- `llama3` — Meta Llama 3.x
|
|
142
|
+
- `llama4` — Meta Llama 4, Muse
|
|
142
143
|
- `deepseek_v3` — DeepSeek V3/R1
|
|
143
144
|
- `qwen2` — Qwen 2/2.5/3
|
|
145
|
+
- `qwen3_5` — Qwen 3.5–3.8, Qwen 4 (unconfirmed)
|
|
144
146
|
- `mistral_v3` — Mistral/Codestral/Pixtral (Tekken)
|
|
145
|
-
- `
|
|
147
|
+
- `mistral_v15` — Mistral Large 4 (Tekken v15)
|
|
148
|
+
- `deepseek_v4` — DeepSeek V4 Pro/Flash, V4.1 Flash
|
|
146
149
|
- `kimi_k2` — Kimi K2/K2.5/K2.6
|
|
147
|
-
- `kimi_k3` — Kimi K3
|
|
150
|
+
- `kimi_k3` — Kimi K3/K3.1
|
|
148
151
|
- `glm4` — GLM-4.5/4.6/4.7
|
|
149
|
-
- `glm5` — GLM-5/5.2
|
|
150
|
-
- `minimax_m2` — MiniMax M2
|
|
152
|
+
- `glm5` — GLM-5/5.1/5.2/5.3
|
|
153
|
+
- `minimax_m2` — MiniMax M2 and M3 families
|
|
151
154
|
|
|
152
155
|
### `encodingForModel(model: string): Encoding`
|
|
153
156
|
|
|
@@ -173,7 +176,7 @@ Map a model name to its encoding name without loading the encoding.
|
|
|
173
176
|
|
|
174
177
|
### `estimateCost(modelId, inputTokens, outputTokens): number`
|
|
175
178
|
|
|
176
|
-
Estimate API cost in USD. Supports
|
|
179
|
+
Estimate API cost in USD. Supports 153 models across 11 providers.
|
|
177
180
|
|
|
178
181
|
### `getModelInfo(modelId): ModelInfo`
|
|
179
182
|
|
|
@@ -185,7 +188,7 @@ model. The returned `id` is this table's own spelling.
|
|
|
185
188
|
|
|
186
189
|
### `allModels(): ModelInfo[]`
|
|
187
190
|
|
|
188
|
-
List all
|
|
191
|
+
List all 153 supported models with pricing info.
|
|
189
192
|
|
|
190
193
|
### `modelsByProvider(provider): ModelInfo[]`
|
|
191
194
|
|
|
@@ -205,21 +208,21 @@ Filter models by provider: `"OpenAI"`, `"Anthropic"`, `"Google"`, `"Meta"`, `"De
|
|
|
205
208
|
|
|
206
209
|
## Supported Models (pricing)
|
|
207
210
|
|
|
208
|
-
`estimateCost` / `getModelInfo` / `allModels` cover **
|
|
209
|
-
providers** (2026-
|
|
211
|
+
`estimateCost` / `getModelInfo` / `allModels` cover **153 models across 11
|
|
212
|
+
providers** (2026-11 pricing). Per provider, newest first:
|
|
210
213
|
|
|
211
214
|
| Provider | Models | Latest entries |
|
|
212
215
|
|----------|-------:|----------------|
|
|
213
|
-
| OpenAI |
|
|
214
|
-
| Anthropic |
|
|
215
|
-
| Google |
|
|
216
|
-
| Mistral |
|
|
217
|
-
| Alibaba |
|
|
218
|
-
| Meta |
|
|
219
|
-
| Zhipu |
|
|
220
|
-
| DeepSeek |
|
|
221
|
-
| MiniMax |
|
|
222
|
-
| Moonshot |
|
|
216
|
+
| OpenAI | 41 | gpt-6.2-astra/sol, gpt-6.1-sol/terra, gpt-6-astra/sol/luna, gpt-5.6-sol/terra/luna, gpt-5.5(-pro), gpt-5.4(-mini/nano/pro), gpt-5.2(-pro), gpt-5.1, gpt-5(-mini/nano/pro), gpt-4.1, gpt-4o, o1/o3/o4-mini, … |
|
|
217
|
+
| Anthropic | 24 | claude-fable-5.2/5.1/5, claude-mythos-5.2/5.1/5, claude-opus-5.5/5, claude-sonnet-5.5/5, claude-haiku-5.5, claude-opus-4.8/4.7/4.6, claude-haiku-4.5, … |
|
|
218
|
+
| Google | 19 | gemini-4-neon/hydrogen/carbon/argon, gemini-3.8-flash, gemini-3.1-pro-preview, gemini-3.6/3.5-flash, gemini-embedding-2, gemini-2.5-pro/flash, … |
|
|
219
|
+
| Mistral | 15 | mistral-large-4, mistral-large/medium/small, codestral, devstral, ministral, mistral-embed, codestral-embed, pixtral-large, … |
|
|
220
|
+
| Alibaba | 13 | qwen4-max, qwen3.8-max/flash/27b/2.4t-a95b, qwen3.5-plus, qwen3-max/plus/coder, qwen2.5-72b, … |
|
|
221
|
+
| Meta | 8 | muse-spark-open, muse-glimmer-30b, llama-4-scout/maverick, llama-3.3-70b, llama-3.1-405b/70b/8b |
|
|
222
|
+
| Zhipu | 8 | glm-5.3(-flashx/-flash), glm-5.2, glm-5, glm-4.7, glm-4.5(-air) |
|
|
223
|
+
| DeepSeek | 5 | deepseek-flash, deepseek-v4-pro, deepseek-v4-flash, deepseek-v3, deepseek-r1 |
|
|
224
|
+
| MiniMax | 6 | minimax-m3, minimax-m3.1-flash, minimax-m2.7/m2.5/m2.1/m2 |
|
|
225
|
+
| Moonshot | 6 | kimi-k3.1-pro(-highspeed), kimi-k3, kimi-k2.7-code, kimi-k2.6, kimi-k2.5 |
|
|
223
226
|
| Voyage | 8 | voyage-4-large/4/4-lite/code-4, voyage-3-large, voyage-3.5(-lite), voyage-code-3 (embeddings) |
|
|
224
227
|
|
|
225
228
|
The authoritative list is the code: call `allModels()` at runtime, or see
|
|
@@ -251,4 +254,8 @@ See [`examples/react-app`](../tiktoken/examples/react-app/) for a complete Vite
|
|
|
251
254
|
|
|
252
255
|
## License
|
|
253
256
|
|
|
254
|
-
|
|
257
|
+
The code is licensed under either of [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.
|
|
258
|
+
|
|
259
|
+
The embedded vocabularies are not covered by that: each stays under its publisher's license. [LICENSE-3RD-PARTY](LICENSE-3RD-PARTY) lists every vocabulary with its source and license, [`licenses/`](licenses/) holds the full texts, and [NOTICE](NOTICE) the attributions they require. Some of those licenses set conditions on use: the Llama licenses (products above 700 million monthly active users need a license from Meta), Mistral's license for `mistral_v15` (Model-as-a-Service businesses need a commercial license), display clauses for Kimi and MiniMax above a size threshold, and use-based restrictions for DeepSeek. A build without a vocabulary's `vocab-*` feature does not contain that vocabulary.
|
|
260
|
+
|
|
261
|
+
Built with Llama.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
DEEPSEEK LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
Version 1.0, 23 October 2023
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023 DeepSeek
|
|
6
|
+
|
|
7
|
+
Section I: PREAMBLE
|
|
8
|
+
|
|
9
|
+
Large generative models are being widely adopted and used, and have the potential to transform the way individuals conceive and benefit from AI or ML technologies.
|
|
10
|
+
|
|
11
|
+
Notwithstanding the current and potential benefits that these artifacts can bring to society at large, there are also concerns about potential misuses of them, either due to their technical limitations or ethical considerations.
|
|
12
|
+
|
|
13
|
+
In short, this license strives for both the open and responsible downstream use of the accompanying model. When it comes to the open character, we took inspiration from open source permissive licenses regarding the grant of IP rights. Referring to the downstream responsible use, we added use-based restrictions not permitting the use of the model in very specific scenarios, in order for the licensor to be able to enforce the license in case potential misuses of the Model may occur. At the same time, we strive to promote open and responsible research on generative models for content generation.
|
|
14
|
+
|
|
15
|
+
Even though downstream derivative versions of the model could be released under different licensing terms, the latter will always have to include - at minimum - the same use-based restrictions as the ones in the original license (this license). We believe in the intersection between open and responsible AI development; thus, this agreement aims to strike a balance between both in order to enable responsible open-science in the field of AI.
|
|
16
|
+
|
|
17
|
+
This License governs the use of the model (and its derivatives) and is informed by the model card associated with the model.
|
|
18
|
+
|
|
19
|
+
NOW THEREFORE, You and DeepSeek agree as follows:
|
|
20
|
+
|
|
21
|
+
1. Definitions
|
|
22
|
+
"License" means the terms and conditions for use, reproduction, and Distribution as defined in this document.
|
|
23
|
+
"Data" means a collection of information and/or content extracted from the dataset used with the Model, including to train, pretrain, or otherwise evaluate the Model. The Data is not licensed under this License.
|
|
24
|
+
"Output" means the results of operating a Model as embodied in informational content resulting therefrom.
|
|
25
|
+
"Model" means any accompanying machine-learning based assemblies (including checkpoints), consisting of learnt weights, parameters (including optimizer states), corresponding to the model architecture as embodied in the Complementary Material, that have been trained or tuned, in whole or in part on the Data, using the Complementary Material.
|
|
26
|
+
"Derivatives of the Model" means all modifications to the Model, works based on the Model, or any other model which is created or initialized by transfer of patterns of the weights, parameters, activations or output of the Model, to the other model, in order to cause the other model to perform similarly to the Model, including - but not limited to - distillation methods entailing the use of intermediate data representations or methods based on the generation of synthetic data by the Model for training the other model.
|
|
27
|
+
"Complementary Material" means the accompanying source code and scripts used to define, run, load, benchmark or evaluate the Model, and used to prepare data for training or evaluation, if any. This includes any accompanying documentation, tutorials, examples, etc, if any.
|
|
28
|
+
"Distribution" means any transmission, reproduction, publication or other sharing of the Model or Derivatives of the Model to a third party, including providing the Model as a hosted service made available by electronic or other remote means - e.g. API-based or web access.
|
|
29
|
+
"DeepSeek" (or "we") means Beijing DeepSeek Artificial Intelligence Fundamental Technology Research Co., Ltd., Hangzhou DeepSeek Artificial Intelligence Fundamental Technology Research Co., Ltd. and/or any of their affiliates.
|
|
30
|
+
"You" (or "Your") means an individual or Legal Entity exercising permissions granted by this License and/or making use of the Model for whichever purpose and in any field of use, including usage of the Model in an end-use application - e.g. chatbot, translator, etc.
|
|
31
|
+
"Third Parties" means individuals or legal entities that are not under common control with DeepSeek or You.
|
|
32
|
+
|
|
33
|
+
Section II: INTELLECTUAL PROPERTY RIGHTS
|
|
34
|
+
|
|
35
|
+
Both copyright and patent grants apply to the Model, Derivatives of the Model and Complementary Material. The Model and Derivatives of the Model are subject to additional terms as described in Section III.
|
|
36
|
+
|
|
37
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, DeepSeek hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare, publicly display, publicly perform, sublicense, and distribute the Complementary Material, the Model, and Derivatives of the Model.
|
|
38
|
+
|
|
39
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License and where and as applicable, DeepSeek hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this paragraph) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Model and the Complementary Material, where such license applies only to those patent claims licensable by DeepSeek that are necessarily infringed by its contribution(s). If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Model and/or Complementary Material constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for the Model and/or works shall terminate as of the date such litigation is asserted or filed.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Section III: CONDITIONS OF USAGE, DISTRIBUTION AND REDISTRIBUTION
|
|
43
|
+
|
|
44
|
+
4. Distribution and Redistribution. You may host for Third Party remote access purposes (e.g. software-as-a-service), reproduce and distribute copies of the Model or Derivatives of the Model thereof in any medium, with or without modifications, provided that You meet the following conditions:
|
|
45
|
+
a. Use-based restrictions as referenced in paragraph 5 MUST be included as an enforceable provision by You in any type of legal agreement (e.g. a license) governing the use and/or distribution of the Model or Derivatives of the Model, and You shall give notice to subsequent users You Distribute to, that the Model or Derivatives of the Model are subject to paragraph 5. This provision does not apply to the use of Complementary Material.
|
|
46
|
+
b. You must give any Third Party recipients of the Model or Derivatives of the Model a copy of this License;
|
|
47
|
+
c. You must cause any modified files to carry prominent notices stating that You changed the files;
|
|
48
|
+
d. You must retain all copyright, patent, trademark, and attribution notices excluding those notices that do not pertain to any part of the Model, Derivatives of the Model.
|
|
49
|
+
e. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions - respecting paragraph 4.a. – for use, reproduction, or Distribution of Your modifications, or for any such Derivatives of the Model as a whole, provided Your use, reproduction, and Distribution of the Model otherwise complies with the conditions stated in this License.
|
|
50
|
+
|
|
51
|
+
5. Use-based restrictions. The restrictions set forth in Attachment A are considered Use-based restrictions. Therefore You cannot use the Model and the Derivatives of the Model for the specified restricted uses. You may use the Model subject to this License, including only for lawful purposes and in accordance with the License. Use may include creating any content with, finetuning, updating, running, training, evaluating and/or reparametrizing the Model. You shall require all of Your users who use the Model or a Derivative of the Model to comply with the terms of this paragraph (paragraph 5).
|
|
52
|
+
|
|
53
|
+
6. The Output You Generate. Except as set forth herein, DeepSeek claims no rights in the Output You generate using the Model. You are accountable for the Output you generate and its subsequent uses. No use of the output can contravene any provision as stated in the License.
|
|
54
|
+
|
|
55
|
+
Section IV: OTHER PROVISIONS
|
|
56
|
+
|
|
57
|
+
7. Updates and Runtime Restrictions. To the maximum extent permitted by law, DeepSeek reserves the right to restrict (remotely or otherwise) usage of the Model in violation of this License.
|
|
58
|
+
|
|
59
|
+
8. Trademarks and related. Nothing in this License permits You to make use of DeepSeek’ trademarks, trade names, logos or to otherwise suggest endorsement or misrepresent the relationship between the parties; and any rights not expressly granted herein are reserved by DeepSeek.
|
|
60
|
+
|
|
61
|
+
9. Personal information, IP rights and related. This Model may contain personal information and works with IP rights. You commit to complying with applicable laws and regulations in the handling of personal information and the use of such works. Please note that DeepSeek's license granted to you to use the Model does not imply that you have obtained a legitimate basis for processing the related information or works. As an independent personal information processor and IP rights user, you need to ensure full compliance with relevant legal and regulatory requirements when handling personal information and works with IP rights that may be contained in the Model, and are willing to assume solely any risks and consequences that may arise from that.
|
|
62
|
+
|
|
63
|
+
10. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, DeepSeek provides the Model and the Complementary Material on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Model, Derivatives of the Model, and the Complementary Material and assume any risks associated with Your exercise of permissions under this License.
|
|
64
|
+
|
|
65
|
+
11. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall DeepSeek be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Model and the Complementary Material (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if DeepSeek has been advised of the possibility of such damages.
|
|
66
|
+
|
|
67
|
+
12. Accepting Warranty or Additional Liability. While redistributing the Model, Derivatives of the Model and the Complementary Material thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of DeepSeek, and only if You agree to indemnify, defend, and hold DeepSeek harmless for any liability incurred by, or claims asserted against, DeepSeek by reason of your accepting any such warranty or additional liability.
|
|
68
|
+
|
|
69
|
+
13. If any provision of this License is held to be invalid, illegal or unenforceable, the remaining provisions shall be unaffected thereby and remain valid as if such provision had not been set forth herein.
|
|
70
|
+
|
|
71
|
+
14. Governing Law and Jurisdiction. This agreement will be governed and construed under PRC laws without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this agreement. The courts located in the domicile of Hangzhou DeepSeek Artificial Intelligence Fundamental Technology Research Co., Ltd. shall have exclusive jurisdiction of any dispute arising out of this agreement.
|
|
72
|
+
|
|
73
|
+
END OF TERMS AND CONDITIONS
|
|
74
|
+
|
|
75
|
+
Attachment A
|
|
76
|
+
|
|
77
|
+
Use Restrictions
|
|
78
|
+
|
|
79
|
+
You agree not to use the Model or Derivatives of the Model:
|
|
80
|
+
|
|
81
|
+
- In any way that violates any applicable national or international law or regulation or infringes upon the lawful rights and interests of any third party;
|
|
82
|
+
- For military use in any way;
|
|
83
|
+
- For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
|
|
84
|
+
- To generate or disseminate verifiably false information and/or content with the purpose of harming others;
|
|
85
|
+
- To generate or disseminate inappropriate content subject to applicable regulatory requirements;
|
|
86
|
+
- To generate or disseminate personal identifiable information without due authorization or for unreasonable use;
|
|
87
|
+
- To defame, disparage or otherwise harass others;
|
|
88
|
+
- For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation;
|
|
89
|
+
- For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics;
|
|
90
|
+
- To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
|
|
91
|
+
- For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories.
|