Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .changeset/long-grapes-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@roo-code/vscode-webview": patch
"@roo-code/types": patch
---

feat(moonshot): add new Kimi models and coding API endpoint
6 changes: 5 additions & 1 deletion packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,11 @@ const doubaoSchema = apiModelIdProviderModelSchema.extend({

const moonshotSchema = apiModelIdProviderModelSchema.extend({
moonshotBaseUrl: z
.union([z.literal("https://api.moonshot.ai/v1"), z.literal("https://api.moonshot.cn/v1")])
.union([
z.literal("https://api.moonshot.ai/v1"),
z.literal("https://api.moonshot.cn/v1"),
z.literal("https://api.kimi.com/coding/v1"),
])
.optional(),
moonshotApiKey: z.string().optional(),
})
Expand Down
30 changes: 30 additions & 0 deletions packages/types/src/providers/moonshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ export type MoonshotModelId = keyof typeof moonshotModels
export const moonshotDefaultModelId: MoonshotModelId = "kimi-k2-thinking"

export const moonshotModels = {
"kimi-for-coding": {
maxTokens: 32_000,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: true,
supportsReasoningBudget: true,
supportsReasoningEffort: true,
inputPrice: 0.6, // $0.60 per million tokens (cache miss)
outputPrice: 2.5, // $2.50 per million tokens
cacheWritesPrice: 0, // $0 per million tokens (cache miss)
cacheReadsPrice: 0.15, // $0.15 per million tokens (cache hit)
preserveReasoning: true,
supportsNativeTools: true,
description: `Kimi for coding`,
},
"kimi-k2-0711-preview": {
maxTokens: 32_000,
contextWindow: 131_072,
Expand Down Expand Up @@ -45,6 +60,21 @@ export const moonshotModels = {
cacheReadsPrice: 0.6, // $0.60 per million tokens (cache hit)
description: `Kimi K2 Turbo is a high-speed version of the state-of-the-art Kimi K2 mixture-of-experts (MoE) language model, with the same 32 billion activated parameters and 1 trillion total parameters, optimized for output speeds of up to 60 tokens per second, peaking at 100 tokens per second.`,
},

"kimi-k2-thinking-turbo": {
maxTokens: 32_000,
contextWindow: 262144,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 1.15, // $1.15 per million tokens (cache miss)
outputPrice: 8.0, // $8.00 per million tokens
cacheWritesPrice: 0, // $0 per million tokens (cache miss)
cacheReadsPrice: 0.15, // $0.15 per million tokens (cache hit)
supportsNativeTools: true,
preserveReasoning: true,
defaultTemperature: 1.0,
description: `High-speed version of kimi-k2-thinking, suitable for scenarios requiring both deep reasoning and extremely fast responses`,
},
"kimi-k2-thinking": {
maxTokens: 16_000, // Recommended ≥ 16,000
contextWindow: 262_144, // 262,144 tokens
Expand Down
3 changes: 3 additions & 0 deletions webview-ui/src/components/settings/providers/Moonshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const Moonshot = ({ apiConfiguration, setApiConfigurationField }: Moonsho
<VSCodeOption value="https://api.moonshot.cn/v1" className="p-2">
api.moonshot.cn
</VSCodeOption>
<VSCodeOption value="https://api.kimi.com/coding/v1" className="p-2">
api.kimi.com/coding/v1
</VSCodeOption>
</VSCodeDropdown>
</div>
<div>
Expand Down
Loading