@agentxin-ai/plugin-moonshot 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # AgentXin Plugin: Moonshot AI
2
+
3
+ ## Overview
4
+
5
+ `@agentxin-ai/plugin-moonshot` connects [Moonshot AI (Kimi)](https://platform.moonshot.cn/) models to the [AgentXinAI](https://github.com/agentxin-ai/agentxin) platform. The plugin integrates Moonshot's OpenAI-compatible API so AgentXinAI agents can leverage Kimi's powerful long-context language models with context windows up to 128K tokens, including the latest K2 series with advanced reasoning capabilities.
6
+
7
+ ## Core Features
8
+
9
+ - Ships `MoonshotModule`, which registers the NestJS provider strategy, lifecycle hooks, and configuration schema required by the plugin runtime.
10
+ - Implements `MoonshotLargeLanguageModel`, a LangChain-powered adapter built on `ChatOpenAI` that supports streaming chat completions, function calling, and token accounting callbacks for agent telemetry.
11
+ - Shares a console-ready `moonshot.yaml` that drives the AgentXinAI UI forms (icons, help links, credential prompts) for quick operator onboarding.
12
+ - Supports multiple Moonshot model variants including:
13
+ - **Moonshot V1 Series**: `moonshot-v1-8k`, `moonshot-v1-32k`, `moonshot-v1-128k` for various context length requirements
14
+ - **Kimi K2 Series**: `kimi-k2-0711-preview`, `kimi-k2-0905-preview`, `kimi-k2-turbo-preview` for enhanced performance
15
+ - **Kimi K2 Thinking Series**: `kimi-k2-thinking`, `kimi-k2-thinking-turbo` for advanced reasoning tasks
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @agentxin-ai/plugin-moonshot
21
+ ```
22
+
23
+ > **Peer Dependencies**: Ensure your host service also provides `@agentxin-ai/plugin-sdk`, `@nestjs/common`, `@nestjs/config`, `@metad/contracts`, `@langchain/openai`, `chalk`, and `zod`. Refer to `package.json` for exact versions.
24
+
25
+ ## Enabling in AgentXinAI
26
+
27
+ 1. Declare the plugin before bootstrapping the AgentXinAI server:
28
+ ```bash
29
+ PLUGINS=@agentxin-ai/plugin-moonshot
30
+ ```
31
+ 2. In the AgentXinAI admin console (or config file), create a model provider pointing to `moonshot`, then add individual models that map to the specific Moonshot/Kimi versions you want to use.
32
+
33
+ ## Credentials & Model Configuration
34
+
35
+ The `moonshot.yaml` schema backs the form fields you see in the console:
36
+
37
+ | Field | Description |
38
+ | ---------- | -------------------------------------------------------------------------------------------------------------- |
39
+ | `api_key` | Required. Your Moonshot API Key from [platform.moonshot.cn/console/api-keys](https://platform.moonshot.cn/console/api-keys). |
40
+ | `base_url` | Optional. Base URL for API requests (defaults to `https://api.moonshot.cn/v1`). Useful for proxy configurations. |
41
+
42
+ During validation, the plugin instantiates a ChatOpenAI client with your credentials and sends a test message ("你好") to ensure connectivity and permissions.
43
+
44
+ ## Model Capabilities
45
+
46
+ - **Long Context Support**: All Moonshot models excel at handling long-context scenarios, with the V1-128K variant supporting up to 128,000 tokens of context.
47
+ - **Conversational Models**: `MoonshotLargeLanguageModel` merges provider credentials with per-model overrides, enables streaming, and registers token usage callbacks so agent telemetry stays accurate.
48
+ - **Advanced Reasoning**: The K2 Thinking series models provide enhanced reasoning capabilities for complex problem-solving tasks.
49
+ - **OpenAI Compatibility**: Built on LangChain's `ChatOpenAI`, ensuring seamless integration with existing OpenAI-compatible workflows.
50
+
51
+ ## Development & Debugging
52
+
53
+ From the repo root, run Nx commands for this package:
54
+
55
+ ```bash
56
+ cd agentxinai
57
+ npx nx build @agentxin-ai/plugin-moonshot
58
+ npx nx test @agentxin-ai/plugin-moonshot
59
+ ```
60
+
61
+ Artifacts land in `agentxinai/models/moonshot/dist`. Jest settings live in `jest.config.ts`, and the asset copier runs via `npm run prepack` before publishing.
62
+
63
+ ## License
64
+
65
+ This plugin is distributed under the [AGPL-3.0 License](../../../LICENSE) located at the repository root.
Binary file
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="24" height="24" rx="6" fill="#1E1E1E"/>
3
+ <path d="M12 4C11.4477 4 11 4.44772 11 5V7C11 7.55228 11.4477 8 12 8C12.5523 8 13 7.55228 13 7V5C13 4.44772 12.5523 4 12 4Z" fill="white"/>
4
+ <path d="M12 16C11.4477 16 11 16.4477 11 17V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V17C13 16.4477 12.5523 16 12 16Z" fill="white"/>
5
+ <path d="M7 12C7 11.4477 6.55228 11 6 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H6C6.55228 13 7 12.5523 7 12Z" fill="white"/>
6
+ <path d="M20 11C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18C17.4477 13 17 12.5523 17 12C17 11.4477 17.4477 11 18 11H20Z" fill="white"/>
7
+ <circle cx="12" cy="12" r="3" fill="white"/>
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ - moonshot-v1-8k
2
+ - moonshot-v1-32k
3
+ - moonshot-v1-128k
4
+ - kimi-k2-0711-preview
5
+ - kimi-k2-thinking
6
+ - kimi-k2-thinking-turbo
@@ -0,0 +1,40 @@
1
+ model: kimi-k2-0711-preview
2
+ label:
3
+ zh_Hans: kimi-k2-0711-preview
4
+ en_US: kimi-k2-0711-preview
5
+ model_type: llm
6
+ features:
7
+ - agent-thought
8
+ - tool-call
9
+ - multi-tool-call
10
+ - stream-tool-call
11
+ model_properties:
12
+ mode: chat
13
+ context_size: 128000
14
+ parameter_rules:
15
+ - name: temperature
16
+ use_template: temperature
17
+ - name: top_p
18
+ use_template: top_p
19
+ - name: max_tokens
20
+ use_template: max_tokens
21
+ default: 1024
22
+ min: 1
23
+ max: 128000
24
+ - name: response_format
25
+ label:
26
+ zh_Hans: 回复格式
27
+ en_US: Response Format
28
+ type: string
29
+ help:
30
+ zh_Hans: 指定模型必须输出的格式
31
+ en_US: specifying the format that the model must output
32
+ required: false
33
+ options:
34
+ - text
35
+ - json_object
36
+ pricing:
37
+ input: '0.2'
38
+ output: '0.2'
39
+ unit: '0.001'
40
+ currency: RMB
@@ -0,0 +1,40 @@
1
+ model: kimi-k2-0905-preview
2
+ label:
3
+ zh_Hans: kimi-k2-0905-preview
4
+ en_US: kimi-k2-0905-preview
5
+ model_type: llm
6
+ features:
7
+ - agent-thought
8
+ - tool-call
9
+ - multi-tool-call
10
+ - stream-tool-call
11
+ model_properties:
12
+ mode: chat
13
+ context_size: 256000
14
+ parameter_rules:
15
+ - name: temperature
16
+ use_template: temperature
17
+ - name: top_p
18
+ use_template: top_p
19
+ - name: max_tokens
20
+ use_template: max_tokens
21
+ default: 1024
22
+ min: 1
23
+ max: 256000
24
+ - name: response_format
25
+ label:
26
+ zh_Hans: 回复格式
27
+ en_US: Response Format
28
+ type: string
29
+ help:
30
+ zh_Hans: 指定模型必须输出的格式
31
+ en_US: specifying the format that the model must output
32
+ required: false
33
+ options:
34
+ - text
35
+ - json_object
36
+ pricing:
37
+ input: '0.2'
38
+ output: '0.2'
39
+ unit: '0.001'
40
+ currency: RMB
@@ -0,0 +1,40 @@
1
+ model: kimi-k2-thinking-turbo
2
+ label:
3
+ zh_Hans: kimi-k2-thinking-turbo
4
+ en_US: kimi-k2-thinking-turbo
5
+ model_type: llm
6
+ features:
7
+ - agent-thought
8
+ - tool-call
9
+ - multi-tool-call
10
+ - stream-tool-call
11
+ model_properties:
12
+ mode: chat
13
+ context_size: 262144
14
+ parameter_rules:
15
+ - name: temperature
16
+ use_template: temperature
17
+ - name: top_p
18
+ use_template: top_p
19
+ - name: max_tokens
20
+ use_template: max_tokens
21
+ default: 1024
22
+ min: 1
23
+ max: 262144
24
+ - name: response_format
25
+ label:
26
+ zh_Hans: 回复格式
27
+ en_US: Response Format
28
+ type: string
29
+ help:
30
+ zh_Hans: 指定模型必须输出的格式
31
+ en_US: specifying the format that the model must output
32
+ required: false
33
+ options:
34
+ - text
35
+ - json_object
36
+ pricing:
37
+ input: '8'
38
+ output: '58'
39
+ unit: '0.000001'
40
+ currency: RMB
@@ -0,0 +1,40 @@
1
+ model: kimi-k2-thinking
2
+ label:
3
+ zh_Hans: kimi-k2-thinking
4
+ en_US: kimi-k2-thinking
5
+ model_type: llm
6
+ features:
7
+ - agent-thought
8
+ - tool-call
9
+ - multi-tool-call
10
+ - stream-tool-call
11
+ model_properties:
12
+ mode: chat
13
+ context_size: 262144
14
+ parameter_rules:
15
+ - name: temperature
16
+ use_template: temperature
17
+ - name: top_p
18
+ use_template: top_p
19
+ - name: max_tokens
20
+ use_template: max_tokens
21
+ default: 1024
22
+ min: 1
23
+ max: 262144
24
+ - name: response_format
25
+ label:
26
+ zh_Hans: 回复格式
27
+ en_US: Response Format
28
+ type: string
29
+ help:
30
+ zh_Hans: 指定模型必须输出的格式
31
+ en_US: specifying the format that the model must output
32
+ required: false
33
+ options:
34
+ - text
35
+ - json_object
36
+ pricing:
37
+ input: '4'
38
+ output: '16'
39
+ unit: '0.000001'
40
+ currency: RMB
@@ -0,0 +1,40 @@
1
+ model: kimi-k2-turbo-preview
2
+ label:
3
+ zh_Hans: kimi-k2-turbo-preview
4
+ en_US: kimi-k2-turbo-preview
5
+ model_type: llm
6
+ features:
7
+ - agent-thought
8
+ - tool-call
9
+ - multi-tool-call
10
+ - stream-tool-call
11
+ model_properties:
12
+ mode: chat
13
+ context_size: 256000
14
+ parameter_rules:
15
+ - name: temperature
16
+ use_template: temperature
17
+ - name: top_p
18
+ use_template: top_p
19
+ - name: max_tokens
20
+ use_template: max_tokens
21
+ default: 1024
22
+ min: 1
23
+ max: 256000
24
+ - name: response_format
25
+ label:
26
+ zh_Hans: 回复格式
27
+ en_US: Response Format
28
+ type: string
29
+ help:
30
+ zh_Hans: 指定模型必须输出的格式
31
+ en_US: specifying the format that the model must output
32
+ required: false
33
+ options:
34
+ - text
35
+ - json_object
36
+ pricing:
37
+ input: '0.2'
38
+ output: '0.2'
39
+ unit: '0.001'
40
+ currency: RMB
@@ -0,0 +1,58 @@
1
+ model: moonshot-v1-128k
2
+ label:
3
+ en_US: Moonshot v1 128K
4
+ zh_Hans: 月之暗面 v1 128K
5
+ model_type: llm
6
+ features:
7
+ - tool-call
8
+ - multi-tool-call
9
+ - stream-tool-call
10
+ model_properties:
11
+ mode: chat
12
+ context_size: 131072
13
+ parameter_rules:
14
+ - name: temperature
15
+ use_template: temperature
16
+ default: 0.3
17
+ min: 0
18
+ max: 1
19
+ - name: top_p
20
+ use_template: top_p
21
+ default: 1
22
+ min: 0
23
+ max: 1
24
+ - name: max_tokens
25
+ use_template: max_tokens
26
+ default: 4096
27
+ min: 1
28
+ max: 16384
29
+ - name: frequency_penalty
30
+ type: float
31
+ default: 0
32
+ min: 0
33
+ max: 2
34
+ label:
35
+ en_US: Frequency Penalty
36
+ zh_Hans: 频率惩罚
37
+ help:
38
+ en_US: Penalize new tokens based on their frequency in the text so far
39
+ zh_Hans: 根据新 token 在文本中的现有频率对其进行惩罚
40
+ required: false
41
+ - name: presence_penalty
42
+ type: float
43
+ default: 0
44
+ min: 0
45
+ max: 2
46
+ label:
47
+ en_US: Presence Penalty
48
+ zh_Hans: 存在惩罚
49
+ help:
50
+ en_US: Penalize new tokens based on whether they appear in the text so far
51
+ zh_Hans: 根据新 token 是否出现在文本中来对其进行惩罚
52
+ required: false
53
+ pricing:
54
+ input: '5.06'
55
+ output: '5.06'
56
+ unit: '0.000001'
57
+ currency: CNY
58
+
@@ -0,0 +1,58 @@
1
+ model: moonshot-v1-32k
2
+ label:
3
+ en_US: Moonshot v1 32K
4
+ zh_Hans: 月之暗面 v1 32K
5
+ model_type: llm
6
+ features:
7
+ - tool-call
8
+ - multi-tool-call
9
+ - stream-tool-call
10
+ model_properties:
11
+ mode: chat
12
+ context_size: 32768
13
+ parameter_rules:
14
+ - name: temperature
15
+ use_template: temperature
16
+ default: 0.3
17
+ min: 0
18
+ max: 1
19
+ - name: top_p
20
+ use_template: top_p
21
+ default: 1
22
+ min: 0
23
+ max: 1
24
+ - name: max_tokens
25
+ use_template: max_tokens
26
+ default: 2048
27
+ min: 1
28
+ max: 32768
29
+ - name: frequency_penalty
30
+ type: float
31
+ default: 0
32
+ min: 0
33
+ max: 2
34
+ label:
35
+ en_US: Frequency Penalty
36
+ zh_Hans: 频率惩罚
37
+ help:
38
+ en_US: Penalize new tokens based on their frequency in the text so far
39
+ zh_Hans: 根据新 token 在文本中的现有频率对其进行惩罚
40
+ required: false
41
+ - name: presence_penalty
42
+ type: float
43
+ default: 0
44
+ min: 0
45
+ max: 2
46
+ label:
47
+ en_US: Presence Penalty
48
+ zh_Hans: 存在惩罚
49
+ help:
50
+ en_US: Penalize new tokens based on whether they appear in the text so far
51
+ zh_Hans: 根据新 token 是否出现在文本中来对其进行惩罚
52
+ required: false
53
+ pricing:
54
+ input: '24.00'
55
+ output: '24.00'
56
+ unit: '0.000001'
57
+ currency: CNY
58
+
@@ -0,0 +1,58 @@
1
+ model: moonshot-v1-8k
2
+ label:
3
+ en_US: Moonshot v1 8K
4
+ zh_Hans: 月之暗面 v1 8K
5
+ model_type: llm
6
+ features:
7
+ - tool-call
8
+ - multi-tool-call
9
+ - stream-tool-call
10
+ model_properties:
11
+ mode: chat
12
+ context_size: 8192
13
+ parameter_rules:
14
+ - name: temperature
15
+ use_template: temperature
16
+ default: 0.3
17
+ min: 0
18
+ max: 1
19
+ - name: top_p
20
+ use_template: top_p
21
+ default: 1
22
+ min: 0
23
+ max: 1
24
+ - name: max_tokens
25
+ use_template: max_tokens
26
+ default: 1024
27
+ min: 1
28
+ max: 8192
29
+ - name: frequency_penalty
30
+ type: float
31
+ default: 0
32
+ min: 0
33
+ max: 2
34
+ label:
35
+ en_US: Frequency Penalty
36
+ zh_Hans: 频率惩罚
37
+ help:
38
+ en_US: Penalize new tokens based on their frequency in the text so far
39
+ zh_Hans: 根据新 token 在文本中的现有频率对其进行惩罚
40
+ required: false
41
+ - name: presence_penalty
42
+ type: float
43
+ default: 0
44
+ min: 0
45
+ max: 2
46
+ label:
47
+ en_US: Presence Penalty
48
+ zh_Hans: 存在惩罚
49
+ help:
50
+ en_US: Penalize new tokens based on whether they appear in the text so far
51
+ zh_Hans: 根据新 token 是否出现在文本中来对其进行惩罚
52
+ required: false
53
+ pricing:
54
+ input: '12.00'
55
+ output: '12.00'
56
+ unit: '0.000001'
57
+ currency: CNY
58
+
@@ -0,0 +1,95 @@
1
+ background: '#FFFFFF'
2
+ configurate_methods:
3
+ - predefined-model
4
+ - customizable-model
5
+ description:
6
+ en_US: Models provided by Moonshot, such as moonshot-v1-8k, moonshot-v1-32k, and
7
+ moonshot-v1-128k.
8
+ zh_Hans: Moonshot 提供的模型,例如 moonshot-v1-8k、moonshot-v1-32k 和 moonshot-v1-128k。
9
+ help:
10
+ title:
11
+ en_US: Get your API Key from Moonshot
12
+ zh_Hans: 从 Moonshot 获取 API Key
13
+ url:
14
+ en_US: https://platform.moonshot.cn/console/api-keys
15
+ icon_large:
16
+ en_US: icon_l_en.png
17
+ icon_small:
18
+ en_US: icon_k2_s_en.png
19
+ label:
20
+ en_US: Moonshot
21
+ zh_Hans: 月之暗面
22
+ model_credential_schema:
23
+ credential_form_schemas:
24
+ - label:
25
+ en_US: API Key
26
+ placeholder:
27
+ en_US: Enter your API Key
28
+ zh_Hans: 在此输入您的 API Key
29
+ required: true
30
+ type: secret-input
31
+ variable: api_key
32
+ - default: '4096'
33
+ label:
34
+ en_US: Model context size
35
+ zh_Hans: 模型上下文长度
36
+ placeholder:
37
+ en_US: Enter your Model context size
38
+ zh_Hans: 在此输入您的模型上下文长度
39
+ required: true
40
+ type: text-input
41
+ variable: context_size
42
+ - default: '4096'
43
+ label:
44
+ en_US: Upper bound for max tokens
45
+ zh_Hans: 最大 token 上限
46
+ type: text-input
47
+ variable: max_tokens
48
+ - default: no_call
49
+ label:
50
+ en_US: Function calling
51
+ options:
52
+ - label:
53
+ en_US: Not supported
54
+ zh_Hans: 不支持
55
+ value: no_call
56
+ - label:
57
+ en_US: Tool Call
58
+ zh_Hans: Tool Call
59
+ value: tool_call
60
+ required: false
61
+ type: select
62
+ variable: function_calling_type
63
+ model:
64
+ label:
65
+ en_US: Model Name
66
+ zh_Hans: 模型名称
67
+ placeholder:
68
+ en_US: Enter your model name
69
+ zh_Hans: 输入模型名称
70
+ models:
71
+ llm:
72
+ position: models/llm/_position.yaml
73
+ predefined:
74
+ - models/llm/*.yaml
75
+ provider: moonshot
76
+ provider_credential_schema:
77
+ credential_form_schemas:
78
+ - label:
79
+ en_US: API Key
80
+ placeholder:
81
+ en_US: Enter your API Key
82
+ zh_Hans: 在此输入您的 API Key
83
+ required: true
84
+ type: secret-input
85
+ variable: api_key
86
+ - label:
87
+ en_US: API Base
88
+ placeholder:
89
+ en_US: Base URL, e.g. https://api.moonshot.cn/v1
90
+ zh_Hans: Base URL, 如:https://api.moonshot.cn/v1
91
+ required: false
92
+ type: text-input
93
+ variable: endpoint_url
94
+ supported_model_types:
95
+ - llm
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@agentxin-ai/plugin-moonshot",
3
+ "version": "0.0.2",
4
+ "author": {
5
+ "name": "AgentXinAI",
6
+ "url": "https://agentxinai.cn"
7
+ },
8
+ "license": "AGPL-3.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/agentxin-ai/agentxin-plugins.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/agentxin-ai/agentxin-plugins/issues"
15
+ },
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "module": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ "./package.json": "./package.json",
22
+ ".": {
23
+ "@agentxin-plugins-starter/source": "./src/index.ts",
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "default": "./dist/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "!**/*.tsbuildinfo"
32
+ ],
33
+ "scripts": {
34
+ "prepack": "node ./scripts/copy-assets.mjs"
35
+ },
36
+ "dependencies": {
37
+ "tslib": "^2.3.0"
38
+ },
39
+ "peerDependencies": {
40
+ "@langchain/openai": "0.6.9",
41
+ "@metad/contracts": "^3.6.1",
42
+ "@nestjs/common": "^11.1.6",
43
+ "@nestjs/config": "^4.0.2",
44
+ "@agentxin-ai/plugin-sdk": "^3.6.1",
45
+ "chalk": "4.1.2",
46
+ "zod": "3.25.67"
47
+ }
48
+ }