Documentation Index
Fetch the complete documentation index at: https://docs.requesty.ai/llms.txt
Use this file to discover all available pages before exploring further.
What are Analytics Headers?
Analytics headers are customX-Requesty-* HTTP headers you attach to your API requests. Requesty captures them, strips them before forwarding to the AI provider, and makes them available as dimensions in your analytics dashboards.
They are the simplest way to add metadata to requests β no SDK changes, no request body modifications. Just set an HTTP header.
How It Works
- Add one or more
X-Requesty-*headers to your request. - Requesty extracts the headers and removes them before forwarding to the AI provider β no data leaks upstream.
- The header values are stored as custom metadata fields on the request.
- In analytics, filter or Group By those fields to slice your data any way you want.
Header matching is case-insensitive β
x-requesty-team, X-REQUESTY-TEAM, and X-Requesty-Team are all treated the same.Naming Your Headers
Any header matching theX-Requesty-<Name> pattern is captured. The <Name> part (after the prefix) becomes the field key in analytics.
| Header | Analytics field |
|---|---|
X-Requesty-Agent | Agent |
X-Requesty-Branch | Branch |
X-Requesty-Environment | Environment |
X-Requesty-Team | Team |
X-Requesty-Customer | Customer |
Use Cases
Name your AI agent
Give each agent or bot a distinct identity so you can track cost and usage per agent:Agent to see a cost and request breakdown per agent.
Track by environment
Separate production traffic from development and staging:Track by team or department
Attribute AI costs to the team that generated them:Track by customer
If youβre building AI features for multiple customers, tag each request:Track git context
Tag requests with the branch and repo to see which feature branches are driving cost:Implementation Examples
Python (OpenAI SDK)
Node.js (OpenAI SDK)
cURL
Claude Code (automatic)
Install the Requesty analytics wrapper and every Claude Code session automatically sends:| Header | Value |
|---|---|
X-Requesty-Branch | Current git branch |
X-Requesty-Repo | org/repo from git origin |
X-Requesty-Ai-Agent | Claude Code version |
X-Requesty-User | OS username |
Viewing in Dashboards
Once you start sending analytics headers, the fields appear in the Analytics dashboard:- Open the Advanced tab.
- In the Group By dropdown, select your custom field (e.g.,
Agent,Environment,Team). - Choose a Metric (Cost, Requests, Tokens, Latency, etc.) and a Time Range.
- Optionally add Filters to narrow down (e.g.,
Agent=support-bot).
Agent and filter by model = anthropic/* to see which agents use Anthropic models the most.
Analytics Headers vs. Request Metadata
Requesty supports two ways to attach custom metadata:| Analytics Headers | Request Metadata | |
|---|---|---|
| How | X-Requesty-* HTTP headers | requesty field in the request body |
| Best for | Infrastructure-level tags (agent, branch, environment) that are set once | Application-level context (user ID, trace ID, tags) that vary per request |
| SDK changes | None β set default_headers once | Requires extra_body or body modification per request |
| Supports arrays | No β single string values only | Yes β tags is an array |
Supports user_id / trace_id | No β use Request Metadata for these | Yes |
X-Requesty-Agent and X-Requesty-Environment as default headers, and add per-request user_id and tags via the request body.
Privacy & Security
- Analytics headers are stripped from the request before it is forwarded to the AI provider. The provider never sees them.
- Header values are stored as metadata alongside the request log in your Requesty organization β visible only to your team.
- Do not put sensitive data (passwords, tokens, PII) in analytics headers.
Related
- Request Metadata β Body-based metadata with
user_id,trace_id, andtags - Usage Analytics β Dashboard overview and filtering
- Cost Tracking β Cost breakdowns by any dimension
- Claude Code Analytics β Automatic header tagging for Claude Code