canitoolcall 0.1.0__tar.gz

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.
Files changed (184) hide show
  1. canitoolcall-0.1.0/.gitignore +29 -0
  2. canitoolcall-0.1.0/CHANGELOG.md +17 -0
  3. canitoolcall-0.1.0/CODE_OF_CONDUCT.md +83 -0
  4. canitoolcall-0.1.0/CONTRIBUTING.md +144 -0
  5. canitoolcall-0.1.0/LICENSE +202 -0
  6. canitoolcall-0.1.0/LICENSES/deepseek-MIT.txt +21 -0
  7. canitoolcall-0.1.0/LICENSES/glm-5.3.txt +29 -0
  8. canitoolcall-0.1.0/LICENSES/kimi-k2-modified-MIT.txt +27 -0
  9. canitoolcall-0.1.0/LICENSES/kimi-k2.6-modified-MIT.txt +27 -0
  10. canitoolcall-0.1.0/LICENSES/kimi-k3.txt +52 -0
  11. canitoolcall-0.1.0/LICENSES/llama.cpp-MIT.txt +21 -0
  12. canitoolcall-0.1.0/LICENSES/llama3.3-community.txt +49 -0
  13. canitoolcall-0.1.0/LICENSES/llama4-community.txt +70 -0
  14. canitoolcall-0.1.0/LICENSES/ollama-MIT.txt +21 -0
  15. canitoolcall-0.1.0/PKG-INFO +236 -0
  16. canitoolcall-0.1.0/README.md +191 -0
  17. canitoolcall-0.1.0/SECURITY.md +23 -0
  18. canitoolcall-0.1.0/THIRD_PARTY_NOTICES.md +52 -0
  19. canitoolcall-0.1.0/docs/DESIGN.md +134 -0
  20. canitoolcall-0.1.0/docs/PUBLISHING.md +63 -0
  21. canitoolcall-0.1.0/docs/formats/README.md +73 -0
  22. canitoolcall-0.1.0/docs/formats/deepseek.md +247 -0
  23. canitoolcall-0.1.0/docs/formats/gemma4.md +149 -0
  24. canitoolcall-0.1.0/docs/formats/glm.md +163 -0
  25. canitoolcall-0.1.0/docs/formats/gpt-oss.md +130 -0
  26. canitoolcall-0.1.0/docs/formats/kimi.md +162 -0
  27. canitoolcall-0.1.0/docs/formats/llama.md +175 -0
  28. canitoolcall-0.1.0/docs/formats/mistral.md +150 -0
  29. canitoolcall-0.1.0/docs/formats/qwen3-hermes.md +130 -0
  30. canitoolcall-0.1.0/docs/formats/qwen3-xml.md +169 -0
  31. canitoolcall-0.1.0/docs/img/matrix.png +0 -0
  32. canitoolcall-0.1.0/docs/release-notes/v0.1.0.md +111 -0
  33. canitoolcall-0.1.0/fixtures/.gitkeep +0 -0
  34. canitoolcall-0.1.0/fixtures/deepseek/engine-tests.jsonl +10 -0
  35. canitoolcall-0.1.0/fixtures/deepseek/family.json +68 -0
  36. canitoolcall-0.1.0/fixtures/deepseek/malformed.jsonl +2 -0
  37. canitoolcall-0.1.0/fixtures/deepseek/v3.jsonl +10 -0
  38. canitoolcall-0.1.0/fixtures/deepseek/v31.jsonl +11 -0
  39. canitoolcall-0.1.0/fixtures/deepseek/v32.jsonl +16 -0
  40. canitoolcall-0.1.0/fixtures/deepseek/v4.jsonl +17 -0
  41. canitoolcall-0.1.0/fixtures/deepseek/v41.jsonl +19 -0
  42. canitoolcall-0.1.0/fixtures/gemma4/basic.jsonl +8 -0
  43. canitoolcall-0.1.0/fixtures/gemma4/bug-reports.jsonl +1 -0
  44. canitoolcall-0.1.0/fixtures/gemma4/edge.jsonl +12 -0
  45. canitoolcall-0.1.0/fixtures/gemma4/engine-tests.jsonl +16 -0
  46. canitoolcall-0.1.0/fixtures/gemma4/family.json +33 -0
  47. canitoolcall-0.1.0/fixtures/gemma4/malformed.jsonl +1 -0
  48. canitoolcall-0.1.0/fixtures/gemma4/multiturn.jsonl +2 -0
  49. canitoolcall-0.1.0/fixtures/gemma4/parallel.jsonl +3 -0
  50. canitoolcall-0.1.0/fixtures/gemma4/truncated.jsonl +5 -0
  51. canitoolcall-0.1.0/fixtures/glm/family.json +63 -0
  52. canitoolcall-0.1.0/fixtures/glm/glm45-render.jsonl +12 -0
  53. canitoolcall-0.1.0/fixtures/glm/glm47-render.jsonl +18 -0
  54. canitoolcall-0.1.0/fixtures/glm/glm53-render.jsonl +4 -0
  55. canitoolcall-0.1.0/fixtures/glm/imported.jsonl +12 -0
  56. canitoolcall-0.1.0/fixtures/glm/truncated-malformed.jsonl +5 -0
  57. canitoolcall-0.1.0/fixtures/gpt-oss/family.json +41 -0
  58. canitoolcall-0.1.0/fixtures/gpt-oss/imported.jsonl +24 -0
  59. canitoolcall-0.1.0/fixtures/gpt-oss/rendered.jsonl +27 -0
  60. canitoolcall-0.1.0/fixtures/kimi/family.json +57 -0
  61. canitoolcall-0.1.0/fixtures/kimi/imported.jsonl +13 -0
  62. canitoolcall-0.1.0/fixtures/kimi/k26-render.jsonl +14 -0
  63. canitoolcall-0.1.0/fixtures/kimi/k2i-render.jsonl +3 -0
  64. canitoolcall-0.1.0/fixtures/kimi/k3-render.jsonl +15 -0
  65. canitoolcall-0.1.0/fixtures/kimi/truncated.jsonl +4 -0
  66. canitoolcall-0.1.0/fixtures/llama/family.json +59 -0
  67. canitoolcall-0.1.0/fixtures/llama/imported.jsonl +18 -0
  68. canitoolcall-0.1.0/fixtures/llama/l3-render.jsonl +11 -0
  69. canitoolcall-0.1.0/fixtures/llama/recorded.jsonl +4 -0
  70. canitoolcall-0.1.0/fixtures/llama/truncated.jsonl +1 -0
  71. canitoolcall-0.1.0/fixtures/mistral/family.json +125 -0
  72. canitoolcall-0.1.0/fixtures/mistral/imported.jsonl +18 -0
  73. canitoolcall-0.1.0/fixtures/mistral/rendered.jsonl +29 -0
  74. canitoolcall-0.1.0/fixtures/qwen3-hermes/basic.jsonl +8 -0
  75. canitoolcall-0.1.0/fixtures/qwen3-hermes/bug-reports.jsonl +2 -0
  76. canitoolcall-0.1.0/fixtures/qwen3-hermes/edge.jsonl +7 -0
  77. canitoolcall-0.1.0/fixtures/qwen3-hermes/engine-tests.jsonl +10 -0
  78. canitoolcall-0.1.0/fixtures/qwen3-hermes/family.json +49 -0
  79. canitoolcall-0.1.0/fixtures/qwen3-hermes/instruct-2507.jsonl +5 -0
  80. canitoolcall-0.1.0/fixtures/qwen3-hermes/malformed.jsonl +2 -0
  81. canitoolcall-0.1.0/fixtures/qwen3-hermes/multiturn.jsonl +2 -0
  82. canitoolcall-0.1.0/fixtures/qwen3-hermes/parallel.jsonl +3 -0
  83. canitoolcall-0.1.0/fixtures/qwen3-hermes/thinking-2507.jsonl +5 -0
  84. canitoolcall-0.1.0/fixtures/qwen3-hermes/truncated.jsonl +6 -0
  85. canitoolcall-0.1.0/fixtures/qwen3-xml/family.json +89 -0
  86. canitoolcall-0.1.0/fixtures/qwen3-xml/imported.jsonl +20 -0
  87. canitoolcall-0.1.0/fixtures/qwen3-xml/rendered.jsonl +34 -0
  88. canitoolcall-0.1.0/harnesses/.gitkeep +0 -0
  89. canitoolcall-0.1.0/harnesses/llamacpp/CMakeLists.txt +42 -0
  90. canitoolcall-0.1.0/harnesses/llamacpp/replay.cpp +688 -0
  91. canitoolcall-0.1.0/harnesses/ollama/ctcreplay/main.go +187 -0
  92. canitoolcall-0.1.0/harnesses/ollama/detok/CMakeLists.txt +35 -0
  93. canitoolcall-0.1.0/harnesses/ollama/detok/detok.cpp +135 -0
  94. canitoolcall-0.1.0/pyproject.toml +139 -0
  95. canitoolcall-0.1.0/scripts/check_release.py +62 -0
  96. canitoolcall-0.1.0/scripts/engines/.gitkeep +0 -0
  97. canitoolcall-0.1.0/scripts/engines/gguf_vocab.sh +316 -0
  98. canitoolcall-0.1.0/scripts/engines/llamacpp.sh +111 -0
  99. canitoolcall-0.1.0/scripts/engines/ollama.sh +75 -0
  100. canitoolcall-0.1.0/scripts/engines/prefetch_hf.py +106 -0
  101. canitoolcall-0.1.0/scripts/engines/sglang.sh +144 -0
  102. canitoolcall-0.1.0/scripts/engines/transformers.sh +66 -0
  103. canitoolcall-0.1.0/scripts/engines/vllm.sh +146 -0
  104. canitoolcall-0.1.0/scripts/fixtures/.gitkeep +0 -0
  105. canitoolcall-0.1.0/scripts/fixtures/deepseek/build.py +812 -0
  106. canitoolcall-0.1.0/scripts/fixtures/deepseek/imported.py +312 -0
  107. canitoolcall-0.1.0/scripts/fixtures/gemma4/build.py +816 -0
  108. canitoolcall-0.1.0/scripts/fixtures/gemma4/imported.py +293 -0
  109. canitoolcall-0.1.0/scripts/fixtures/glm/_core.py +293 -0
  110. canitoolcall-0.1.0/scripts/fixtures/glm/build.py +758 -0
  111. canitoolcall-0.1.0/scripts/fixtures/glm/imported.py +304 -0
  112. canitoolcall-0.1.0/scripts/fixtures/gpt-oss/_common.py +149 -0
  113. canitoolcall-0.1.0/scripts/fixtures/gpt-oss/import_gpt_oss.py +543 -0
  114. canitoolcall-0.1.0/scripts/fixtures/gpt-oss/render_gpt_oss.py +539 -0
  115. canitoolcall-0.1.0/scripts/fixtures/kimi/_core.py +293 -0
  116. canitoolcall-0.1.0/scripts/fixtures/kimi/build.py +737 -0
  117. canitoolcall-0.1.0/scripts/fixtures/kimi/imported.py +319 -0
  118. canitoolcall-0.1.0/scripts/fixtures/llama/_core.py +293 -0
  119. canitoolcall-0.1.0/scripts/fixtures/llama/build.py +678 -0
  120. canitoolcall-0.1.0/scripts/fixtures/llama/imported.py +349 -0
  121. canitoolcall-0.1.0/scripts/fixtures/mistral/_common.py +228 -0
  122. canitoolcall-0.1.0/scripts/fixtures/mistral/import_mistral.py +369 -0
  123. canitoolcall-0.1.0/scripts/fixtures/mistral/render_mistral.py +429 -0
  124. canitoolcall-0.1.0/scripts/fixtures/qwen3-hermes/build.py +916 -0
  125. canitoolcall-0.1.0/scripts/fixtures/qwen3-hermes/imported.py +302 -0
  126. canitoolcall-0.1.0/scripts/fixtures/qwen3-xml/_common.py +202 -0
  127. canitoolcall-0.1.0/scripts/fixtures/qwen3-xml/import_qwen3_xml.py +526 -0
  128. canitoolcall-0.1.0/scripts/fixtures/qwen3-xml/render_qwen3_xml.py +499 -0
  129. canitoolcall-0.1.0/site/templates/_macros.html +21 -0
  130. canitoolcall-0.1.0/site/templates/assets/style.css +162 -0
  131. canitoolcall-0.1.0/site/templates/base.html +31 -0
  132. canitoolcall-0.1.0/site/templates/cell.html +182 -0
  133. canitoolcall-0.1.0/site/templates/index.html +141 -0
  134. canitoolcall-0.1.0/spec/README.md +142 -0
  135. canitoolcall-0.1.0/spec/family.schema.json +68 -0
  136. canitoolcall-0.1.0/spec/fixture.schema.json +213 -0
  137. canitoolcall-0.1.0/spec/results.schema.json +143 -0
  138. canitoolcall-0.1.0/src/canitoolcall/__init__.py +19 -0
  139. canitoolcall-0.1.0/src/canitoolcall/__main__.py +5 -0
  140. canitoolcall-0.1.0/src/canitoolcall/adapters/__init__.py +132 -0
  141. canitoolcall-0.1.0/src/canitoolcall/adapters/base.py +260 -0
  142. canitoolcall-0.1.0/src/canitoolcall/adapters/llamacpp.py +643 -0
  143. canitoolcall-0.1.0/src/canitoolcall/adapters/ollama.py +551 -0
  144. canitoolcall-0.1.0/src/canitoolcall/adapters/sglang.py +744 -0
  145. canitoolcall-0.1.0/src/canitoolcall/adapters/transformers.py +350 -0
  146. canitoolcall-0.1.0/src/canitoolcall/adapters/vllm.py +713 -0
  147. canitoolcall-0.1.0/src/canitoolcall/adapters/worker.py +198 -0
  148. canitoolcall-0.1.0/src/canitoolcall/checks.py +588 -0
  149. canitoolcall-0.1.0/src/canitoolcall/chunking.py +204 -0
  150. canitoolcall-0.1.0/src/canitoolcall/cli.py +337 -0
  151. canitoolcall-0.1.0/src/canitoolcall/fixtures.py +515 -0
  152. canitoolcall-0.1.0/src/canitoolcall/matrix.py +783 -0
  153. canitoolcall-0.1.0/src/canitoolcall/probe.py +933 -0
  154. canitoolcall-0.1.0/src/canitoolcall/py.typed +0 -0
  155. canitoolcall-0.1.0/src/canitoolcall/pytest_plugin.py +273 -0
  156. canitoolcall-0.1.0/src/canitoolcall/results.py +379 -0
  157. canitoolcall-0.1.0/src/canitoolcall/runner.py +621 -0
  158. canitoolcall-0.1.0/tests/adapters/.gitkeep +0 -0
  159. canitoolcall-0.1.0/tests/adapters/test_llamacpp.py +508 -0
  160. canitoolcall-0.1.0/tests/adapters/test_ollama.py +497 -0
  161. canitoolcall-0.1.0/tests/adapters/test_sglang.py +564 -0
  162. canitoolcall-0.1.0/tests/adapters/test_transformers.py +393 -0
  163. canitoolcall-0.1.0/tests/adapters/test_vllm.py +531 -0
  164. canitoolcall-0.1.0/tests/conftest.py +75 -0
  165. canitoolcall-0.1.0/tests/core/core_corpus.py +97 -0
  166. canitoolcall-0.1.0/tests/core/data/fixtures/qwen3-hermes/family.json +26 -0
  167. canitoolcall-0.1.0/tests/core/data/fixtures/qwen3-hermes/sample.jsonl +1 -0
  168. canitoolcall-0.1.0/tests/core/data/make_sample.py +128 -0
  169. canitoolcall-0.1.0/tests/core/reference_adapter.py +298 -0
  170. canitoolcall-0.1.0/tests/core/test_adapters_registry.py +118 -0
  171. canitoolcall-0.1.0/tests/core/test_checks.py +592 -0
  172. canitoolcall-0.1.0/tests/core/test_chunking.py +136 -0
  173. canitoolcall-0.1.0/tests/core/test_cli.py +194 -0
  174. canitoolcall-0.1.0/tests/core/test_fixtures.py +182 -0
  175. canitoolcall-0.1.0/tests/core/test_licensing.py +44 -0
  176. canitoolcall-0.1.0/tests/core/test_results.py +166 -0
  177. canitoolcall-0.1.0/tests/core/test_results_snapshot.py +60 -0
  178. canitoolcall-0.1.0/tests/core/test_runner.py +408 -0
  179. canitoolcall-0.1.0/tests/core/test_worker.py +178 -0
  180. canitoolcall-0.1.0/tests/probe/.gitkeep +0 -0
  181. canitoolcall-0.1.0/tests/probe/conftest.py +244 -0
  182. canitoolcall-0.1.0/tests/probe/test_probe.py +472 -0
  183. canitoolcall-0.1.0/tests/probe/test_pytest_plugin.py +229 -0
  184. canitoolcall-0.1.0/tests/site/test_matrix.py +440 -0
