From 29b983fe73431f9db037013219b4ba0fb95ca65e Mon Sep 17 00:00:00 2001 From: Ruslan Magana Vsevolodovna Date: Fri, 19 Jun 2026 10:40:05 +0200 Subject: [PATCH] Tokens Max for Antropic --- gitpilot/llm_provider.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitpilot/llm_provider.py b/gitpilot/llm_provider.py index 9df0108..2cae011 100644 --- a/gitpilot/llm_provider.py +++ b/gitpilot/llm_provider.py @@ -107,11 +107,15 @@ def build_llm() -> Any: if not model.startswith("anthropic/"): model = f"anthropic/{model}" + # Anthropic requires an explicit max_tokens; without it litellm falls + # back to a low default that truncates large single-file generations + # (e.g. a full self-contained game). Allow override via env. return _wrap_llm( LLM( model=model, api_key=api_key, base_url=base_url if base_url else None, + max_tokens=int(os.getenv("GITPILOT_MAX_TOKENS", "32000")), ), model, ) @@ -161,7 +165,7 @@ def build_llm() -> Any: base_url=base_url, project_id=project_id, # \u2190 CRITICAL: This was missing! temperature=0.3, # Default temperature - max_tokens=1024, # Default max tokens + max_tokens=int(os.getenv("GITPILOT_MAX_TOKENS", "4096")), ), model, )