Skip to content

Commit c6ddcc5

Browse files
committed
moonshot
1 parent b166d5c commit c6ddcc5

File tree

6 files changed

+90
-12
lines changed

6 files changed

+90
-12
lines changed

docs-website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@ai-sdk/google": "^2.0.14",
2727
"@ai-sdk/groq": "^2.0.19",
2828
"@ai-sdk/openai": "2.0.31",
29+
"@ai-sdk/openai-compatible": "^1.0.18",
2930
"@ai-sdk/provider": "2.0.0",
3031
"@cloudflare/vite-plugin": "^1.9.4",
3132
"@cloudflare/workers-types": "^4.20250712.0",

docs-website/src/lib/env.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export const env = {
3535
GITHUB_WEBHOOKS_SECRET: process.env.GITHUB_WEBHOOKS_SECRET,
3636
FIRECRAWL_API_KEY: process.env.FIRECRAWL_API_KEY,
3737
GOOGLE_SEARCH_API_KEY: process.env.GOOGLE_SEARCH_API_KEY,
38+
ZEN_API_KEY: process.env.ZEN_API_KEY,
39+
MOONSHOT_API_KEY: process.env.MOONSHOT_API_KEY,
3840
}
3941

4042
// console.log(env)

docs-website/src/lib/moonshot.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible'
3+
import { env } from './env'
4+
5+
export const moonshot = createOpenAICompatible({
6+
name: 'moonshot',
7+
apiKey: env.MOONSHOT_API_KEY,
8+
baseURL: 'https://api.moonshot.ai/v1',
9+
})

docs-website/src/lib/spiceflow-docs-app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ import { FileSystemEmulator } from 'website/src/lib/file-system-emulator'
3636
import { printDirectoryTree } from './directory-tree'
3737
import { createInvalidTool, INVALID_TOOL_NAME } from 'contesto/src/lib/invalid-tool'
3838
import { getHost } from './get-host'
39+
import { moonshot } from './moonshot';
3940

4041
const agentPromptTemplate = Handlebars.compile(agentPrompt)
4142

4243
// Create fallback model with groq as primary and gemini flash 2.5 as fallback
4344
let model: LanguageModelV2 = createFallback({
4445
models: [
45-
groq('moonshotai/kimi-k2-instruct-0905'),
46+
// groq('moonshotai/kimi-k2-instruct-0905'),
47+
moonshot('kimi-k2-0905-preview'),
4648
google('gemini-2.5-flash'),
4749
],
4850
onError: (error, modelId) => {

pnpm-lock.yaml

Lines changed: 71 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/src/lib/spiceflow-generate-message.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { groq } from '@ai-sdk/groq'
1212
import { deepinfra } from '@ai-sdk/deepinfra'
1313
import dedent from 'string-dedent'
1414
import { isDocsJson } from 'docs-website/src/lib/utils'
15+
import { moonshot } from 'docs-website/src/lib/moonshot'
1516
import { DOCS_JSON_BASENAME } from 'docs-website/src/lib/constants'
1617
import { OpenAIResponsesProviderOptions, openai, createOpenAI } from '@ai-sdk/openai'
1718
import { env, WEBSITE_DOMAIN } from 'docs-website/src/lib/env'
@@ -100,6 +101,7 @@ const baseten = createOpenAICompatible({
100101
},
101102
})
102103

104+
103105
/**
104106
* Generate the system message content for the AI
105107
*/
@@ -282,7 +284,8 @@ export type WebsiteTools = {
282284
// Create fallback model with groq as primary and gemini flash 2.5 as fallback
283285
let model: LanguageModelV2 = createFallback({
284286
models: [
285-
groq('moonshotai/kimi-k2-instruct-0905'),
287+
moonshot('kimi-k2-0905-preview'),
288+
// groq('moonshotai/kimi-k2-instruct-0905'),
286289
google('gemini-2.5-flash'),
287290
// togetherai('moonshotai/Kimi-K2-Instruct-0905'), // TODO together can't even parse tool calls
288291
// fireworks('accounts/fireworks/models/kimi-k2-instruct'), // TODO fireworks returns duplicate tool call ids.

0 commit comments

Comments
 (0)