Anatomy of an OpenRouter API request, traced to Activity

By Christophe Paka · Facts checked on 7 November 2026

You paste one curl command into a terminal. Text comes back, and it looks like it worked. But you sent an alias, not an exact model. So which model ran? Which provider served it, and what did it cost?

The text in your terminal does not say. The short answer: open Activity, the dashboard page that logs every request you send. It names the model, the provider and the cost.

The figure below maps each part of an OpenRouter API request to the trace it leaves in Activity.

Left, a request: an Authorization line with a Bearer key, a model alias, a messages list, and two app headers. Right, the Activity log: key used, model and provider that answered, cost, and app name.
Figure 3.2 Every part of a request leaves a trace in Activity: the key, the model and provider, the cost and your app's name.
Use this diagram on your site

Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.

How to read this figure

  1. Start with the Authorization line. The first line is a header: a labeled line sent along with the request. It reads Bearer, a space, then your API key. It proves the request is yours, and Activity shows which key was used. Give each app its own key, so you can tell them apart.

  2. Read the model line. The model field names a model. Here it is ~openai/gpt-sol-latest. The tilde (~) marks an alias: a nickname that always points to the newest model of a family, here OpenAI's Sol. When a new version ships, the alias moves to it. The response names the exact model that ran; Activity adds the provider that answered.

  3. Follow the messages to the reply. The messages list carries your prompt, one turn at a time. Each turn has a role, such as user, and its content. The answer comes back in the choices list of the response. A usage block in the same response holds the token counts and the cost.

  4. Look at the two app headers. Only code that calls the API sends these two lines; if you only chat, skip this step. HTTP-Referer gives your app's web address, and X-OpenRouter-Title its name. They put your app on OpenRouter's public app pages. Leave them out and the request runs and bills the same.

  5. Check the Activity panel on the right. Match each part of the request to its trace: the key to Key used, the model to Model + provider, the two app headers to App name. The messages have no row of their own; the cost row prices the whole request. Activity also totals and exports your spend. Why the provider matters: see why the same model differs by provider.

Key takeaways

  • Open Activity after every first request and read the model, the provider and the cost.
  • Send the app headers only when you want a public app page; a private script can skip both.
  • Give every key its own credit limit and keep it in an environment variable, never in a shared file.

Worked example: four apps and the headers each one sends

The two app headers are optional, so the question is when to send them. Here are four kinds of app, and what each one gets.

  1. A private script for one shop sends neither header. It runs and bills as before, and nothing about it goes public.
  2. A public app at its own URL sends HTTP-Referer, plus X-OpenRouter-Title for its name. It gets an app page, listed in the public rankings.
  3. An app on localhost, your own computer, has no public URL. It sends both headers, and here the title is required. OpenRouter tracks it under the title you send.
  4. An app that sends only X-OpenRouter-Title gets no app page. A title alone creates nothing.

Result: Pick the case that matches your app. If you want nothing public, send neither header: the answer and the bill stay the same.

Questions readers ask

How do I know which provider served my OpenRouter request?

Open the Activity page and find the request. It names the model, the provider and the cost. The response itself names only the model, in its model field. The Logs page shows the provider too. It keeps the prompt only if you switch on Input and Output Logging.

Do I need the app attribution headers?

Only if you want your app listed. HTTP-Referer gives your app's URL and is required for an app page on OpenRouter. Leave both app headers out and the request runs and bills the same. OpenRouter still accepts the older X-Title header as well.

Someone used my OpenRouter API key. How do I limit the damage?

Delete that key and make a new one. Then give every key a credit limit, the most one key may spend. Once a key has used it, OpenRouter rejects its requests with a 402 error. Give each app its own key, so a leak stops at one key.

Sources: OpenRouter Quickstart (OpenRouter docs); API Reference: Authentication (OpenRouter docs); App Attribution (OpenRouter docs).

This figure is from OpenRouter Made Crystal Clear, chapter 3.

The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.

Get the book

All diagrams