Compare what Slen counted with the provider's bill

Check every day that what Slen charged for a connection's key matches the provider's own usage and cost report, and hear about a difference.

3 min read

Slen counts what every model call cost from what the provider answered. Once a day it checks that count against the provider's own report of usage and cost, for each connection that is set up for it, and says where the two differ.

What is compared

  • By the key, not the account. The provider's report is read for the API key of the connection alone, because the same provider account may spend outside Slen. Give Slen an API key of its own, or the difference will show that other spend.

  • For each UTC day and model: the input, the cache reads and writes, the output, the paid tool calls such as web searches, and the money.

  • A day and model is a mismatch when the difference is above 5 % of the provider's figure and above $0.10, unless the service is set up otherwise. The provider billing more means Slen counted less — or the key also spends outside Slen; the provider billing less means Slen counted more.

  • Every run checks the last seven full days again, because the providers revise their reports for about a week.

  • Only the days Slen saw whole are compared. The first is the day after the connection was created, after its API key was rotated, after its key id or its project at the provider was replaced, or after the account was reset — so the key's spend from before Slen saw it is never a difference.

Set it up

Open Settings, then Connections, and open a connection. The last block of its page is Reconciliation with the provider's bill.

  1. Paste an admin key of your organization at the provider and save it. Slen keeps it encrypted and reads only the usage and cost reports with it.

  2. Slen finds the id of the connection's key at the provider. When it finds none, or more than one, type the id from the provider's console: key_… at OpenAI, apikey_… at Anthropic.

  3. The block lists the days and models it compared. The day the connection is created is not compared: its first row is for the next day and appears the morning after it.

An admin key has full access to your organization at the provider: Anthropic has no admin key that only reads, and at OpenAI only the owner of the organization creates one. Decide whether to give it to Slen with that in mind.

What the provider gives

  • OpenAI reports usage and cost by API key. The money of a day is the provider's own.

  • Anthropic reports usage by API key. Its cost by key is still a beta, which Slen does not read unless the service is set up for it; without it the provider's money is its reported usage priced by Slen's catalog. That catches a count Slen missed, not a wrong price. Each row says where its money comes from.

  • Google reports no cost by API key: a Google connection is not reconciled.

  • Free quotas of a provider — free searches, free container hours — are counted by Slen as paid, so a small account may see Slen counting more than the bill.

Hear about a difference

An alert rule of the type Bill mismatch on the Rules tab of Alerts opens an alert when a day checked in the last 24 hours differs by more than its threshold and minimum amount, and the alert reaches the people and channels of your notifications — Alerts. Without a rule the rows are still on the page of the connection.

Where to go next

  • Connections — the admin key and the key id of a connection.

  • Alerts — the rule that tells you about a difference.