🌙 feat: Add Moonshot Kimi K2 Bedrock Support (#11288)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions

* feat(bedrock): add Moonshot Kimi K2 Thinking model support

- Add Moonshot provider to BedrockProviders enum
- Add Moonshot-specific parameter settings with 16384 default max tokens
- Add conditional for anthropic_beta to only apply to Anthropic models
- Kimi K2 Thinking model: moonshot.kimi-k2-thinking (256K context)

* Delete add-kimi-bedrock.md

* Remove comment on anthropic_beta condition

Remove comment about adding anthropic_beta for Anthropic models.

* chore: enum order

* feat(bedrock): add tests to ensure anthropic_beta is not added to Moonshot Kimi K2 and DeepSeek models

---------

Co-authored-by: Danny Avila <danacordially@gmail.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Karthikeyan N 2026-01-11 00:56:19 +05:30 committed by GitHub
parent 76e17ba701
commit 200377947e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 66 additions and 2 deletions

View file

@ -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',

View file

@ -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;

View file

@ -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,

View file

@ -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) => {