Track lifetime spending for each user and model (#16137)

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-08-12 17:15:26 -07:00 committed by GitHub
parent 68ae347077
commit dbcd06642c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 121 additions and 11 deletions

View file

@ -0,0 +1,9 @@
create table lifetime_usages (
id serial primary key,
user_id integer not null,
model_id integer not null references models (id) on delete cascade,
input_tokens bigint not null default 0,
output_tokens bigint not null default 0
);
create unique index uix_lifetime_usages_on_user_id_model_id on lifetime_usages (user_id, model_id);