flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/packages/contracts/src/billing.ts

532 lines20,594 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Agents as a team: lifecycle, merge queue, billing and a new shell1import type { User, Viewer } from "./identity";
2import type { RepoPath } from "./repos";
3import type { Result } from "./result";
4
5/** Millionths of a US dollar in one dollar: the unit money is held in. */
6export const MICROS_PER_DOLLAR = 1_000_000;
7
8/** Whether workspaces are charged for agents at all, and with real money. */
9export type BillingStatus = {
10 /**
11 * False when no card processor is configured: nothing is charged, and who
12 * may run agents is decided some other way.
13 */
14 enabled: boolean;
15 /** False while the card processor is in its test mode, where cards are not real. */
16 live: boolean;
Free while g1t is being built out; agents can check out their own forks17 /**
18 * True while g1t is being built out: runs are recorded with what they
19 * cost, but nothing is charged and no credit is needed. Not forever.
20 */
21 free?: boolean;
Agents as a team: lifecycle, merge queue, billing and a new shell22};
23
24/** A workspace's standing. */
25export type BillingAccount = {
26 workspace: string;
27 /**
28 * Credit left, in millionths of a dollar. Can dip below zero by the cost
29 * of the runs that were under way when it ran out.
30 */
31 balanceMicros: number;
32 status: BillingStatus;
33 /** What is added to a run's cost, in percent. */
34 marginPercent: number;
Integrations: your own model provider, alerts that open issues, tickets agents read35 /** What a run on the workspace's own model provider is charged instead. */
36 orchestrationFeeMicros: number;
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace37 /** The card charged near the limit and when a month closes, if one is saved. */
38 card?: { brand: string; last4: string; expMonth: number; expYear: number } | null;
Agents as a team: lifecycle, merge queue, billing and a new shell39};
40
41/** One line of a workspace's statement. */
42export type LedgerEntry = {
43 id: string;
44 /** Credit bought with a card, or an agent's run. */
45 kind: "top_up" | "usage";
46 /** Positive for credit added, negative for usage. */
47 amountMicros: number;
48 description: string;
49 /** For usage: the repository and pull request the agent worked on. */
50 repo: string | null;
51 number: number | null;
52 /** For usage: `implement`, `review` or `update`. */
53 task: string | null;
54 /** For usage: the model, by its public name. */
55 model: string | null;
Integrations: your own model provider, alerts that open issues, tickets agents read56 /** For usage: who paid the model provider. */
57 billedTo: "g1t" | "workspace";
Agents as a team: lifecycle, merge queue, billing and a new shell58 /** For a top-up: the username of whoever paid. */
59 createdBy: string | null;
60 /** RFC 3339. */
61 createdAt: string;
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace62 /** The workspace the line belongs to, which tells an enterprise's lines apart. */
63 workspace?: string | null;
Agents as a team: lifecycle, merge queue, billing and a new shell64};
65
66/** What lets a sandbox, and nothing else, report what its run cost. */
67export type RunTicket = { runId: string; token: string };
68
69/**
70 * What agents cost, charged to the workspace they worked for. A workspace
71 * buys credit; each run deducts its cost plus g1t's margin; with no credit,
72 * no agent starts.
73 */
A free allowance on g1t's models, so anyone can try its agents74/**
75 * The free allowance on g1t's hosted models for a workspace not otherwise
76 * open to them: a few dollars of model cost each, out of one pool, until a
77 * date. Mirrors `Trial` in `crates/contracts/src/billing.rs`.
78 */
Billing accounts, terms and enterprises; g1t is no longer free79/** How an account is charged. Standard unless g1t set otherwise in sudo. */
80export type Terms = {
81 kind: "standard" | "comped" | "custom";
82 discountPercent: number;
83 ceilingMicros: number | null;
84 note: string;
85 until: string | null;
86 setBy: string | null;
87 setAt: string | null;
88};
89
90/**
91 * Who pays: a workspace's own account, or an enterprise's, which pays for
92 * several workspaces with one bill and one limit.
93 */
94export type PayingAccount = {
95 id: string;
96 kind: "workspace" | "enterprise";
97 name: string;
98 terms: Terms;
99 workspaces: string[];
Stripe webhooks, enterprise invoices, and sudo for both100 /** Where an enterprise's invoices go. */
101 billingEmail?: string | null;
102 /** An enterprise's invoices, newest first. */
103 invoices?: EnterpriseInvoice[];
Billing accounts, terms and enterprises; g1t is no longer free104 createdAt: string;
105};
106
107export type AccountSummary = {
108 account: PayingAccount;
109 limit: Limit;
110 chargedMicros: number;
111 costMicros: number;
112 paidMicros: number;
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace113 /** The same figures for each of the account's workspaces that has any. */
114 byWorkspace: WorkspaceFigures[];
Two limits, real invoices, trust that grows by itself, sales signals115 /** The last six months, oldest first. */
116 months?: MonthFigures[];
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace117};
118
119/** One workspace's share of an `AccountSummary`. */
120export type WorkspaceFigures = { workspace: string; chargedMicros: number; costMicros: number; paidMicros: number };
121
Stripe webhooks, enterprise invoices, and sudo for both122export type StripeStatus = {
123 /** `test` or `live`, from the key; `off` without one. */
124 mode: "test" | "live" | "off" | string;
125 webhook: { url: string; endpointId: string; events: string[]; createdBy: string; createdAt: string } | null;
126 recentEvents: { id: string; kind: string; outcome: string; receivedAt: string }[];
127 error: string | null;
128};
129
130/** An enterprise's invoice: one line per workspace, paid on Stripe's page. */
131export type EnterpriseInvoice = {
132 invoiceId: string;
133 hostedUrl: string | null;
134 amountMicros: number;
135 status: "open" | "paid" | "overdue" | "void" | string;
136 period: string;
137 lines: { workspace: string; amountMicros: number }[];
138 createdAt: string;
139};
140
Two limits, real invoices, trust that grows by itself, sales signals141/** A workspace's invoice: monthly, or when charged near its limit. Itemised, in Stripe's billing page. */
142export type WorkspaceInvoice = {
143 invoiceId: string;
144 workspace: string;
145 reason: "month" | "threshold" | string;
146 period: string;
147 amountMicros: number;
148 status: "paid" | "open" | "failed" | "void" | string;
149 hostedUrl: string | null;
150 pdfUrl: string | null;
151 lines: { description: string; amountMicros: number }[];
152 createdAt: string;
153};
154
The statement is a month at a time, a line per kind of charge155/** A month of the ledger, grouped by day or project, a line per kind of charge. */
156export type Statement = {
157 month: string;
158 months: string[];
159 groups: {
160 key: string;
161 label: string;
162 lines: { kind: string; count: number; chargedMicros: number; costMicros: number }[];
163 chargedMicros: number;
164 }[];
165 totals: { chargedMicros: number; paidMicros: number; costMicros: number; entries: number };
166};
167
Two limits, real invoices, trust that grows by itself, sales signals168export type MonthFigures = { month: string; chargedMicros: number; costMicros: number; paidMicros: number };
169
170export type SignalKind = "at_limit" | "near_ceiling" | "declined" | "growing" | "established" | "first_payment" | "high_spend";
171
172/** Why a workspace is worth reaching out to. */
173export type Signal = {
174 workspace: string;
175 kind: SignalKind;
176 detail: string;
177 valueMicros: number;
178 stage: string | null;
179 owner: string | null;
Billing lists every invoice and every staff change; signals carry follow-ups180 nextStep?: string | null;
181 /** When the next step is due, YYYY-MM-DD. */
182 nextAt?: string | null;
183};
184
185/** One invoice g1t has sent, a workspace's or an enterprise's. */
186export type InvoiceSummary = {
187 invoiceId: string;
188 kind: "workspace" | "enterprise";
189 account: string;
190 name: string;
191 reason: string;
192 period: string;
193 amountMicros: number;
194 status: string;
195 hostedUrl: string | null;
196 createdAt: string;
197 paidAt: string | null;
Two limits, real invoices, trust that grows by itself, sales signals198};
199
200export type SalesStage = "none" | "lead" | "contacted" | "negotiating" | "won" | "lost" | "churn_risk";
201
202export type SalesRecord = {
203 workspace: string;
204 stage: SalesStage | string;
205 owner: string | null;
206 nextStep: string | null;
207 nextAt: string | null;
208 notes: { id: string; text: string; by: string; createdAt: string }[];
209 updatedAt: string | null;
210};
211
212export type Overview = {
213 month: string;
214 months: MonthFigures[];
215 byKind: { kind: string; chargedMicros: number; costMicros: number }[];
216 payingWorkspaces: number;
217 stopped: number;
218 nearCeiling: number;
219 declined: number;
220 openInvoicesMicros: number;
221 followUpsDue: number;
222};
223
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace224/** A customer's Stripe billing page, for staff to send them. */
225export type BillingLink = {
226 /** One-time and short-lived, signed in already. */
227 portalUrl: string;
228 /** The page's sign-in, which does not expire: the customer signs in by email. */
229 loginUrl: string | null;
230 customerEmail: string | null;
231 expiresNote: string;
Billing accounts, terms and enterprises; g1t is no longer free232};
233
234export type AdminAction = { id: string; account: string; action: string; detail: string; by: string; createdAt: string };
235
236export type AccountDetail = {
237 summary: AccountSummary;
238 workspaces: Limit[];
239 ledger: LedgerEntry[];
240 audit: AdminAction[];
241};
242
243/** Staff-only billing, for sudo.g1t.sh. Every change names who made it. */
244export interface BillingAdminApi {
245 accounts(query?: string): Promise<AccountSummary[]>;
246 account(id: string): Promise<Result<AccountDetail>>;
247 setTerms(id: string, terms: Terms, by: string): Promise<Result<PayingAccount>>;
248 createEnterprise(name: string, workspaces: string[], by: string): Promise<Result<PayingAccount>>;
249 attach(workspace: string, account: string | null, by: string): Promise<Result<PayingAccount>>;
250 credit(workspace: string, amountMicros: number, note: string, by: string): Promise<Result<LedgerEntry>>;
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace251 /** The workspace's Stripe billing page, to send to the customer. Logged. */
252 billingLink(workspace: string, by: string): Promise<Result<BillingLink>>;
Stripe webhooks, enterprise invoices, and sudo for both253 /** Where billing stands with Stripe; with `setup`, registers the webhook first. */
254 stripe(setup?: boolean, by?: string): Promise<StripeStatus>;
255 /** Where an enterprise's invoices go; makes its Stripe customer. */
256 enterpriseBilling(id: string, email: string, by: string): Promise<Result<PayingAccount>>;
257 /** Sends an enterprise its invoice now, for what its workspaces owe. */
258 invoiceEnterprise(id: string, by: string): Promise<Result<EnterpriseInvoice>>;
259 /** Exactly these workspaces' accounts, such as one page of the list. */
260 accountsFor(workspaces: string[]): Promise<AccountSummary[]>;
Two limits, real invoices, trust that grows by itself, sales signals261 /** Every workspace worth reaching out to, most urgent first. */
262 signals(): Promise<Signal[]>;
263 /** The business at a glance. */
264 overview(): Promise<Overview>;
265 /** A workspace's sales record. */
266 sales(workspace: string): Promise<SalesRecord>;
267 setSales(workspace: string, record: { stage: string; owner?: string | null; nextStep?: string | null; nextAt?: string | null }, by: string): Promise<Result<SalesRecord>>;
268 addNote(workspace: string, text: string, by: string): Promise<Result<SalesRecord>>;
269 /** A workspace's invoices from g1t, for staff. */
270 workspaceInvoices(workspace: string): Promise<WorkspaceInvoice[]>;
Billing lists every invoice and every staff change; signals carry follow-ups271 /** Every invoice g1t has sent, newest first. */
272 allInvoices(filter?: { status?: string; month?: string }): Promise<InvoiceSummary[]>;
273 /** Every change made in sudo and by Stripe, newest first, 100 at a time. */
274 audit(filter?: { by?: string; action?: string; before?: string }): Promise<AdminAction[]>;
Billing accounts, terms and enterprises; g1t is no longer free275}
276
Usage limits: unpaid usage can only go so far277/** How much a workspace has earned g1t's trust with money. */
Two limits, real invoices, trust that grows by itself, sales signals278export type Trust = "new" | "paid" | "established" | "reviewed" | "internal";
Usage limits: unpaid usage can only go so far279
280/**
281 * How far a workspace's unpaid usage has gone this month, and where its
282 * work stops: past `ceilingMicros`, no new sandboxes, builds or app
283 * requests. Usage counts at its cost to g1t or its charge, whichever is
284 * more, so it counts while g1t is free too.
285 */
286export type Limit = {
287 workspace: string;
Billing accounts, terms and enterprises; g1t is no longer free288 /** The account that pays: the workspace's own (`ws_<slug>`), or its enterprise's. */
289 account: string;
290 accountName: string;
Usage limits: unpaid usage can only go so far291 trust: Trust;
292 exposureMicros: number;
293 /** The lower of g1t's ceiling and the owner's spend limit; null for g1t's own. */
294 ceilingMicros: number | null;
295 trustCeilingMicros: number | null;
296 spendLimitMicros: number | null;
297 state: "ok" | "warning" | "stopped";
298 message: string | null;
Two limits, real invoices, trust that grows by itself, sales signals299 /** Charged this month: what the spend limit is measured against. */
300 spentMicros?: number;
301 /** True while the owners have not chosen a limit, so the automatic one applies: $200, or twice last month's spend. */
302 defaultSpendLimit?: boolean;
303 /** The most owners may set their own limit to; past it, they contact g1t. */
304 availableMicros?: number | null;
305 /** How the ceiling grows from here, in a sentence. */
306 growth?: string | null;
Usage limits: unpaid usage can only go so far307};
308
Prices keep themselves current with what g1t pays309/** One metered unit: what it costs g1t and what it is sold at; the price follows the cost. */
310export type Price = {
Agents and memory, checks and conflicts, profiles, slug renames, custom domains311 meter: "sandbox_second" | "build_second" | "app_requests" | "app_cpu" | "app_month" | "custom_domain_month" | string;
Prices keep themselves current with what g1t pays312 title: string;
313 unit: string;
314 costMicros: number;
315 markupPercent: number;
316 priceMicros: number;
317 /** `list`: Cloudflare's published price. `cloudflare`: measured from Cloudflare's bill. */
318 source: "list" | "cloudflare" | string;
319 checkedAt: string | null;
320 updatedAt: string;
321};
322
323export type PriceChange = {
324 meter: string;
325 oldCostMicros: number;
326 newCostMicros: number;
327 markupPercent: number;
328 reason: string;
329 createdAt: string;
330};
331
332export type PriceBook = { prices: Price[]; changes: PriceChange[]; modelMarginPercent: number };
333
A free allowance on g1t's models, so anyone can try its agents334export type Trial = {
335 open: boolean;
336 usedMicros: number;
337 limitMicros: number;
338 endsAt: string | null;
339 /** Why it is closed: `off`, `ended`, `used` (this workspace's) or `pool` (everyone's). */
340 reason: "off" | "ended" | "used" | "pool" | null;
341};
342
Paid features: a workspace turns on Deployments with a monthly plan343/**
344 * A paid feature a workspace turns on with a monthly plan, as Cloudflare's
345 * Workers for Platforms or Vercel's Pro are bought. Never free: neither
346 * `free` nor the model allowance covers it. Mirrors `Feature` in
347 * `crates/contracts/src/billing.rs`.
348 */
349export type Feature = "deployments";
350
351/** What the Deployments plan includes each month. Mirrors `deployments_allowance`. */
352export const DEPLOYMENTS_ALLOWANCE = {
353 apps: 10,
354 requests: 1_000_000,
355 cpuMs: 3_000_000,
356 /** What Cloudflare charges g1t past that, in millionths of a dollar. */
357 microsPerAppMonth: 20_000,
358 microsPerMillionRequests: 300_000,
359 microsPerMillionCpuMs: 20_000,
Deployments: a preview for every pull request, production on g1t.page360 /** One second of a build's sandbox; builds are charged, not included. */
361 microsPerBuildSecond: 21,
Agents and memory, checks and conflicts, profiles, slug renames, custom domains362 /** Custom domains across the workspace, and what each one past that costs g1t a month. */
363 customDomains: 3,
364 microsPerDomainMonth: 100_000,
Paid features: a workspace turns on Deployments with a monthly plan365} as const;
366
367export type FeaturePlan = {
368 feature: Feature;
369 title: string;
370 /** Charged every month while the plan is on, in cents. */
371 monthlyCents: number;
372 /** What the price includes, one line each. */
373 includes: string[];
374 /** How usage past the allowance is charged. */
375 overage: string;
376};
377
378export type SubscriptionStatus = "active" | "canceling" | "past_due" | "canceled";
379
380export type Subscription = {
381 feature: Feature;
382 status: SubscriptionStatus;
383 /** RFC 3339: when the period paid for ends. */
384 periodEnd: string | null;
385 startedBy: string;
386 startedAt: string;
387};
388
389/** A feature as a workspace sees it. */
390export type FeatureState = {
391 plan: FeaturePlan;
392 subscription: Subscription | null;
393 /** Whether the feature works for the workspace now. */
394 on: boolean;
395};
396
Agents as a team: lifecycle, merge queue, billing and a new shell397export interface BillingApi {
398 status(): Promise<BillingStatus>;
399 /** Members of the workspace only. */
400 account(workspace: string, viewer: Viewer): Promise<Result<BillingAccount>>;
401 /** Newest first. Members of the workspace only. */
402 ledger(workspace: string, viewer: Viewer): Promise<Result<LedgerEntry[]>>;
The statement is a month at a time, a line per kind of charge403 /** A month of the ledger, grouped by `day` (default) or `project`. Members only. */
404 statement(workspace: string, viewer: Viewer, month?: string | null, group?: "day" | "project"): Promise<Result<Statement>>;
405 /** One statement line's entries, 50 at a time; `before` is the last id seen. */
406 statementEntries(
407 workspace: string,
408 viewer: Viewer,
409 filter: { month: string; kind: string; day?: string | null; project?: string | null; before?: string | null },
410 ): Promise<Result<LedgerEntry[]>>;
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request411 /** What the workspace's agents cost since `since`, broken down. Members only. */
412 usage(workspace: string, viewer: Viewer, since: string): Promise<Result<Usage>>;
Agents as a team: lifecycle, merge queue, billing and a new shell413 /**
414 * Starts a card payment for credit and returns the page to send the
415 * person to. Owners only. The payment's id comes back to `returnUrl` as
416 * `session`.
417 */
418 checkout(actor: User, workspace: string, amountCents: number, returnUrl: string): Promise<Result<{ url: string }>>;
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace419 /**
420 * Stripe's hosted billing page for the workspace: card, invoices, billing
421 * email and address. g1t never handles card numbers. Owners only.
422 */
423 billingPortal(actor: User, workspace: string, returnUrl: string): Promise<Result<{ url: string }>>;
Agents as a team: lifecycle, merge queue, billing and a new shell424 /** Credits a payment once the processor says it was made. Safe to repeat. */
425 confirm(workspace: string, viewer: Viewer, session: string): Promise<Result<BillingAccount>>;
426 /**
427 * Whether a workspace may start an agent now, asked before anything is
428 * opened for it. A failure, with the reason to show, when it has no credit.
429 */
430 canStart(workspace: string): Promise<Result<boolean>>;
A free allowance on g1t's models, so anyone can try its agents431 /** A workspace's free allowance on g1t's hosted models; `exempt` are open to them anyway. */
432 trial(workspace: string, exempt: string[]): Promise<Trial>;
Agents as a team: lifecycle, merge queue, billing and a new shell433 /**
434 * Asks whether a workspace may start an agent and opens the run it will be
435 * charged for. Null when billing is off; a failure when there is no credit.
436 */
Paid features: a workspace turns on Deployments with a monthly plan437 /** Every paid feature and the workspace's plan for each. Members only. */
438 features(workspace: string, viewer: Viewer): Promise<Result<FeatureState[]>>;
439 /**
440 * Starts the card page for a feature's monthly plan. Owners only. The
441 * page's id comes back to `returnUrl` as `session`.
442 */
443 subscribe(actor: User, workspace: string, feature: Feature, returnUrl: string): Promise<Result<{ url: string }>>;
444 /** Turns the feature on once the plan is paid for. Safe to repeat. */
445 confirmSubscription(workspace: string, viewer: Viewer, session: string): Promise<Result<FeatureState>>;
446 /** Ends a plan at the end of its period, or (`resume`) takes that back. Owners only. */
447 cancelSubscription(actor: User, workspace: string, feature: Feature, resume?: boolean): Promise<Result<FeatureState>>;
448 /** Whether a feature works for a workspace now; a failure with the reason when not. */
449 hasFeature(workspace: string, feature: Feature): Promise<Result<boolean>>;
450 /**
451 * Usage past a plan's allowance, charged from credit at cost plus the
452 * margin, once per `reference`. False if it was charged before.
453 */
454 chargeFeature(charge: {
455 workspace: string;
456 feature: Feature;
457 costMicros: number;
458 description: string;
459 repo?: string | null;
460 reference: string;
461 }): Promise<Result<boolean>>;
Prices keep themselves current with what g1t pays462 /**
463 * Usage this month to be charged later (app traffic past a plan), so the
464 * workspace's limit counts it now. Replaces the last report.
465 */
466 notePending(workspace: string, source: "deployments", costMicros: number): Promise<boolean>;
467 /** Every metered price and the recent changes. Public. */
468 prices(): Promise<PriceBook>;
Usage limits: unpaid usage can only go so far469 /** A workspace's limit, for its members. */
470 limit(workspace: string, viewer: Viewer): Promise<Result<Limit>>;
471 /** The same, for the services that enforce it. */
472 checkLimit(workspace: string): Promise<Result<Limit>>;
Every sandbox is metered by the second473 /**
Two limits, real invoices, trust that grows by itself, sales signals474 * The owners' own monthly limit, up to what is available; null goes back
475 * to the default, and `useFullLimit` uses everything available. Owners only.
476 */
477 setSpendLimit(actor: User, workspace: string, spendLimitMicros: number | null, useFullLimit?: boolean): Promise<Result<Limit>>;
478 /** The workspace's invoices from g1t, newest first. Members only. */
479 invoices(workspace: string, viewer: Viewer): Promise<Result<WorkspaceInvoice[]>>;
480 /**
Every sandbox is metered by the second481 * How long a sandbox ran for a workspace, reported when it stops. Its
482 * cost is always recorded; seconds past the month's free minutes are
483 * charged. False if `reference` was recorded before.
484 */
485 recordSandbox(usage: {
486 workspace: string;
487 seconds: number;
488 description: string;
489 repo?: string | null;
490 reference: string;
491 }): Promise<Result<boolean>>;
Agents as a team: lifecycle, merge queue, billing and a new shell492 startRun(run: {
493 workspace: string;
494 repo: RepoPath;
495 number: number;
496 task: string;
497 model: string;
Integrations: your own model provider, alerts that open issues, tickets agents read498 /** `workspace` when the run uses the workspace's own model provider. */
499 billedTo?: "g1t" | "workspace";
Prices keep themselves current with what g1t pays500 /** The model session's id, so the run can be settled at AI Gateway's price. */
501 session?: string | null;
Agents as a team: lifecycle, merge queue, billing and a new shell502 }): Promise<Result<RunTicket | null>>;
503}
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request504
505
506/** One slice of usage: what it was for, what it cost, how many runs. */
507export type UsageSlice = { key: string; micros: number; runs: number };
508
509/** What a workspace's agents cost over a period. */
510export type Usage = {
511 since: string;
512 /** Charged, including g1t's margin. */
513 spentMicros: number;
Integrations: your own model provider, alerts that open issues, tickets agents read514 /** What g1t's model provider charged, before the margin. */
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request515 costMicros: number;
Integrations: your own model provider, alerts that open issues, tickets agents read516 /** What runs on the workspace's own provider cost there, estimated. Not charged by g1t. */
517 providerMicros: number;
Usage while free is shown at cost; agents get rustfmt and clippy518 /** What the runs used, at cost: g1t's models and the workspace's own provider together. */
519 usedMicros: number;
520 /** g1t charges nothing for now; the slices then measure usage at cost. */
521 free: boolean;
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request522 runs: number;
523 /** Spend per day and task, keyed `YYYY-MM-DD/task`. */
524 byDay: UsageSlice[];
525 byTask: UsageSlice[];
526 byRepo: UsageSlice[];
527 /** Keyed `namespace/name#number`. */
528 byPull: UsageSlice[];
529 byModel: UsageSlice[];
530 /** Credit bought in the period. */
531 addedMicros: number;
532};