BillCurfew

Guide · OpenRouter

Spend alerts for OpenRouter, without a second gateway

OpenRouter already is the gateway. You do not need another one in front of it. A management key can list keys and read dollars.

Management key versus inference key

An inference key (often sk-or-v1-…) is what the agent uses to call a model. A management key is created for account administration. GET /api/v1/keys requires the management key. Pasting the inference key will not list the account’s keys, and it would be the wrong secret to store in a spend tool anyway.

usage_daily is already in dollars

Each key object includes usage, usage_daily, usage_weekly, and usage_monthly in USD, plus a disabled flag and a hash. There is no minute bucket. BillCurfew stores usage_daily as the day’s total, and it stores the difference between polls as a five-minute delta. That delta is what a spike rule watches. The first poll of a new UTC day does not pretend the whole day’s spend happened in five minutes.

Disabling is reversible

PATCH /api/v1/keys/{hash} with { "disabled": true } stops the key. The same request with disabled false turns it back on. OpenRouter also has its own limit and limit_reset fields. Those are useful, and they are not a substitute for an alert that reaches you when a nightly eval wanders into a premium model.

A sensible default

  • Put a daily cap under the key’s limit, so you hear about it before OpenRouter hard-stops the agent in the middle of a job.
  • Use a spike rule on keys that should be nearly flat, like a classifier.
  • Leave auto-kill off for anything a customer is waiting on. Disable is reversible, but the agent still fails while it is off.

Let BillCurfew watch the key

Paste the admin key, set a daily cap and a spike rule, and get email before the invoice does. Prompts stay with the provider.

Start on the free tier