MCPcopy Create free account
hub / github.com/freecodexyz/free-code / getAttributionHeader

Function getAttributionHeader

src/constants/system.ts:68–89  ·  view source on GitHub ↗
(fingerprint: string)

Source from the content-addressed store, hash-verified

66 * this token to gate features like fast mode.
67 */
68export function getAttributionHeader(fingerprint: string): string {
69 if (!isAttributionHeaderEnabled()) {
70 return ''
71 }
72
73 const version = `${MACRO.VERSION}.${fingerprint}`
74 const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? 'unknown'
75
76 const cch = ' cch=00000;'
77 // cc_workload: turn-scoped hint so the API can route e.g. cron-initiated
78 // requests to a lower QoS pool. Absent = interactive default. Safe re:
79 // fingerprint (computed from msg chars + version only, line 78 above) and
80 // cch attestation (placeholder overwritten in serialized body bytes after
81 // this string is built). Server _parse_cc_header tolerates unknown extra
82 // fields so old API deploys silently ignore this.
83 const workload = getWorkload()
84 const workloadPair = workload ? ` cc_workload=${workload};` : ''
85 const header = `x-anthropic-billing-header: cc_version=${version}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`
86
87 logForDebugging(`attribution header ${header}`)
88 return header
89}

Callers 2

sideQueryFunction · 0.85
queryModelFunction · 0.85

Calls 3

getWorkloadFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected