feat: Add Kimi K2 0905 model to Groq, Moonshot, and Fireworks providers (#7693)

This commit is contained in:
Daniel 2025-09-04 22:57:39 -05:00 • committed by GitHub
parent 146d849ede
commit 4ad1a26492
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 11 deletions

View file

@ -2,6 +2,7 @@ import type { ModelInfo } from "../model.js"
export type FireworksModelId =
| "accounts/fireworks/models/kimi-k2-instruct"
| "accounts/fireworks/models/kimi-k2-instruct-0905"
| "accounts/fireworks/models/qwen3-235b-a22b-instruct-2507"
| "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct"
| "accounts/fireworks/models/deepseek-r1-0528"
@ -12,9 +13,20 @@ export type FireworksModelId =
| "accounts/fireworks/models/gpt-oss-20b"
| "accounts/fireworks/models/gpt-oss-120b"
export const fireworksDefaultModelId: FireworksModelId = "accounts/fireworks/models/kimi-k2-instruct"
export const fireworksDefaultModelId: FireworksModelId = "accounts/fireworks/models/kimi-k2-instruct-0905"
export const fireworksModels = {
"accounts/fireworks/models/kimi-k2-instruct-0905": {
maxTokens: 16384,
contextWindow: 262144,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.6,
outputPrice: 2.5,
cacheReadsPrice: 0.15,
description:
"Kimi K2 model gets a new version update: Agentic coding: more accurate, better generalization across scaffolds. Frontend coding: improved aesthetics and functionalities on web, 3d, and other tasks. Context length: extended from 128k to 256k, providing better long-horizon support.",
},
"accounts/fireworks/models/kimi-k2-instruct": {
maxTokens: 16384,
contextWindow: 128000,

View file

@ -11,10 +11,11 @@ export type GroqModelId =
| "qwen/qwen3-32b"
| "deepseek-r1-distill-llama-70b"
| "moonshotai/kimi-k2-instruct"
| "moonshotai/kimi-k2-instruct-0905"
| "openai/gpt-oss-120b"
| "openai/gpt-oss-20b"
export const groqDefaultModelId: GroqModelId = "llama-3.3-70b-versatile" // Defaulting to Llama3 70B Versatile
export const groqDefaultModelId: GroqModelId = "moonshotai/kimi-k2-instruct-0905"
export const groqModels = {
// Models based on API response: https://api.groq.com/openai/v1/models
@ -100,6 +101,17 @@ export const groqModels = {
cacheReadsPrice: 0.5, // 50% discount for cached input tokens
description: "Moonshot AI Kimi K2 Instruct 1T model, 128K context.",
},
"moonshotai/kimi-k2-instruct-0905": {
maxTokens: 16384,
contextWindow: 262144,
supportsImages: false,
supportsPromptCache: true,
inputPrice: 0.6,
outputPrice: 2.5,
cacheReadsPrice: 0.15,
description:
"Kimi K2 model gets a new version update: Agentic coding: more accurate, better generalization across scaffolds. Frontend coding: improved aesthetics and functionalities on web, 3d, and other tasks. Context length: extended from 128k to 256k, providing better long-horizon support.",
},
"openai/gpt-oss-120b": {
maxTokens: 32766,
contextWindow: 131072,

View file

@ -18,15 +18,15 @@ export const moonshotModels = {
description: `Kimi K2 is a state-of-the-art mixture-of-experts (MoE) language model with 32 billion activated parameters and 1 trillion total parameters.`,
},
"kimi-k2-0905-preview": {
maxTokens: 32_000,
contextWindow: 262_144,
maxTokens: 16384,
contextWindow: 262144,
supportsImages: false,
supportsPromptCache: 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)
description: `Kimi K2 is a state-of-the-art mixture-of-experts (MoE) language model with 32 billion activated parameters and 1 trillion total parameters.`,
inputPrice: 0.6,
outputPrice: 2.5,
cacheReadsPrice: 0.15,
description:
"Kimi K2 model gets a new version update: Agentic coding: more accurate, better generalization across scaffolds. Frontend coding: improved aesthetics and functionalities on web, 3d, and other tasks. Context length: extended from 128k to 256k, providing better long-horizon support.",
},
"kimi-k2-turbo-preview": {
maxTokens: 32_000,

View file

@ -148,8 +148,8 @@ describe("MoonshotHandler", () => {
const model = handler.getModel()
expect(model.id).toBe(mockOptions.apiModelId)
expect(model.info).toBeDefined()
expect(model.info.maxTokens).toBe(32_000)
expect(model.info.contextWindow).toBe(262_144)
expect(model.info.maxTokens).toBe(16384)
expect(model.info.contextWindow).toBe(262144)
expect(model.info.supportsImages).toBe(false)
expect(model.info.supportsPromptCache).toBe(true) // Should be true now
})