Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🌙 feat: Add Moonshot Kimi K2 Bedrock Support (#11288)

Karthikeyan N200377947e2a
diff --git a/packages/data-provider/specs/bedrock.spec.ts b/packages/data-provider/specs/bedrock.spec.ts
index c569a1b5a7..2a0de6937a 100644
--- a/packages/data-provider/specs/bedrock.spec.ts
+++ b/packages/data-provider/specs/bedrock.spec.ts
@@ -88,6 +88,28 @@ describe('bedrockInputParser', () => {
expect(result.additionalModelRequestFields).toBeUndefined();
});
+ test('should not add anthropic_beta to Moonshot Kimi K2 models', () => {
+ const input = {
+ model: 'moonshot.kimi-k2-0711-thinking',
+ };
+ const result = bedrockInputParser.parse(input) as BedrockConverseInput;
+ const additionalFields = result.additionalModelRequestFields as
+ | Record<string, unknown>
+ | undefined;
+ expect(additionalFields?.anthropic_beta).toBeUndefined();
+ });
+
+ test('should not add anthropic_beta to DeepSeek models', () => {
+ const input = {
+ model: 'deepseek.deepseek-r1',
+ };
+ const result = bedrockInputParser.parse(input) as BedrockConverseInput;
+ const additionalFields = result.additionalModelRequestFields as
+ | Record<string, unknown>
+ | undefined;
+ expect(additionalFields?.anthropic_beta).toBeUndefined();
+ });
+
test('should respect explicit thinking configuration', () => {
const input = {
model: 'anthropic.claude-sonnet-4',
diff --git a/packages/data-provider/src/bedrock.ts b/packages/data-provider/src/bedrock.ts
index 2a4184729f..b37fdc25e1 100644
--- a/packages/data-provider/src/bedrock.ts
+++ b/packages/data-provider/src/bedrock.ts
@@ -137,7 +137,9 @@ export const bedrockInputParser = s.tConversationSchema
if (additionalFields.thinking === true && additionalFields.thinkingBudget === undefined) {
additionalFields.thinkingBudget = 2000;
}
- additionalFields.anthropic_beta = ['output-128k-2025-02-19'];
+ if (typedData.model.includes('anthropic.')) {
+ additionalFields.anthropic_beta = ['output-128k-2025-02-19'];
+ }
} else if (additionalFields.thinking != null || additionalFields.thinkingBudget != null) {
delete additionalFields.thinking;
delete additionalFields.thinkingBudget;
diff --git a/packages/data-provider/src/parameterSettings.ts b/packages/data-provider/src/parameterSettings.ts
index 3a9425bca1..ae811d3d5b 100644
--- a/packages/data-provider/src/parameterSettings.ts
+++ b/packages/data-provider/src/parameterSettings.ts
@@ -880,6 +880,40 @@ const bedrockGeneralCol2: SettingsConfiguration = [
librechat.fileTokenLimit,
];
+const bedrockMoonshot: SettingsConfiguration = [
+ librechat.modelLabel,
+ bedrock.system,
+ librechat.maxContextTokens,
+ createDefinition(bedrock.maxTokens, {
+ default: 16384,
+ }),
+ bedrock.temperature,
+ bedrock.topP,
+ baseDefinitions.stop,
+ librechat.resendFiles,
+ bedrock.region,
+ librechat.fileTokenLimit,
+];
+
+const bedrockMoonshotCol1: SettingsConfiguration = [
+ baseDefinitions.model as SettingDefinition,
+ librechat.modelLabel,
+ bedrock.system,
+ baseDefinitions.stop,
+];
+
+const bedrockMoonshotCol2: SettingsConfiguration = [
+ librechat.maxContextTokens,
+ createDefinition(bedrock.maxTokens, {
+ default: 16384,
+ }),
+ bedrock.temperature,
+ bedrock.topP,
+ librechat.resendFiles,
+ bedrock.region,
+ librechat.fileTokenLimit,
+];
+
export const paramSettings: Record<string, SettingsConfiguration | undefined> = {
[EModelEndpoint.openAI]: openAI,
[EModelEndpoint.azureOpenAI]: openAI,
@@ -892,6 +926,7 @@ export const paramSettings: Record<string, SettingsConfiguration | undefined> =
[`${EModelEndpoint.bedrock}-${BedrockProviders.AI21}`]: bedrockGeneral,
[`${EModelEndpoint.bedrock}-${BedrockProviders.Amazon}`]: bedrockGeneral,
[`${EModelEndpoint.bedrock}-${BedrockProviders.DeepSeek}`]: bedrockGeneral,
+ [`${EModelEndpoint.bedrock}-${BedrockProviders.Moonshot}`]: bedrockMoonshot,
[EModelEndpoint.google]: googleConfig,
};
@@ -936,6 +971,10 @@ export const presetSettings: Record<
[`${EModelEndpoint.bedrock}-${BedrockProviders.AI21}`]: bedrockGeneralColumns,
[`${EModelEndpoint.bedrock}-${BedrockProviders.Amazon}`]: bedrockGeneralColumns,
[`${EModelEndpoint.bedrock}-${BedrockProviders.DeepSeek}`]: bedrockGeneralColumns,
+ [`${EModelEndpoint.bedrock}-${BedrockProviders.Moonshot}`]: {
+ col1: bedrockMoonshotCol1,
+ col2: bedrockMoonshotCol2,
+ },
[EModelEndpoint.google]: {
col1: googleCol1,
col2: googleCol2,
diff --git a/packages/data-provider/src/schemas.ts b/packages/data-provider/src/schemas.ts
index aea1a9bf09..a3378d3340 100644
--- a/packages/data-provider/src/schemas.ts
+++ b/packages/data-provider/src/schemas.ts
@@ -94,10 +94,11 @@ export enum BedrockProviders {
Amazon = 'amazon',
Anthropic = 'anthropic',
Cohere = 'cohere',
+ DeepSeek = 'deepseek',
Meta = 'meta',
MistralAI = 'mistral',
+ Moonshot = 'moonshot',
StabilityAI = 'stability',
- DeepSeek = 'deepseek',
}
export const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {