(body: &mut Value)
| 504 | ]; |
| 505 | |
| 506 | fn normalize_claudecode_sampling(body: &mut Value) { |
| 507 | let Some(map) = body.as_object_mut() else { |
| 508 | return; |
| 509 | }; |
| 510 | |
| 511 | let tolerant = map.get("model").and_then(Value::as_str).is_some_and(|m| { |
| 512 | SAMPLING_TOLERANT_MODELS |
| 513 | .iter() |
| 514 | .any(|&prefix| m.starts_with(prefix)) |
| 515 | }); |
| 516 | |
| 517 | if tolerant { |
| 518 | if map.contains_key("temperature") { |
| 519 | map.remove("top_p"); |
| 520 | } |
| 521 | } else { |
| 522 | map.remove("temperature"); |
| 523 | map.remove("top_p"); |
| 524 | map.remove("top_k"); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | fn apply_claudecode_metadata_user_id(body: &mut Value, credential: &CredentialConfig) { |
| 529 | canonicalize_claude_body(body); |
no outgoing calls