@@ -0,0 +1,29 @@
1
+ # Isolated per-engine environments and spike scratch space (never committed)
2
+ .venvs/
3
+ .spikes/
4
+ # Engine source clones, compiled harnesses, vocab-only GGUFs (built by scripts/engines/*.sh)
5
+ .engines/
6
+
7
+ # Run outputs (the matrix site is generated from these; publish via CI artifacts).
8
+ # Dated snapshots (results/YYYY-MM-DD/, gzipped) are committed on purpose.
9
+ /results/*
10
+ !/results/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/
11
+ /site/_build/
12
+
13
+ # Python
14
+ __pycache__/
15
+ *.py[cod]
16
+ *.egg-info/
17
+ .venv/
18
+ build/
19
+ dist/
20
+ .pytest_cache/
21
+ .mypy_cache/
22
+ .ruff_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # OS / editors
27
+ .DS_Store
28
+ .idea/
29
+ .vscode/
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
+ [semantic versioning](https://semver.org/).
6
+
7
+ ## [0.1.0] - 2026-09-26
8
+
9
+ ### Added
10
+
11
+ - Fixture spec v0.1 (`spec/`), 469 fixtures across nine model families, each with provenance.
12
+ - Offline replay through the pinned parsers of vLLM 0.30.0, SGLang 0.5.20, llama.cpp `a25c9865`,
13
+ Ollama `7af39318` and HF transformers 5.17.0, with eight checks and seeded token-level chunking.
14
+ - Per-engine streaming granularity: multi-token chunkings are reported as synthetic for engines
15
+ whose servers stream one token per event (`run.synthetic_strategies`).
16
+ - `canitoolcall probe` for live OpenAI-compatible endpoints, a pytest plugin, and the static matrix site.
17
+ - A committed results snapshot (`results/2026-09-25/`) with every failure triaged.
@@ -0,0 +1,83 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **[saurav.lall1+github@gmail.com](mailto:saurav.lall1+github@gmail.com)**. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,144 @@
1
+ # Contributing to CanIToolCall
2
+
3
+ Thank you for helping. Most contributions fall into one of three kinds, and each fits in a single PR:
4
+
5
+ 1. **Add a model family.** This is the most common kind, and the rest of this guide centres on it.
6
+ 2. **Add fixtures to an existing family**, for example a new edge case or a regression from a bug report.
7
+ 3. **Add or update an engine adapter.**
8
+
9
+ By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). Report security issues privately, as described in [SECURITY.md](SECURITY.md), not in public issues.
10
+
11
+ ## Development setup
12
+
13
+ ```sh
14
+ uv sync # main env: CLI, runner, checks, matrix (Python 3.12)
15
+ uv run ruff check src tests scripts && uv run ruff format --check src tests scripts && uv run mypy && uv run pytest
16
+ ```
17
+
18
+ CI runs exactly that command, plus `canitoolcall validate`, `uv build` and `twine check`. Engine tests (`@pytest.mark.engine("vllm")`) skip themselves until you build that engine's environment with `bash scripts/engines/<engine>.sh`. That script puts the engine in an **isolated** venv under `.venvs/<engine>/`. Never install vLLM, SGLang or torch into the main env.
19
+
20
+ Read [`docs/DESIGN.md`](docs/DESIGN.md) for the architecture, and [`spec/README.md`](spec/README.md) for the fixture format.
21
+
22
+ ## Add a model family: one PR
23
+
24
+ Suppose the new family's slug is `acme`, for a model `acme-ai/Acme-3`. The PR contains these files:
25
+
26
+ | File | What it holds |
27
+ |---|---|
28
+ | `docs/formats/acme.md` | the format notes: the exact raw text, the special tokens, the source template URL and revision, the engine parsers that handle the format (with both vLLM's and SGLang's names), and known bugs with issue URLs |
29
+ | `fixtures/acme/family.json` | the family metadata |
30
+ | `fixtures/acme/*.jsonl` | the fixtures, grouped by topic (`basic.jsonl`, `parallel.jsonl`, `edge.jsonl`, `truncated.jsonl`, …) |
31
+ | `scripts/fixtures/acme/build.py` | the generator that reproduces every `template_render` fixture |
32
+ | `src/canitoolcall/adapters/<engine>.py` | only if an adapter needs a parser mapping for `acme` |
33
+
34
+ ### Step by step
35
+
36
+ 1. **Write the format notes first.** Render an assistant tool-call message through the model's **official** chat template or encoder, for example with `apply_chat_template` or the vendor's encoder library. Paste the output verbatim into `docs/formats/acme.md` and record the template URL at a pinned revision. Look up which parser each engine uses for it. [`docs/formats/qwen3-hermes.md`](docs/formats/qwen3-hermes.md) is a good model.
37
+
38
+ 2. **Write `fixtures/acme/family.json`** (schema: [`spec/family.schema.json`](spec/family.schema.json)):
39
+ - `slug`, `name`, `spec_version` and `has_reasoning`
40
+ - `markers`: every special string that must never leak into content, reasoning or arguments. The `no_leakage` check uses this list.
41
+ - `reference_models`: the models whose tokenizer and template the adapters use, each with:
42
+ - `repo` and `revision` (a full commit sha)
43
+ - `stop_tokens`, from `generation_config.json`
44
+ - `default_generation_prompt`, when `add_generation_prompt` pre-fills text such as `<think>\n`
45
+ - `format_notes`: `docs/formats/acme.md`
46
+
47
+ 3. **Write the generator, `scripts/fixtures/acme/build.py`.** Follow the "Token ids come first" rule in the spec:
48
+ 1. Render with `apply_chat_template(tokenize=True)`.
49
+ 2. Slice off the prompt ids.
50
+ 3. Cut at the first stop id.
51
+ 4. Store the result as `output_token_ids`, with a `tokenizer` pin.
52
+ 5. Set `raw_output` to those ids decoded with `skip_special_tokens=False`.
53
+
54
+ Download only config and tokenizer files at pinned revisions, never weights. The script must be deterministic: re-running it must leave `git diff` clean. [`scripts/fixtures/qwen3-hermes/build.py`](scripts/fixtures/qwen3-hermes/build.py) is a complete example.
55
+
56
+ 4. **Cover the edge cases.** Aim for about 20 fixtures and use the tags from the spec:
57
+ - `single-call`, `parallel-calls` and `no-call`
58
+ - `nested-json`, `unicode`, `string-escapes` and `numeric-arguments`
59
+ - `empty-arguments` and `marker-in-arguments`
60
+ - `text-before-call`, `text-after-call`, `reasoning` and `reasoning-prefilled`
61
+ - `multi-turn` and `long-arguments`
62
+ - `truncated` and `malformed`: these carry an `expected_error` instead of `expected`
63
+ - `regression`: for fixtures taken from bug reports
64
+
65
+ 5. **Validate:** `uv run canitoolcall validate fixtures/acme/`.
66
+
67
+ 6. **Replay it** through every engine you can build, for example `uv run canitoolcall run --engine vllm --family acme`, and look at the result with `uv run canitoolcall matrix`. If the engine has no parser for the family, the adapter's `supports()` must say so, and the result is `unsupported`. When a failure looks like a real engine bug, first check that the fixture is right, then say so in the PR.
68
+
69
+ 7. **Open the PR** with the checklist below.
70
+
71
+ ### PR checklist
72
+
73
+ - [ ] Every fixture has `provenance` (see below). Every `template_render` fixture names its `generator` and records `template_sha256`.
74
+ - [ ] `output_token_ids` and `tokenizer` are present wherever the source allows.
75
+ - [ ] Re-running the generator leaves `git diff` clean.
76
+ - [ ] `canitoolcall validate` reports 0 issues, and the full lint and test command passes.
77
+ - [ ] `docs/formats/acme.md` cites the template and every engine parser by URL at a pinned revision.
78
+
79
+ ## Fixture provenance rules
80
+
81
+ **Never type a format by hand, and never invent one.** A fixture that looks plausible but is wrong makes an engine look broken when it is not. Every fixture needs a `provenance` block, in this order of preference:
82
+
83
+ | `kind` | When | `source_url` | `license` |
84
+ |---|---|---|---|
85
+ | `template_render` | rendered through the official chat template or encoder by your generator script | the template file at the pinned revision | the model repo's license |
86
+ | `engine_test` | copied verbatim from an engine's test suite | the test file at a commit, with a line anchor | vLLM, SGLang and transformers: Apache-2.0; llama.cpp and Ollama: MIT. Add `attribution`. |
87
+ | `bug_report` | reproduces a public issue | the issue or comment URL | `NOASSERTION`, plus a short quote |
88
+ | `recorded` | a real generation captured from the model | the log or dataset | as stated |
89
+ | `spec_example` | quoted verbatim from the format's official spec or reference-library docs | the document at a commit, with a line anchor | the spec's license |
90
+
91
+ **Rendering a past turn is not the same as generating one.** Chat templates serialize *history*, and history can differ from what the model *generates*:
92
+
93
+ - Mistral v11 templates add a `[CALL_ID]` that the model never emits.
94
+ - gpt-oss history puts the recipient in the role header.
95
+
96
+ Engines parse generations. When the two differ, use an `engine_test` or `recorded` source, and explain why in `notes`.
97
+
98
+ **Ids never change.** A fixture id is `acme/<kebab-name>` and is stable forever. If a fixture's content changes meaningfully, add a new id and delete the old one.
99
+
100
+ ## Add an engine adapter
101
+
102
+ An adapter counts only if it runs **the engine's own parser code at a pinned version**. Never reimplement a parser. If something cannot run, report it as `unsupported`.
103
+
104
+ 1. **Build the environment.** `scripts/engines/<engine>.sh` builds `.venvs/<engine>` with pinned versions, plus any checkout or harness under `.engines/<engine>/` (gitignored). It must work on Linux and macOS, on x86_64 and arm64, with no GPU and no model weights.
105
+ 2. **Write the adapter class.** `src/canitoolcall/adapters/<engine>.py` defines one subclass of `canitoolcall.adapters.base.Adapter`:
106
+ - It must import with the **standard library only** at module level. Import the engine inside methods, because the worker loads the module inside the engine's venv with only `src/` on the path.
107
+ - Implement:
108
+ - `version`, and optionally `commit` and `engine_details`
109
+ - `supports(family, model)`: honest and cheap
110
+ - `parser_config`: record every parser name, template source and sha256, and every flag
111
+ - `units`: return the fixture's `output_token_ids`
112
+ - `parse`
113
+ - `parse_stream`: detokenize each group of ids with **the engine's own** incremental detokenizer, then call its streaming parser the way its server does
114
+ - Optionally implement `special_token_ids`, which enables the `special` strategy.
115
+ - Set `tokens_per_step = "one"` if the engine's server streams one event per generated token; multi-token chunkings are then reported as synthetic instead of counted.
116
+ - Follow the ten rules in the adapter contract in [`docs/DESIGN.md`](docs/DESIGN.md). Each rule exists because an adapter broke without it.
117
+ 3. **Compiled engines.** For an engine like llama.cpp or Ollama, put the harness in `harnesses/<engine>/`. It speaks JSON lines, and one process serves a whole run.
118
+ 4. **Register it.** Add one line to the `ENGINES` registry in `src/canitoolcall/adapters/__init__.py`, and add the engine to the matrix in `.github/workflows/nightly.yml`.
119
+ 5. **Test it.** Put the tests in `tests/adapters/test_<engine>.py`:
120
+ - a fast test of `supports` and `parser_config` that needs no engine
121
+ - `@pytest.mark.engine("<engine>")` tests that replay at least one fixture per supported family through the real worker
122
+
123
+ Engine exceptions are **outcomes**: catch them and return `ParseResult(exception="Type: msg")`. Raise only for harness problems, which the runner records as `error`.
124
+
125
+ ## Reporting a parser bug upstream
126
+
127
+ Each failing cell on the matrix site has a page with:
128
+
129
+ - the failing checks and strategies
130
+ - the observed parse, as a diff against the expected one
131
+ - the parser configuration
132
+ - a one-line replay command
133
+
134
+ Before you file an issue with an engine:
135
+
136
+ 1. Re-run that command against the pinned version.
137
+ 2. Check the fixture's provenance.
138
+ 3. Link the fixture record in the issue.
139
+
140
+ Please don't file bugs from the untriaged candidates in `docs/DESIGN.md` §6 until they have been turned into fixtures and verified.
141
+
142
+ ## Style
143
+
144
+ Keep code typed (`mypy --strict`), use dataclasses, and format with `ruff format` (line length 120). Keep dependencies of the main package minimal. Write tests with pytest; the site's tests build their inputs with `RunResults` rather than committing results files.
@@ -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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 DeepSeek
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.
@@ -0,0 +1,29 @@
1
+ GLM-5.3 License
2
+
3
+ Copyright (c) 2026 Z.AI
4
+
5
+ Permission is hereby granted, free of charge, to any person or entity (the "Licensee") obtaining a copy of this software — including the model weights, parameters, configuration files, inference and training code, and associated documentation (collectively, the "Software") — to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software; to run, deploy, fine-tune, or otherwise modify the Software and create derivative works from it; and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ 1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Licensee's use of the Software must comply with applicable laws and regulations.
8
+
9
+ 2. "Model as a Service" means giving a third party access to language model inference or fine-tuning (e.g., via API) in a manner that allows such third party to exercise meaningful control over the inputs, parameters, or training data. This does not include (a) end-user products with model capabilities solely embedded within specific features or harnesses, or (b) mere relaying of requests to models hosted by others.
10
+ If the Licensee or any of its affiliates operates a Model as a Service business, and the aggregate revenue of the Licensee and its affiliates exceeds 10 billion US dollars (or the equivalent in other currencies) in total over any consecutive 12 months, the Licensee must pass Z.AI's security review before using the Software or its derivative works for any commercial purpose. The scope and method of the security review shall be reasonably determined by Z.AI.
11
+
12
+ 3. THE SOFTWARE AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Z.AI OR ITS AFFILIATES OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+
14
+ For any questions regarding this license, please contact glmlicense@z.ai.
15
+
16
+ -----
17
+
18
+ 版权所有 (c) 2026 Z.AI
19
+
20
+ 特此免费授予任何获得本软件副本的个人或实体("被许可方")——包括模型权重、参数、配置文件、推理和训练代码及相关文档(统称"软件")——不受限制地处理本软件的权利,包括但不限于:使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本;运行、部署、微调或以其他方式修改软件并创建衍生作品;以及允许获得软件的其他人行使上述权利,但须遵守以下条件:
21
+
22
+ 1. 上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。被许可方对软件的使用必须符合适用法律法规。
23
+
24
+ 2. "模型即服务"指以允许第三方对输入、参数或训练数据行使实质性控制的方式,向第三方提供语言模型推理或微调服务(如通过API)。不包括:(a) 模型能力仅嵌入特定功能或框架中的终端用户产品,或(b) 单纯转发请求至他人托管的模型。
25
+ 若被许可方或其关联方运营"模型即服务"业务,且被许可方及关联方在任意连续12个月内累计总收入超过100亿美元(或等值其他货币),则被许可方在使用软件或其衍生作品进行任何商业用途之前,须通过Z.AI的安全审查。安全审查的范围和方式由Z.AI合理确定。
26
+
27
+ 3. 软件及其任何输出和结果均按"现状"提供,不附带任何形式的保证,无论是明示还是暗示,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,Z.AI或其关联方或版权持有人均不对任何索赔、损害或其他责任承担责任,无论该责任是基于合同、侵权或其他方式,因软件或使用软件而产生或与之相关。
28
+
29
+ 如对本许可有任何疑问,请联系 glmlicense@z.ai。
@@ -0,0 +1,27 @@
1
+ Modified MIT License
2
+
3
+ Copyright (c) 2025 Moonshot AI
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.
22
+
23
+ Our only modification part is that, if the Software (or any derivative works
24
+ thereof) is used for any of your commercial products or services that have
25
+ more than 100 million monthly active users, or more than 20 million US dollars
26
+ (or equivalent in other currencies) in monthly revenue, you shall prominently
27
+ display "Kimi K2" on the user interface of such product or service.
@@ -0,0 +1,27 @@
1
+ Modified MIT License
2
+
3
+ Copyright (c) 2026 Moonshot AI
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.
22
+
23
+ Our only modification part is that, if the Software (or any derivative works
24
+ thereof) is used for any of your commercial products or services that have
25
+ more than 100 million monthly active users, or more than 20 million US dollars
26
+ (or equivalent in other currencies) in monthly revenue, you shall prominently
27
+ display "Kimi K2.6" on the user interface of such product or service.
@@ -0,0 +1,52 @@
1
+ Kimi K3 License
2
+
3
+ Copyright (c) 2026 Moonshot AI
4
+
5
+ Permission is hereby granted, free of charge, to any person (the "Licensee")
6
+ obtaining a copy of this software — including the model weights, parameters,
7
+ configuration files, inference and training code, and associated documentation
8
+ (collectively, the "Software") — to deal in the Software without restriction.
9
+ This includes, without limitation, the rights to use, copy, modify, merge,
10
+ publish, distribute, sublicense, and/or sell copies of the Software; to run,
11
+ deploy, fine-tune, or otherwise modify the Software and create derivative works
12
+ from it; and to permit persons to whom the Software is furnished to do so, in
13
+ each case subject to the following conditions:
14
+
15
+ 1. The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software. Licensee's use of the
17
+ Software must comply with applicable laws and regulations.
18
+
19
+ 2. "Model as a Service" means giving a third party access to language model
20
+ inference or fine-tuning (e.g., via API) in a manner that allows such third
21
+ party to exercise meaningful control over the inputs, parameters, or training
22
+ data. This does not include (a) end-user products with model capabilities solely
23
+ embedded within specific features or harnesses, or (b) mere relaying of requests
24
+ to models hosted by others.
25
+
26
+ If the Licensee or any of its affiliates operates a Model as a Service business,
27
+ and the aggregate revenue of the Licensee and its affiliates exceeds 20 million
28
+ US dollars (or the equivalent in other currencies) in total over any consecutive
29
+ 12 months, the Licensee must enter into a separate agreement with Moonshot AI
30
+ before using the Software or its derivative works for any commercial purpose.
31
+
32
+ 3. If the Software (or any derivative works thereof) is used for any of the
33
+ Licensee's commercial products or services that have more than 100 million
34
+ monthly active users, or more than 20 million US dollars (or equivalent in other
35
+ currencies) in monthly revenue, "Kimi K3" must be prominently displayed on the
36
+ user interface of such product or service.
37
+
38
+ 4. The requirements set forth in Sections 2 and 3 do not apply to: (a) internal
39
+ use of the Software, defined as any use that does not make the Software, its
40
+ outputs, or its underlying capabilities available to third parties; or (b) any
41
+ use of the Software accessed through Moonshot AI's official products or
42
+ certified inference partners.
43
+
44
+ 5. THE SOFTWARE AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS”
45
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
46
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
47
+ AND NONINFRINGEMENT. IN NO EVENT SHALL MOONSHOT AI OR ITS AFFILIATES OR
48
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
49
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
50
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
+
52
+ For any questions regarding this license, please contact <license@moonshot.ai>.