claw-code/rust/crates/api/src
YeonGyu-Kim 523ce7474a fix(api): sanitize Anthropic body — strip frequency/presence_penalty, convert stop→stop_sequences
MessageRequest now carries OpenAI-compatible tuning params (c667d47), but
the Anthropic API does not support frequency_penalty or presence_penalty,
and uses 'stop_sequences' instead of 'stop'. Without this fix, setting
these params with a Claude model would produce 400 errors.

Changes to strip_unsupported_beta_body_fields:
- Remove frequency_penalty and presence_penalty from Anthropic request body
- Convert stop → stop_sequences (only when non-empty)
- temperature and top_p are preserved (Anthropic supports both)

Tests added:
- strip_removes_openai_only_fields_and_converts_stop
- strip_does_not_add_empty_stop_sequences

87 api lib tests passing, 0 failing.
cargo check --workspace: clean.
2026-04-08 09:05:10 +09:00
..
providers fix(api): sanitize Anthropic body — strip frequency/presence_penalty, convert stop→stop_sequences 2026-04-08 09:05:10 +09:00
client.rs chore: additional AI slop cleanup and enforcer wiring from sessions 1/5 2026-04-03 18:35:27 +09:00
error.rs fix(api): Windows env hint + .env file loading fallback 2026-04-07 14:22:41 +09:00
http_client.rs feat: b6-openai-models — batch 6 2026-04-07 15:52:30 +09:00
lib.rs feat: b6-pdf-extract-v2 follow-up work — batch 6 2026-04-07 16:11:51 +09:00
prompt_cache.rs feat(api): add tuning params (temperature, top_p, penalties, stop) to MessageRequest 2026-04-08 07:07:33 +09:00
sse.rs fix(api): enrich JSON parse errors with response body, provider, and model 2026-04-07 14:22:05 +09:00
types.rs feat(api): add tuning params (temperature, top_p, penalties, stop) to MessageRequest 2026-04-08 07:07:33 +09:00