Attribution
Every request through TokenSense is tagged with metadata that lets you trace cost back to the workflow, the step within that workflow, and the specific execution. This is how you answer "which automation spent $47 last Tuesday."
Three levels of attribution
workflow_tag— identifies which workflow/automation made the request (e.g., "lead-qualifier" or "support-triage")step— identifies which step within the workflow (e.g., "classify-intent" or "generate-response")execution_id— identifies the specific run, so you can trace costs to a single execution
Where attribution comes from
| Tool | workflow_tag | step | execution_id |
|---|---|---|---|
| n8n (TokenSense node) | Automatic | Automatic | Automatic |
| Make / Zapier | Manual (body metadata) | Tool-dependent | Tool-dependent |
| Code / cURL | Manual (body metadata) | Manual (body metadata) | Manual (body metadata) |
Why attribution matters
Per-client billing (agencies)
When you run workflows for multiple clients, attribution lets you report exact AI spend per client — no guesswork, no allocation formulas. Bill back what each client actually consumed.
Per-step optimization (solo builders)
Step-level attribution shows which part of your workflow is expensive. If your "summarize" step costs 10× more than "classify," you know where to optimize — swap the model, reduce the prompt, or cache results.
Per-department reports (ops teams)
Generate cost reports by team, department, or business unit. Finance gets the breakdown they need without manual spreadsheet work.
How to set workflow_tag in your tool
n8n (automatic)
The TokenSense n8n node sets workflow_tag, step, and execution_id automatically from the workflow context. No configuration needed — just add the node and it works.
Make / Zapier (manual body metadata)
Add a metadata object to your JSON request body:
{
"model": "gpt-4o",
"messages": [...],
"metadata": {
"workflow_tag": "my-workflow-name"
}
}Code / cURL (body metadata)
curl https://api.tokensense.io/v1/chat/completions \
-H "Authorization: Bearer ts_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [...],
"metadata": {
"workflow_tag": "lead-qualifier",
"step": "classify-intent",
"execution_id": "exec_abc123"
}
}'