# App Attribution (/docs/app-attribution)

Optional request headers name the app that sent a request. OhMyGPT stores them with the request, so when several apps or tools share an account you can tell their usage apart.

| Header | Stored as | Value |
|---|---|---|
| `HTTP-Referer` | `app_url` | Your app's URL. Must start with `https://` or `http://`. |
| `X-OhMyGPT-Title` | `app_title` | Your app's name. |
| `X-OhMyGPT-Categories` | `app_categories` | Free text, stored as sent, for example `cli-agent`. |

Apps already sending OpenRouter's headers need no change: `X-OpenRouter-Title` and `X-Title` count as `X-OhMyGPT-Title`, and `X-OpenRouter-Categories` as `X-OhMyGPT-Categories`. When several are present, the `X-OhMyGPT-*` header wins. The browser's standard `Referer` header is not read.

Values longer than 128 bytes are cut. An invalid value is dropped; the request itself never fails because of these headers.

```bash
curl https://api.ohmygpt.com/v1/chat/completions \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "HTTP-Referer: https://example.com" \
  -H "X-OhMyGPT-Title: Example App" \
  -H "X-OhMyGPT-Categories: cli-agent" \
  -d '{"model": "ohmygpt/mock", "messages": [{"role": "user", "content": "ping"}]}'
```

With the OpenAI SDKs, set the headers once on the client:

```python tab="Python"
client = OpenAI(
    base_url="https://api.ohmygpt.com/v1",
    api_key=os.environ["OHMYGPT_API_KEY"],
    default_headers={"HTTP-Referer": "https://example.com", "X-OhMyGPT-Title": "Example App"},
)
```

```ts tab="TypeScript"
const client = new OpenAI({
  baseURL: 'https://api.ohmygpt.com/v1',
  apiKey: process.env.OHMYGPT_API_KEY,
  defaultHeaders: { 'HTTP-Referer': 'https://example.com', 'X-OhMyGPT-Title': 'Example App' },
})
```

## Usage by app [#usage-by-app]

[`GET /v1/usage`](/docs/api/usage/listUsage) returns the values in each record's `labels` and filters by them:

```bash
curl "https://api.ohmygpt.com/v1/usage?app_title=Example%20App&limit=1" \
  -H "Authorization: Bearer $OHMYGPT_API_KEY"
```

```json
[
  {
    "request_id": "01a19b5d-8121-7575-9e9f-14208909f380",
    "time": "2026-11-02T08:26:00.185Z",
    "model": "ohmygpt/mock",
    "status": 200,
    "cost_credits": 0,
    "labels": {
      "app_url": "https://example.com",
      "app_title": "Example App",
      "app_categories": "cli-agent",
      "sdk_info": "curl/8.23.0"
    }
  }
]
```

`sdk_info` comes from the `User-Agent` header. To total cost per app, group the summary by label: [`GET /v1/usage/summary?group_by=label:app_title`](/docs/api/usage/getUsageSummary).
