mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge pull request #9997 from Kilo-Org/fix/drop-max-tokens-gpt5-openai-compatible
fix(cli): drop max_tokens for gpt-5 models on @ai-sdk/openai-compatible
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Fix gpt-5 models failing with `Unsupported parameter: max_tokens` when accessed through custom OpenAI-compatible providers such as LiteLLM.
|
||||
@@ -186,7 +186,14 @@ const live: Layer.Layer<
|
||||
: undefined,
|
||||
topP: input.agent.topP ?? ProviderTransform.topP(input.model),
|
||||
topK: ProviderTransform.topK(input.model),
|
||||
maxOutputTokens: ProviderTransform.maxOutputTokens(input.model),
|
||||
// kilocode_change start - gpt-5 via @ai-sdk/openai-compatible proxies (e.g. LiteLLM)
|
||||
// rejects `max_tokens`; OpenAI requires `max_completion_tokens` and the compatible
|
||||
// SDK cannot rename the field, so drop the cap and let the upstream default apply.
|
||||
maxOutputTokens:
|
||||
input.model.api.npm === "@ai-sdk/openai-compatible" && input.model.api.id.toLowerCase().includes("gpt-5")
|
||||
? undefined
|
||||
: ProviderTransform.maxOutputTokens(input.model),
|
||||
// kilocode_change end
|
||||
options,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user