Skip to main content

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?

Requesty supports two kinds of analytics headers:
  1. Origin headers β€” HTTP-Referer and X-Title identify which app or tool is making the request. Set them once and every request is automatically tagged.
  2. Custom analytics headers β€” X-Requesty-* headers let you attach arbitrary metadata (agent name, branch, team, environment, etc.) to requests.
Both types are captured by Requesty, stripped before forwarding to the AI provider, and made available as dimensions in your analytics dashboards. They are the simplest way to add metadata β€” no SDK changes, no request body modifications. Just set an HTTP header.
curl https://router.requesty.ai/v1/chat/completions \
  -H "Authorization: Bearer $REQUESTY_API_KEY" \
  -H "HTTP-Referer: https://yourapp.com" \
  -H "X-Title: My App" \
  -H "X-Requesty-Agent: my-support-bot" \
  -H "X-Requesty-Environment: production" \
  -H "X-Requesty-Team: platform" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-5",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Origin Headers β€” HTTP-Referer & X-Title

Requesty recognizes two standard origin headers that identify where a request comes from:
HeaderStored asPurpose
HTTP-Refererorigin_refererYour site or app URL (e.g., https://yourapp.com)
X-Titleorigin_titleA human-readable app name (e.g., My App)
These headers are optional but recommended. Add them once via default_headers and every request is tagged automatically. Many integrations set them for you β€” for example, Cline, Roo Code, Claude Code, and Open WebUI all send their own HTTP-Referer and X-Title values so you can filter traffic by tool in your dashboards.
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_REQUESTY_API_KEY",
    base_url="https://router.requesty.ai/v1",
    default_headers={
        "HTTP-Referer": "https://yourapp.com",
        "X-Title": "My App",
    },
)
In analytics, filter or Group By origin_title to break down usage by app, or by origin_referer to see traffic by URL.

Custom Analytics Headers β€” X-Requesty-*

How It Works

  1. Add one or more X-Requesty-* headers to your request.
  2. Requesty extracts the headers and removes them before forwarding to the AI provider β€” no data leaks upstream.
  3. The header values are stored as custom metadata fields on the request.
  4. 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 the X-Requesty-<Name> pattern is captured. The <Name> part (after the prefix) becomes the field key in analytics.
HeaderAnalytics field
X-Requesty-AgentAgent
X-Requesty-BranchBranch
X-Requesty-EnvironmentEnvironment
X-Requesty-TeamTeam
X-Requesty-CustomerCustomer
You can use any name you like β€” there is no fixed list. Pick names that match the dimensions you care about.

Use Cases

Name your AI agent

Give each agent or bot a distinct identity so you can track cost and usage per agent:
-H "X-Requesty-Agent: support-bot"
-H "X-Requesty-Agent: code-reviewer"
-H "X-Requesty-Agent: data-pipeline"
Then in the Advanced analytics tab, Group By β†’ Agent to see a cost and request breakdown per agent.

Track by environment

Separate production traffic from development and staging:
-H "X-Requesty-Environment: production"

Track by team or department

Attribute AI costs to the team that generated them:
-H "X-Requesty-Team: backend"
-H "X-Requesty-Department: engineering"

Track by customer

If you’re building AI features for multiple customers, tag each request:
-H "X-Requesty-Customer: acme-corp"

Track git context

Tag requests with the branch and repo to see which feature branches are driving cost:
-H "X-Requesty-Branch: feat/new-onboarding"
-H "X-Requesty-Repo: myorg/backend"
The Claude Code analytics wrapper does this automatically β€” it tags every request with your current git branch, repo, agent version, and OS username.

Implementation Examples

Python (OpenAI SDK)

import openai

client = openai.OpenAI(
    api_key="YOUR_REQUESTY_API_KEY",
    base_url="https://router.requesty.ai/v1",
    default_headers={
        "X-Requesty-Agent": "my-support-bot",
        "X-Requesty-Environment": "production",
    }
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Hello"}]
)

Node.js (OpenAI SDK)

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_REQUESTY_API_KEY",
  baseURL: "https://router.requesty.ai/v1",
  defaultHeaders: {
    "X-Requesty-Agent": "my-support-bot",
    "X-Requesty-Environment": "production",
  },
});

const response = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-4-5",
  messages: [{ role: "user", content: "Hello" }],
});

cURL

curl https://router.requesty.ai/v1/chat/completions \
  -H "Authorization: Bearer $REQUESTY_API_KEY" \
  -H "X-Requesty-Agent: my-support-bot" \
  -H "X-Requesty-Environment: production" \
  -H "X-Requesty-Team: backend" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4.1",
    "messages": [{"role": "user", "content": "Summarize this document"}]
  }'

Claude Code (automatic)

Install the Requesty analytics wrapper and every Claude Code session automatically sends:
HeaderValue
X-Requesty-BranchCurrent git branch
X-Requesty-Repoorg/repo from git origin
X-Requesty-Ai-AgentClaude Code version
X-Requesty-UserOS username
curl -fsSL https://www.requesty.ai/claude/install.sh | bash
See Claude Code Analytics for details.

Viewing in Dashboards

Once you start sending analytics headers, the fields appear in the Analytics dashboard:
  1. Open the Advanced tab.
  2. In the Group By dropdown, select your custom field (e.g., Agent, Environment, Team).
  3. Choose a Metric (Cost, Requests, Tokens, Latency, etc.) and a Time Range.
  4. Optionally add Filters to narrow down (e.g., Agent = support-bot).
You can combine analytics headers with any other grouping or filter β€” for example, group by Agent and filter by model = anthropic/* to see which agents use Anthropic models the most.
Establish naming conventions for your analytics headers across your organization. Consistent names like X-Requesty-Team, X-Requesty-Environment, and X-Requesty-Agent make dashboards easy to read for everyone.

Analytics Headers vs. Request Metadata

Requesty supports three ways to attach metadata:
Origin HeadersCustom Analytics HeadersRequest Metadata
HeadersHTTP-Referer, X-TitleX-Requesty-*requesty field in the request body
Best forIdentifying the app or tool making requestsInfrastructure-level tags (agent, branch, environment)Application-level context (user ID, trace ID, tags) that vary per request
SDK changesNone β€” set default_headers onceNone β€” set default_headers onceRequires extra_body or body modification per request
Supports arraysNoNo β€” single string values onlyYes β€” tags is an array
Supports user_id / trace_idNoNo β€” use Request Metadata for theseYes
All three methods can be used together. For example, set HTTP-Referer and X-Title to identify your app, X-Requesty-Agent and X-Requesty-Environment for infrastructure tags, 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.
Last modified on May 4, 2026