OhMyGPT

App Attribution

Name your app on each request so you can break usage down by app.

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.

HeaderStored asValue
HTTP-Refererapp_urlYour app's URL. Must start with https:// or http://.
X-OhMyGPT-Titleapp_titleYour app's name.
X-OhMyGPT-Categoriesapp_categoriesFree 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.

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:

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"},
)

Usage by app

GET /v1/usage returns the values in each record's labels and filters by them:

curl "https://api.ohmygpt.com/v1/usage?app_title=Example%20App&limit=1" \
  -H "Authorization: Bearer $OHMYGPT_API_KEY"
[
  {
    "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.

On this page