Opus finding
AnthropicProvider sanitizeMessages rejects empty strings but also rejects whitespace-only valid messages; resolveModel uses untyped 'effort in MODELS'
lowapi-contractmedium
- src/providers/anthropic.ts:51-65
- src/providers/anthropic.ts:68-71
(1) `effort in MODELS` permits any object-prototype key like 'toString' or 'constructor' which would return a non-model string. Use Object.prototype.hasOwnProperty.call(MODELS, effort) or a switch. (2) Trimming user messages mutates input invisibly; an assistant message of literally ' ' is rejected but a code-fenced message with leading whitespace gets stripped of its formatting. Minor but inconsistent with non-Anthropic provider which does no sanitization.
Recommendation
Use hasOwnProperty/safe lookup; do not trim content silently — validate without mutating.