From dc4dbb4cffb5358650fadfc7424b06649bdcecd4 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sun, 2 Nov 2025 15:47:26 +0800 Subject: [PATCH] max_tokens must be an integer --- routstr/proxy.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/routstr/proxy.py b/routstr/proxy.py index 1d0013ec..55c7aad7 100644 --- a/routstr/proxy.py +++ b/routstr/proxy.py @@ -333,10 +333,15 @@ def parse_request_body_json(request_body: bytes, path: str) -> dict[str, Any]: request_body_dict = json.loads(request_body) if "max_tokens" in request_body_dict: - raise HTTPException( - status_code=400, - detail={"error": "max_tokens must be an integer (without quotes)"}, - ) + max_tokens_value = request_body_dict["max_tokens"] + + if isinstance(max_tokens_value, int): + pass + else: + raise HTTPException( + status_code=400, + detail={"error": "max_tokens must be an integer"}, + ) logger.debug( "Request body parsed",