CLIProxyAPI icon indicating copy to clipboard operation
CLIProxyAPI copied to clipboard

invalid_request_error","message":"`max_tokens` must be greater than `thinking.budget_tokens`.

Open RezaRashidi opened this issue 1 year ago • 7 comments

Duplicate PR

#340

wait, I still got this error when using kilocode with the latest commit

OpenAI completion error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"max_tokens must be greater than thinking.budget_tokens. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking#max-tokens-and-context-window-size"},"request_id":"req_vrtx_011CVY6Kd4nhjQfgPQKNCvb1"}

Originally posted by @huynguyen03dev in https://github.com/router-for-me/CLIProxyAPI/issues/348#issuecomment-3584742137

RezaRashidi avatar Dec 03 '25 22:12 RezaRashidi

You should attach the request log here.

luispater avatar Dec 04 '25 09:12 luispater

================

[2025-12-04 15:34:36] [info] [service.go:543] file watcher started for config and auth directory changes
[2025-12-04 15:34:36] [info] [service.go:549] core auth auto-refresh started (interval=15m0s)
[2025-12-04 15:34:37] [debug] [updater.go:235] management asset is already up to date
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-claude-sonnet-4-5 from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-3-pro-preview from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-3-pro-image-preview from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-claude-sonnet-4-5-thinking from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-2.5-flash-image from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-2.5-computer-use-preview-10-2025 from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-2.5-flash from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gemini-2.5-flash-lite from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model gpt-oss-120b-medium from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:334] Registered new model claude-opus-4-5-thinking from provider antigravity
[2025-12-04 15:34:37] [debug] [model_registry.go:166] Registered client antigravity-**********_gmail_com.json from provider antigravity with 10 models
[2025-12-04 15:34:37] [debug] [credentials.go:25] -------------------------------------------------------------------
[2025-12-04 15:34:41] [debug] [manager.go:477] Use OAuth **********@gmail.com for model gemini-claude-sonnet-4-5-thinking
[2025-12-04 15:34:44] [warning] [gin_logger.go:56] [GIN] 2025/12/04 - 15:34:44 | 400 |        2.681s |       127.0.0.1 | POST    "/v1/chat/completions"

=================== in kilo code with openai protocol API Request Failed

OpenAI completion error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"max_tokens must be greater than thinking.budget_tokens. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking#max-tokens-and-context-window-size"},"request_id":"req_vrtx_011CVmcfqTmNAYjCiLKhsMVB"}

RezaRashidi avatar Dec 04 '25 12:12 RezaRashidi

with gemini protocol its works but not thinking

RezaRashidi avatar Dec 04 '25 12:12 RezaRashidi

My pr resolves this issue in Kilo Code just fine, and the thinking block also shows up correctly

huynguyen03dev avatar Dec 04 '25 12:12 huynguyen03dev

@huynguyen03dev The thinking block isn't appearing

Image

RezaRashidi avatar Dec 04 '25 12:12 RezaRashidi

You tried the code from my pr and the thinking block still not showing ?

Im using this branch https://github.com/huynguyen03dev/CLIProxyAPI/tree/huynguyen03dev and the thinking block shows everytime

Image

huynguyen03dev avatar Dec 04 '25 13:12 huynguyen03dev

thank you my mistake Im using main branch

RezaRashidi avatar Dec 04 '25 13:12 RezaRashidi