fix: strip Claude Code attribution from non-Anthropic translations
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
const claudeCodeAttributionSystemPrefix = "x-anthropic-billing-header:"
|
||||
|
||||
// IsClaudeCodeAttributionSystemText reports whether text is the Claude Code
|
||||
// attribution block that carries per-request billing and prompt fingerprint data.
|
||||
func IsClaudeCodeAttributionSystemText(text string) bool {
|
||||
text = strings.TrimLeftFunc(text, unicode.IsSpace)
|
||||
return strings.HasPrefix(text, claudeCodeAttributionSystemPrefix)
|
||||
}
|
||||
Reference in New Issue
Block a user