MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / normalize_anthropic_system

Function normalize_anthropic_system

server/src/server/http_server.cpp:691–699  ·  view source on GitHub ↗

Normalize Anthropic's `system` field (top-level on /v1/messages and /v1/messages/count_tokens) into a leading `{role:"system", content:...}` entry on `messages`. Accepts either a flat string or an array of typed blocks (`[{type:"text", text:"..."}]`), and strips any `x-anthropic-billing-header:`-prefixed block injected by Claude Code so it never reaches the model or the token counter. Side-effect

Source from the content-addressed store, hash-verified

689 std::string speculative_mode;
690 if (pflash_enabled) speculative_mode = "pflash";
691 else if (config.speculative_enabled) speculative_mode = "dflash";
692 else speculative_mode = "off";
693
694 // Spec §4.2: the five-tier vocabulary (low | medium | high | x-high | max)
695 // all activate the phase-1 envelope. Advertise the full set when the
696 // arch supports reasoning so clients can negotiate the higher tiers.
697 json reasoning_efforts = json::array();
698 if (reasoning_supported) {
699 reasoning_efforts.push_back("low");
700 reasoning_efforts.push_back("medium");
701 reasoning_efforts.push_back("high");
702 reasoning_efforts.push_back("x-high");

Callers 1

route_requestMethod · 0.70

Calls 2

emptyMethod · 0.45

Tested by

no test coverage detected