Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/types/src/providers/groq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const groqModels = {
description: "DeepSeek R1 Distill Llama 70B model, 128K context.",
},
"moonshotai/kimi-k2-instruct": {
maxTokens: 8192,
maxTokens: 16384,
contextWindow: 131072,
supportsImages: false,
supportsPromptCache: false,
Expand Down
10 changes: 8 additions & 2 deletions src/api/providers/base-openai-compatible-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
): ApiStream {
const {
id: model,
info: { maxTokens: max_tokens },
info: { maxTokens: modelMaxTokens },
} = this.getModel()

const temperature = this.options.modelTemperature ?? this.defaultTemperature

// Ensure max_tokens doesn't exceed the model's configured limit
// Users can override with modelMaxTokens, but it should not exceed the model's actual API limit
const userMaxTokens = this.options.modelMaxTokens
const max_tokens =
typeof userMaxTokens === "number" && userMaxTokens > 0 && typeof modelMaxTokens === "number"
? Math.min(userMaxTokens, modelMaxTokens)
: modelMaxTokens
const params: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
model,
max_tokens,
Expand Down