Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions xpertai/models/moonshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

`@xpert-ai/plugin-moonshot` connects [Moonshot AI (Kimi)](https://platform.moonshot.cn/) models to the [XpertAI](https://github.com/xpert-ai/xpert) platform. The plugin integrates Moonshot's OpenAI-compatible API so XpertAI 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.
`@xpert-ai/plugin-moonshot` connects [Moonshot AI (Kimi)](https://platform.moonshot.cn/) models to the [XpertAI](https://github.com/xpert-ai/xpert) platform. The plugin integrates Moonshot's OpenAI-compatible API so XpertAI agents can leverage Kimi's powerful long-context language models with context windows up to 262K tokens, including the latest K2 series with advanced reasoning capabilities.

## Core Features

Expand All @@ -12,6 +12,7 @@
- Supports multiple Moonshot model variants including:
- **Moonshot V1 Series**: `moonshot-v1-8k`, `moonshot-v1-32k`, `moonshot-v1-128k` for various context length requirements
- **Kimi K2 Series**: `kimi-k2-0711-preview`, `kimi-k2-0905-preview`, `kimi-k2-turbo-preview` for enhanced performance
- **Kimi K2.5**: `kimi-k2.5` with 262K context window, vision support, and deep thinking mode for complex reasoning tasks
- **Kimi K2 Thinking Series**: `kimi-k2-thinking`, `kimi-k2-thinking-turbo` for advanced reasoning tasks

## Installation
Expand Down Expand Up @@ -43,7 +44,7 @@ During validation, the plugin instantiates a ChatOpenAI client with your credent

## Model Capabilities

- **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.
- **Long Context Support**: All Moonshot models excel at handling long-context scenarios, with the V1-128K variant supporting up to 128,000 tokens and the latest K2.5 supporting up to 262,000 tokens of context.
- **Conversational Models**: `MoonshotLargeLanguageModel` merges provider credentials with per-model overrides, enables streaming, and registers token usage callbacks so agent telemetry stays accurate.
- **Advanced Reasoning**: The K2 Thinking series models provide enhanced reasoning capabilities for complex problem-solving tasks.
- **OpenAI Compatibility**: Built on LangChain's `ChatOpenAI`, ensuring seamless integration with existing OpenAI-compatible workflows.
Expand Down
Binary file modified xpertai/models/moonshot/src/_assets/icon_k2_s_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified xpertai/models/moonshot/src/_assets/icon_l_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified xpertai/models/moonshot/src/_assets/icon_s_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions xpertai/models/moonshot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import { z } from 'zod';
import { SvgIcon } from './types.js';
import { MoonshotModule } from './moonshot.module.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// Read PNG icon as data URL. No fallback/try-catch: missing asset should fail fast.
const iconPngDataUrl =
'data:image/png;base64,' +
readFileSync(join(__dirname, '_assets/icon_s_en.png')).toString('base64');

const packageJson = JSON.parse(
readFileSync(join(__dirname, '../package.json'), 'utf8')
) as {
Expand All @@ -24,8 +28,8 @@ const plugin: XpertPlugin<any> = {
version: packageJson.version,
category: 'model',
icon: {
type: 'svg',
value: SvgIcon,
type: 'image',
value: iconPngDataUrl,
},
displayName: 'Moonshot AI (Kimi)',
description: 'Provide Moonshot AI (Kimi) Models with Long Context Support',
Expand Down
3 changes: 3 additions & 0 deletions xpertai/models/moonshot/src/llm/_position.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
- moonshot-v1-32k
- moonshot-v1-128k
- kimi-k2-0711-preview
- kimi-k2-0905-preview
- kimi-k2-turbo-preview
- kimi-k2-thinking
- kimi-k2-thinking-turbo
- kimi-k2.5
61 changes: 61 additions & 0 deletions xpertai/models/moonshot/src/llm/kimi-k2.5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
model: kimi-k2.5
label:
zh_Hans: kimi-k2.5
en_US: kimi-k2.5
model_type: llm
features:
- vision
- agent-thought
- tool-call
- multi-tool-call
- stream-tool-call
model_properties:
mode: chat
context_size: 262144
parameter_rules:
- name: temperature
use_template: temperature
default: 1.0
help:
zh_Hans: 采样温度。思考模式下建议使用 1.0,非思考模式下建议使用 0.6。
en_US: Sampling temperature. Recommended 1.0 for thinking mode, 0.6 for instant mode.
- name: top_p
use_template: top_p
default: 0.95
help:
zh_Hans: 核采样参数。思考模式下建议使用 0.95。
en_US: Nucleus sampling parameter. Recommended 0.95 for thinking mode.
- name: max_tokens
use_template: max_tokens
default: 1024
min: 1
max: 262144
- name: thinking
label:
zh_Hans: 深度思考
en_US: Thinking Mode
type: boolean
default: true
required: false
help:
zh_Hans: 启用深度思考模式,使模型具备强大的推理能力,适合解决复杂的逻辑推理、数学问题和代码编写等任务。
en_US: Enable thinking mode for enhanced reasoning capabilities, suitable for complex logical reasoning, math problems, and coding tasks.
- name: response_format
label:
zh_Hans: 回复格式
en_US: Response Format
type: string
help:
zh_Hans: 指定模型必须输出的格式
en_US: specifying the format that the model must output
required: false
options:
- text
- json_object
pricing:
input: '4'
output: '21'
unit: '0.000001'
currency: RMB


5 changes: 2 additions & 3 deletions xpertai/models/moonshot/src/moonshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ configurate_methods:
- predefined-model
- customizable-model
description:
en_US: Models provided by Moonshot, such as moonshot-v1-8k, moonshot-v1-32k, and
moonshot-v1-128k.
zh_Hans: Moonshot 提供的模型,例如 moonshot-v1-8k、moonshot-v1-32k 和 moonshot-v1-128k。
en_US: Models provided by Moonshot, such as kimi-k2.5, kimi-k2, moonshot-v1-8k, moonshot-v1-32k, and moonshot-v1-128k.
zh_Hans: Moonshot 提供的模型,例如 kimi-k2.5, kimi-k2, moonshot-v1-8k、moonshot-v1-32k 和 moonshot-v1-128k。
help:
title:
en_US: Get your API Key from Moonshot
Expand Down