本文件尚未翻譯成繁體中文,現顯示英文原文。

App attribution

Identifying your app with `HTTP-Referer` and `X-Title`

When one key serves several apps, usage records alone cannot tell you which app spent what. Two optional headers fix that.

HeaderValueRecorded as
HTTP-RefererYour app's URL (https://example.com)usage_records.http_referer
X-TitleYour app's name (My Example App)usage_records.app_title

Both are optional. Requests work exactly the same, and cost exactly the same, without them.

Sending them

curl https://openrouter.myip.co.kr/api/v1/chat/completions \
  -H "Authorization: Bearer $MYIP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "HTTP-Referer: https://example.com" \
  -H "X-Title: My Example App" \
  -d '{
    "model": "google/gemma-4-26b-a4b",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Set them once as default headers on the client and every request from that client carries them.

Header aliases

We accept three names for the title header. If more than one arrives, this is the precedence:

  1. X-OpenRouter-Title
  2. X-MyIP-Title
  3. X-Title

The aliases exist so that code written for openrouter.ai keeps working unchanged. For new code, use X-Title.

If HTTP-Referer is absent we fall back to the standard Referer header, which browsers set automatically — so a browser-mediated setup may populate it without you doing anything.

What it is used for

  • It stays on the usage record, so a request's origin is traceable.
  • You can read it back yourself from GET /api/v1/generation.
  • It pins down which app a problem came from when you contact support.
bash
curl -s "https://openrouter.myip.co.kr/api/v1/generation?id=$GEN_ID" \
  -H "Authorization: Bearer $MYIP_API_KEY" | jq '{origin, http_referer, user_agent}'
json
{
  "origin": "https://example.com",
  "http_referer": "https://example.com",
  "user_agent": "OpenAI/Python 1.x"
}

Nothing is published

The app name and URL you send are not visible to other users, and they do not enrol you in any public app ranking. They exist to organise your own account's usage records.

The rankings shown on the site's Apps page come from a separate, externally sourced dataset and have nothing to do with the headers you send.

Turning it off

The request metadata toggle at /settings/privacy stops HTTP-Referer, X-Title, and User-Agent from being kept on usage records. It defaults to on.

Turning it off does not affect token counts, cost, model, or timing — those are recorded regardless, because billing needs them. See Data collection.

Not forwarded upstream

HTTP-Referer and X-Title stay on our usage records; we do not pass them to external providers. An internal system name in your app title is not exposed to third parties. They are stored in our database, though, so if the values themselves are sensitive, either turn the toggle off or generalise them.

Practical tips

  • Separate environmentsX-Title: My App (staging) keeps development traffic distinguishable from production.
  • Keep Referer a URL — give it a scheme and host; put free-form text in the title header instead.
  • Separate keys are stronger — issuing one API key per app lets you track and cap spend per app directly through GET /api/v1/key. Per-key limits are covered in Limits and 402.

最後更新於 2026年9月5日