Skip to main content

Usage and cost estimates

Learn how memtrunk estimates the cost of each request, who sees which usage data, how organization usage sharing works, and how to export usage history.

Last updated

memtrunk records every request that passes through the gateway. It stores the model, the token counts and an estimated cost. This page explains how the estimate works, who sees which usage data and how to export it.

How the cost estimate works#

memtrunk computes the cost of a request from its token counts and a price for the model. A price has four parts, in US dollars for each million tokens:

  • input tokens
  • output tokens
  • cache read tokens
  • cache write tokens

The estimate is the sum of each token count times the matching price. Built-in prices cover many models. An administrator can override a price in the console. Some models also carry a multiplier for very long prompts or for fast mode, and memtrunk applies it to every part of the estimate.

A model without a price#

If a model has no price, the estimate for its requests is zero. The Usage page then shows a notice. The notice says that the affected costs show as $0 until rates are set. Everyone who can open the page sees the notice. An administrator sees a "Set rates" button next to it.

Subscription and API key requests#

memtrunk prices a request that a subscription account serves at the same rates as a request that uses an API key. The number is an estimate. It is not an invoice from a provider.

The scope of a request depends on the account that served it:

  • A request on an account that the organization cannot draw from counts as Personal spend.
  • A request on any other account counts as Organization spend.
  • A request with no serving account counts as Organization spend when the caller belongs to an organization. Otherwise it counts as Personal spend.

If you belong to an organization, the Usage page shows a Personal and Organization switch.

Who sees which usage#

The server decides what each caller sees. The console only shows the result.

RoleUsage scope
MemberOwn usage. When organization usage sharing is on, some views widen to the organization.
Org adminUsage of the own organization.
AdministratorUsage of all users.
Read-only auditorUsage of all users.

An org admin without an organization sees own usage only. The Organization view leaves out usage on accounts that are hidden from the organization.

An administrator or an org admin can also switch usage access off for one user. That user then sees the error Usage is disabled for your account. Auditors are not affected by this switch.

The Usage page has a Usage tab and a Sessions tab for everyone. Administrators and org admins also see a Teams tab. Administrators also see a Pricing tab.

The usage history list keeps the newest 2,000 rows. The list returns at most 200 rows at a time.

Organization usage sharing#

Usage sharing is an organization setting. It controls how much of the organization a member sees.

  • When sharing is off, a member sees own data only.
  • When sharing is on, a member of that organization also sees the organization in these places:
    • the usage history list
    • the breakdowns by provider, model, account and user
    • request logs
    • the organization account lists
  • These views stay limited to the member's own data: the overview, the sessions, the daily and monthly totals and the budget.

A new organization starts with usage sharing off. An org admin or an administrator turns it on. The console toggle is labelled "Usage tracking". An org admin finds it in the "Organization settings" card.

An org admin can change only the own organization. Members and auditors cannot open the Organization settings page.

The wider view needs two things: an organization that the server knows and sharing set to on. If the server does not know the organization, the member keeps the own-only view.

Export usage history#

The history table on the Usage page has an Export button next to a format list with CSV and JSON. The browser builds the file from the rows and the columns that you can see in the table. The table loads the latest 200 entries. The file name is usage-history-<date>.csv or .json. A row has no prompt text.

The rows follow the scope of the history table. A member sees own rows. A member of an organization with usage sharing on sees the organization rows. An org admin sees rows of the own organization. An auditor sees rows of all users.

Next steps#