mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 19:10:24 +00:00
22ea7cef7a
This PR adds usage-based billing for LLM interactions in the Assistant. Release Notes: - N/A --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Richard <richard@zed.dev> Co-authored-by: Richard Feldman <oss@rtfeldman.com>
12 lines
517 B
SQL
12 lines
517 B
SQL
create table billing_events (
|
|
id serial primary key,
|
|
idempotency_key uuid not null default gen_random_uuid(),
|
|
user_id integer not null,
|
|
model_id integer not null references models (id) on delete cascade,
|
|
input_tokens bigint not null default 0,
|
|
input_cache_creation_tokens bigint not null default 0,
|
|
input_cache_read_tokens bigint not null default 0,
|
|
output_tokens bigint not null default 0
|
|
);
|
|
|
|
create index uix_billing_events_on_user_id_model_id on billing_events (user_id, model_id);
|