(fingerprint: string)
| 66 | * this token to gate features like fast mode. |
| 67 | */ |
| 68 | export 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 | } |
no test coverage detected