Version: seafile-ai 13.0.10 and 14.0.8-testing, Seafile Pro 13.0.28, SEAFILE_AI_LLM_TYPE=anthropic
Problem: with any recent Claude model (claude-sonnet-5-5, claude-opus-5-5, and every model since Opus 4.7), every AI call (description, tags, summary, OCR via LLM) fails with:
litellm.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` is deprecated for this model."}}
Cause: seafile_ai/utils/llm_api.py (line 50 in 13.0.10, line 80 in 14.0.8-testing) always injects a default temperature:
if 'temperature' not in kwargs:
kwargs['temperature'] = 0
Anthropic removed sampling parameters (temperature, top_p, top_k) starting with Claude Opus 4.7 and rejects them with a 400. LiteLLM’s drop_params does not help, because LiteLLM still lists temperature as supported for these models (BerriAI/litellm#26444). So no environment variable can work around it. In 14.0.8-testing only GPT-5 has an exception (temperature = 1).
Verified: using the LiteLLM bundled in each image (1.76.3 in 13.0.10, 1.83.14 in 14.0.8-testing), the request fails with temperature=0 and succeeds without it, for both claude-sonnet-5-5 and claude-opus-5-5. Older models such as claude-sonnet-4-6 still accept it.
Suggested fix: either don’t send temperature unless the admin sets it explicitly (e.g. a SEAFILE_AI_LLM_TEMPERATURE env variable, empty = not sent), or skip the default for models that reject it. This is the same fix many other projects have shipped (mem0, AnythingLLM, Blinko, deepeval…).
Related, for 14.0: image_tags / doc_tags now use json_mode=True and then json.loads(result). With Anthropic, response_format: json_object is not enforced, and in my test claude-opus-5-5 wrapped its answer in a Markdown code fence (```json ... ```), which would make json.loads fail. Stripping code fences before parsing (or using a JSON schema / structured output) would make this robust.
Thanks!