diff --git a/backend/internal/service/gateway_billing_block.go b/backend/internal/service/gateway_billing_block.go index 8d209f43bf..0a5128835a 100644 --- a/backend/internal/service/gateway_billing_block.go +++ b/backend/internal/service/gateway_billing_block.go @@ -3,7 +3,6 @@ package service import ( "crypto/sha256" "encoding/hex" - "encoding/json" "fmt" "github.com/tidwall/gjson" @@ -71,11 +70,11 @@ func extractFirstUserText(body []byte) string { return first } -// buildBillingAttributionBlockJSON 构造 system 数组的 billing attribution block。 +// buildBillingAttributionText 构造 system 数组的 billing attribution 文本。 // // 形态严格对齐真实 Claude Code CLI: // -// {"type":"text","text":"x-anthropic-billing-header: cc_version=2.1.161.{fp}; cc_entrypoint=cli; cch=00000;"} +// x-anthropic-billing-header: cc_version=2.1.161.{fp}; cc_entrypoint=cli; cch=00000; // // cch=00000 是签名占位符,由 signBillingHeaderCCH 在 buildUpstreamRequest 阶段 // 替换为基于完整 body 的 xxhash64 5 位十六进制摘要。 @@ -92,14 +91,3 @@ func buildBillingAttributionText(body []byte, cliVersion string) (string, error) cliVersion, fp, ), nil } - -func buildBillingAttributionBlockJSON(body []byte, cliVersion string) ([]byte, error) { - text, err := buildBillingAttributionText(body, cliVersion) - if err != nil { - return nil, err - } - return json.Marshal(map[string]string{ - "type": "text", - "text": text, - }) -}