Connect your app

Hereling needs two numbers to do its job: what an AI call cost you, and what that same user paid you. Here is how each one reaches us.

The two halves

Cost comes from your AI calls. Either route them through the Hereling proxy — one address change and two headers — or keep calling your provider directly and send us the numbers afterwards with usage events. Most apps use the proxy, because it needs no counting code of your own.

Revenue comes from your payment provider. You paste one Hereling address into Stripe, Paddle or RevenueCat, and put your own user id on each payment. See revenue webhooks.

The two halves meet through one value: your own id for the end user. Send the same id on AI calls (the x-hereling-user header) and on payments, and Hereling can tell you whether that person paid more than they cost.

The fastest way: let your coding assistant do it

Hereling ships an MCP server. Add it to Claude Code once, then say "Set up Hereling in this project". It reads your project settings, finds your AI and payment code, and walks you through the changes one file at a time.

terminal
claude mcp add hereling -e HERELING_KEY=hl_live_YOUR_MCP_READ_ONLY_KEY -- npx -y hereling

Create an MCP read only key in Settings → Hereling keys and replace the placeholder with it. Keep a separate Usage only key on your app server for AI calls and usage events.

Full instructions, and the questions you can ask it afterwards, are on the MCP server page.

Or by hand, in three steps

1

Create a project and copy your key

Sign in, create a project, and copy the key it shows you once. It starts with hl_live_. Keep it on your server, in an environment variable named HERELING_KEY — never in browser code, the same way you already treat your AI provider key.

2

Send your AI calls through Hereling

Change the base address of your AI client and add the three headers. Your provider key stays where it is and keeps working exactly as before.

your app · one change
baseURL: "https://api.hereling.com/v1/openai"

headers: {
  "x-hereling-key":     process.env.HERELING_KEY,
  "x-hereling-user":    userId,
  "x-hereling-feature": "chat",
}

The details, the other three providers and what happens on errors are on the proxy page.

3

Point your payments at Hereling

Your project page shows one webhook address per payment provider. Paste the matching one into Stripe, Paddle or RevenueCat, save the required verification secret in Settings → Webhook addresses, and make sure each payment carries your user id. Confirm a provider test delivery. See revenue webhooks.

The Connect screen inside your project has these same steps with your own addresses and key already filled in. It shows recorded traffic and warns when payment verification is missing; historical payment counts alone do not confirm your current webhook setup.

What Hereling never takes

  • Your AI provider key. It travels in your own request, is forwarded to the provider, and is gone. Not in our database, not in our logs, not in an error report.
  • Your prompts and answers. We keep numbers and labels only: model, tokens, cost, duration, status, the feature name and the user id you send.
  • Your database. We never ask for a connection string and there is no field to put one in.
The free plan records 10,000 requests per project per calendar month and keeps seven days of history. Over the limit your app keeps working exactly as before — we simply stop writing rows until the month turns.

All pages