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.
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1 | import type { ComputeKind, Reservation } from "./compute"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 2 | import type { User, Viewer } from "./identity"; |
| 3 | import type { RepoPath } from "./repos"; | |
| 4 | import type { Result } from "./result"; | |
| 5 | ||
| 6 | /** Millionths of a US dollar in one dollar: the unit money is held in. */ | |
| 7 | export const MICROS_PER_DOLLAR = 1_000_000; | |
| 8 | ||
| 9 | /** Whether workspaces are charged for agents at all, and with real money. */ | |
| 10 | export type BillingStatus = { | |
| 11 | /** | |
| 12 | * False when no card processor is configured: nothing is charged, and who | |
| 13 | * may run agents is decided some other way. | |
| 14 | */ | |
| 15 | enabled: boolean; | |
| 16 | /** False while the card processor is in its test mode, where cards are not real. */ | |
| 17 | live: boolean; | |
| Free while g1t is being built out; agents can check out their own forks | 18 | /** |
| 19 | * True while g1t is being built out: runs are recorded with what they | |
| 20 | * cost, but nothing is charged and no credit is needed. Not forever. | |
| 21 | */ | |
| 22 | free?: boolean; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 23 | }; |
| 24 | ||
| 25 | /** A workspace's standing. */ | |
| 26 | export type BillingAccount = { | |
| 27 | workspace: string; | |
| 28 | /** | |
| 29 | * Credit left, in millionths of a dollar. Can dip below zero by the cost | |
| 30 | * of the runs that were under way when it ran out. | |
| 31 | */ | |
| 32 | balanceMicros: number; | |
| 33 | status: BillingStatus; | |
| 34 | /** What is added to a run's cost, in percent. */ | |
| 35 | marginPercent: number; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 36 | /** The card charged near the limit and when a month closes, if one is saved. */ |
| 37 | card?: { brand: string; last4: string; expMonth: number; expYear: number } | null; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 38 | }; |
| 39 | ||
| 40 | /** One line of a workspace's statement. */ | |
| 41 | export type LedgerEntry = { | |
| 42 | id: string; | |
| 43 | /** Credit bought with a card, or an agent's run. */ | |
| 44 | kind: "top_up" | "usage"; | |
| 45 | /** Positive for credit added, negative for usage. */ | |
| 46 | amountMicros: number; | |
| 47 | description: string; | |
| 48 | /** For usage: the repository and pull request the agent worked on. */ | |
| 49 | repo: string | null; | |
| 50 | number: number | null; | |
| 51 | /** For usage: `implement`, `review` or `update`. */ | |
| 52 | task: string | null; | |
| 53 | /** For usage: the model, by its public name. */ | |
| 54 | model: string | null; | |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 55 | /** For usage: who paid the model provider. */ |
| 56 | billedTo: "g1t" | "workspace"; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 57 | /** For a top-up: the username of whoever paid. */ |
| 58 | createdBy: string | null; | |
| 59 | /** RFC 3339. */ | |
| 60 | createdAt: string; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 61 | /** The workspace the line belongs to, which tells an enterprise's lines apart. */ |
| 62 | workspace?: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 63 | /** For usage: what the plan's included usage paid of it. `amountMicros` is what is left to pay. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 64 | creditMicros?: number; |
| 65 | /** For usage: what the workspace's trial credit paid of it. */ | |
| 66 | trialMicros?: number; | |
| 67 | /** For usage: what g1t's open-source pool paid of it. */ | |
| 68 | ossMicros?: number; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 69 | /** For usage: what g1t covered itself, such as a trial's last run past its credit. */ |
| 70 | givenMicros?: number; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 71 | /** For usage: what the account's discount took off its price. */ |
| 72 | discountMicros?: number; | |
| 73 | /** For a credit from g1t, and for what of one expired or was revoked: its kind. */ | |
| 74 | creditKind?: CreditKind; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 75 | }; |
| 76 | ||
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 77 | /** |
| 78 | * Why g1t gave a workspace credit. Promotional (a welcome, a referral) and | |
| 79 | * goodwill (an apology) are given away when spent; a refund gives back | |
| 80 | * money already paid, and never expires. | |
| 81 | */ | |
| 82 | export type CreditKind = "promotional" | "goodwill" | "refund" | "purchased"; | |
| 83 | ||
| 84 | /** One credit g1t gave, with what of it was used: spent before anything paid in advance, the soonest-expiring first. */ | |
| 85 | export type CreditGrant = { | |
| 86 | /** `crd_…`, the grant's ledger reference. */ | |
| 87 | id: string; | |
| 88 | workspace: string; | |
| 89 | kind: CreditKind; | |
| 90 | amountMicros: number; | |
| 91 | usedMicros: number; | |
| 92 | /** What can still be spent: nothing once it expired or was revoked. */ | |
| 93 | leftMicros: number; | |
| 94 | note: string; | |
| 95 | /** A refund: what it refunds, and the day of it. */ | |
| 96 | refundFor?: string | null; | |
| 97 | refundDay?: string | null; | |
| 98 | /** RFC 3339; null never expires. */ | |
| 99 | expiresAt: string | null; | |
| 100 | createdBy: string; | |
| 101 | createdAt: string; | |
| 102 | state: "open" | "used" | "expired" | "revoked"; | |
| 103 | closedAt?: string | null; | |
| 104 | closedNote?: string | null; | |
| 105 | closedBy?: string | null; | |
| 106 | /** What expiring or revoking took off the balance. */ | |
| 107 | closedMicros?: number; | |
| 108 | /** What it pays for: all usage, or models only (spent first). */ | |
| 109 | scope?: "all" | "models"; | |
| 110 | /** Where it came from. */ | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 111 | source?: "staff" | "purchase" | "promo_code" | "upgrade"; |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 112 | }; |
| 113 | ||
| 114 | /** A workspace's credits from g1t, newest first. */ | |
| 115 | export type Credits = { grants: CreditGrant[]; leftMicros: number }; | |
| 116 | ||
| 117 | /** One month's credits of one kind: given, spent that month, and taken back unused. */ | |
| 118 | export type CreditMonth = { | |
| 119 | month: string; | |
| 120 | kind: CreditKind; | |
| 121 | givenMicros: number; | |
| 122 | grants: number; | |
| 123 | usedMicros: number; | |
| 124 | expiredMicros: number; | |
| 125 | revokedMicros: number; | |
| 126 | }; | |
| 127 | ||
| 128 | /** Every credit g1t gave (at most 200, filtered), the last 12 months by kind, and who gave them. */ | |
| 129 | export type AdminCredits = { grants: CreditGrant[]; months: CreditMonth[]; staff: string[] }; | |
| 130 | ||
| 131 | /** What a credit from sudo is, past its amount and note. */ | |
| 132 | export type CreditOptions = { | |
| 133 | kind: CreditKind; | |
| 134 | /** RFC 3339; never for a refund. */ | |
| 135 | expiresAt?: string | null; | |
| 136 | /** A refund: what it is for, and the day refunded (`YYYY-MM-DD`). */ | |
| 137 | refundFor?: string | null; | |
| 138 | refundDay?: string | null; | |
| 139 | }; | |
| 140 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 141 | /** What lets a sandbox, and nothing else, report what its run cost. */ |
| 142 | export type RunTicket = { runId: string; token: string }; | |
| 143 | ||
| 144 | /** | |
| 145 | * What agents cost, charged to the workspace they worked for. A workspace | |
| 146 | * buys credit; each run deducts its cost plus g1t's margin; with no credit, | |
| 147 | * no agent starts. | |
| 148 | */ | |
| A free allowance on g1t's models, so anyone can try its agents | 149 | /** |
| 150 | * The free allowance on g1t's hosted models for a workspace not otherwise | |
| 151 | * open to them: a few dollars of model cost each, out of one pool, until a | |
| 152 | * date. Mirrors `Trial` in `crates/contracts/src/billing.rs`. | |
| 153 | */ | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 154 | /** |
| 155 | * How an account is charged. Standard unless g1t set otherwise in sudo: | |
| 156 | * custom terms are a discount (0 to 100%), a ceiling, or both. A 100% | |
| 157 | * discount charges nothing and shows the usage at its price. `comped` is | |
| 158 | * from before discounts and reads as 100%; billing no longer writes it. | |
| 159 | */ | |
| Billing accounts, terms and enterprises; g1t is no longer free | 160 | export type Terms = { |
| 161 | kind: "standard" | "comped" | "custom"; | |
| 162 | discountPercent: number; | |
| 163 | ceilingMicros: number | null; | |
| 164 | note: string; | |
| 165 | until: string | null; | |
| 166 | setBy: string | null; | |
| 167 | setAt: string | null; | |
| 168 | }; | |
| 169 | ||
| 170 | /** | |
| 171 | * Who pays: a workspace's own account, or an enterprise's, which pays for | |
| 172 | * several workspaces with one bill and one limit. | |
| 173 | */ | |
| 174 | export type PayingAccount = { | |
| 175 | id: string; | |
| 176 | kind: "workspace" | "enterprise"; | |
| 177 | name: string; | |
| 178 | terms: Terms; | |
| 179 | workspaces: string[]; | |
| Stripe webhooks, enterprise invoices, and sudo for both | 180 | /** Where an enterprise's invoices go. */ |
| 181 | billingEmail?: string | null; | |
| 182 | /** An enterprise's invoices, newest first. */ | |
| 183 | invoices?: EnterpriseInvoice[]; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 184 | createdAt: string; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 185 | /** What g1t staff set for the account beyond its terms. */ |
| 186 | allowances?: Allowances; | |
| 187 | }; | |
| 188 | ||
| 189 | /** Set per account by g1t staff in sudo, on top of its terms. */ | |
| 190 | export type Allowances = { | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 191 | /** The g1t plan without its monthly price; usage is charged as usual. Comped accounts have it anyway. */ |
| 192 | plan: boolean; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 193 | /** Each public repository's monthly cap on g1t's open-source pool; null for the default. */ |
| 194 | ossRepoMicros: number | null; | |
| 195 | /** Each workspace's trial credit, outside the monthly pool; null for the default. */ | |
| 196 | trialMicros: number | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 197 | /** Agents at once, in place of the plan's (2 in the first month or on the trial, then 10); null for the default. */ |
| 198 | maxConcurrentAgents?: number | null; | |
| 199 | /** One run's spend cap, in place of the owners' and the default $2; null for none. */ | |
| 200 | runCapMicros?: number | null; | |
| 201 | /** What one issue's agents may spend in all, in place of the owners' and the default $10; null for none. */ | |
| 202 | issueCapMicros?: number | null; | |
| Audit logs are kept by plan: a week on free, 90 days on the plan, and what staff set for an account in sudo | 203 | /** Days of audit log its workspaces keep, in place of the plan's (7 free, 90 on the plan), longer or shorter; null for the plan's. */ |
| 204 | auditRetentionDays?: number | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 205 | /** A hold on new compute, with why; null for none. */ |
| 206 | hold?: string | null; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 207 | }; |
| 208 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 209 | // --- Entitlements, and compute started under a reservation ------------------ |
| 210 | // | |
| 211 | // Every service that starts compute asks billing first: | |
| 212 | // 1. `entitlements(workspace)`: what it may do at all, its caps, and whether compute is paused. | |
| 213 | // 2. `reserve(...)`: holds the estimate against what may pay for it, so starts at the same moment | |
| 214 | // cannot overshoot together. Answers who pays first, or refuses with a stable code | |
| 215 | // (`not_paid`, `trial_used`, `limit`, `paused`, `oss_pool_empty`) and a message for the owner. | |
| 216 | // 3. `settle(reservationId, actualMicros)`: releases the hold. The charge goes on the ledger the usual way. | |
| 217 | // A reservation never settled lapses after `RESERVATION_HOURS`. | |
| 218 | ||
| 219 | /** A reservation that is never settled stops holding after this long. */ | |
| 220 | export const RESERVATION_HOURS = 3; | |
| 221 | /** What a ceiling reads as when there is none (g1t's own workspaces). */ | |
| 222 | export const UNLIMITED_MICROS = 1_000_000_000_000_000; | |
| 223 | ||
| 224 | /** What a workspace pays g1t on, as far as compute is concerned. Mirrors `PlanKind`. */ | |
| 225 | export type PlanKind = "free" | "paid" | "internal" | "enterprise"; | |
| 226 | ||
| 227 | // `ComputeKind` (what compute is for), `PaidBy` (who pays first: credit, trial, oss, on_demand) and | |
| 228 | // `Reservation` are in `./compute`, with the gate that calls `reserve` and `settle`. | |
| 229 | ||
| 230 | /** One level reached: 50, 75, 90 or 100 percent. */ | |
| 231 | export type UsageAlert = { | |
| 232 | /** `included` (the plan's included usage), `spend_limit` or `ceiling`. */ | |
| 233 | meter: "included" | "spend_limit" | "ceiling" | string; | |
| 234 | level: number; | |
| 235 | usedMicros: number; | |
| 236 | limitMicros: number; | |
| 237 | message: string; | |
| 238 | }; | |
| 239 | ||
| 240 | /** An hour's spend well above the workspace's usual: new compute waits for an owner. */ | |
| 241 | export type Spike = { | |
| 242 | id: string; | |
| 243 | /** `open` (waiting), `continued` (keep going) or `stopped`. */ | |
| 244 | status: "open" | "continued" | "stopped" | string; | |
| 245 | hourMicros: number; | |
| 246 | averageMicros: number; | |
| 247 | detectedAt: string; | |
| 248 | decidedBy?: string | null; | |
| 249 | decidedAt?: string | null; | |
| 250 | /** While continued: until when, unless spend doubles again first. */ | |
| 251 | until?: string | null; | |
| 252 | }; | |
| 253 | ||
| 254 | /** What a workspace may do now. Mirrors `Entitlements` in `crates/contracts/src/billing.rs`. */ | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 255 | export type Entitlements = { |
| 256 | workspace: string; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 257 | plan: PlanKind; |
| 258 | /** May start sandboxes, models, deployments and semantic search at all: paid, internal, enterprise, or free with trial credit left. */ | |
| 259 | compute: boolean; | |
| 260 | /** The one-time trial credit left; 0 if none or used. */ | |
| 261 | trialMicrosLeft: number; | |
| 262 | /** A card check has been done; the trial and the open-source pool need it. */ | |
| 263 | trialVerified: boolean; | |
| 264 | /** A paid workspace still in its first billing cycle. */ | |
| 265 | firstMonth: boolean; | |
| 266 | /** 2 in the first month or on the trial, 10 after; staff can override it. */ | |
| 267 | maxConcurrentAgents: number; | |
| 268 | /** 60 in the first month or on the trial; otherwise the guardrails' own caps. */ | |
| 269 | maxRunMinutes: number; | |
| 270 | /** One run's spend cap, $2 by default; staff can override it. */ | |
| 271 | runCapMicros: number; | |
| 272 | /** Agent spend on one issue in all, $10 by default. */ | |
| 273 | issueCapMicros: number; | |
| 274 | /** g1t's ceiling on usage not yet paid for; `UNLIMITED_MICROS` for g1t's own; 0 for free. */ | |
| 275 | ceilingMicros: number; | |
| 276 | /** Usage not yet paid for this month, prepayment taken off. */ | |
| 277 | exposureMicros: number; | |
| 278 | /** Why new compute is paused, for the owner; null when it is not. */ | |
| 279 | paused: string | null; | |
| 280 | /** What open reservations hold now. */ | |
| 281 | heldMicros?: number; | |
| 282 | /** Paid in advance and not used yet. */ | |
| 283 | prepaidMicros?: number; | |
| 284 | /** The plan's included usage each month, and what of it is used. */ | |
| 285 | includedMicros?: number; | |
| 286 | includedUsedMicros?: number; | |
| Audit logs are kept by plan: a week on free, 90 days on the plan, and what staff set for an account in sudo | 287 | /** How far back the audit log can be read and exported, and what is kept: the plan's days, or what g1t staff set for the account. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 288 | auditRetentionDays: number; |
| Audit logs are kept by plan: a week on free, 90 days on the plan, and what staff set for an account in sudo | 289 | /** Whether `auditRetentionDays` is what staff set for the account rather than the plan's. */ |
| 290 | auditRetentionCustom?: boolean; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 291 | /** Private repository storage free for every workspace: past it, the plan pays and a free workspace's pushes stop. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 292 | freePrivateStorageBytes: number; |
| 293 | /** The last daily measure of the workspace's private repositories (a lower bound). */ | |
| 294 | privateStorageBytes: number; | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 295 | /** On a paid plan: package storage past the free amounts is charged, never refused. */ |
| 296 | hasPlan?: boolean; | |
| 297 | /** Package storage free for every workspace (public, and private): past it a free workspace's pushes are refused. */ | |
| 298 | packagePublicFreeBytes?: number; | |
| 299 | packagePrivateFreeBytes?: number; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 300 | /** What g1t's open-source pool paid for the workspace this month. */ |
| 301 | ossPaidMicros: number; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 302 | /** Deploy build time this month, every second of it metered. */ |
| 303 | buildSecondsUsed?: number; | |
| 304 | /** Git operations this month, and how many are free for every workspace. */ | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 305 | gitOperations?: number; |
| 306 | gitOperationsIncluded?: number; | |
| 307 | /** The smallest amount a card is charged when a month closes. */ | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 308 | minChargeMicros: number; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 309 | /** A spend spike waiting for an owner, or decided. */ |
| 310 | spike?: Spike | null; | |
| 311 | /** Where usage stands against what is included and the limits, from 50%. */ | |
| 312 | alerts?: UsageAlert[]; | |
| 313 | }; | |
| 314 | ||
| 315 | /** A hold on a start's estimated cost, as billing answers it (`Reservation` in `./compute`, and more). */ | |
| 316 | export type ReservationHeld = Reservation & { | |
| 317 | /** What is held, at cost; may be less than the estimate for a free workspace's last bit of trial. */ | |
| 318 | heldMicros?: number; | |
| 319 | /** When the hold lapses if never settled. */ | |
| 320 | expiresAt?: string; | |
| 321 | }; | |
| 322 | ||
| 323 | /** A request to g1t: a higher limit, or help with usage past what was meant. */ | |
| 324 | export type LimitRequest = { | |
| 325 | id: string; | |
| 326 | workspace: string; | |
| 327 | kind: "limit" | "overage" | string; | |
| 328 | amountMicros: number; | |
| 329 | reason: string; | |
| 330 | expectedMonthlyMicros: number; | |
| 331 | status: "open" | "approved" | "declined" | string; | |
| 332 | decidedMicros?: number | null; | |
| 333 | decidedBy?: string | null; | |
| 334 | /** The answer, as the owner sees it. */ | |
| 335 | answer?: string | null; | |
| 336 | createdBy: string; | |
| 337 | createdAt: string; | |
| 338 | decidedAt?: string | null; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 339 | }; |
| 340 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 341 | /** What staff see beside a request. */ |
| 342 | export type WorkspaceHistory = { | |
| 343 | plan: PlanKind | null; | |
| 344 | months: MonthFigures[]; | |
| 345 | paidClearedMicros: number; | |
| 346 | payments: number; | |
| 347 | disputes: number; | |
| 348 | declines: number; | |
| 349 | firstSeen: string | null; | |
| 350 | ceilingMicros: number | null; | |
| 351 | maxCeilingMicros: number | null; | |
| 352 | spendLimitMicros: number | null; | |
| 353 | lastHourMicros: number; | |
| 354 | averageHourMicros: number; | |
| 355 | lastDayMicros: number; | |
| 356 | }; | |
| 357 | ||
| 358 | export type LimitRequestReview = { request: LimitRequest; history: WorkspaceHistory }; | |
| 359 | ||
| 360 | /** What a one-time goodwill credit comes to: the margin on the overage, always, plus its cost up to the cap. */ | |
| 361 | export type Goodwill = { | |
| 362 | overageMicros: number; | |
| 363 | marginMicros: number; | |
| 364 | costMicros: number; | |
| 365 | creditMicros: number; | |
| 366 | absorbedMicros: number; | |
| 367 | }; | |
| 368 | ||
| 369 | /** A workspace whose month went well past its usual, or hit a spike. */ | |
| 370 | export type Overage = { | |
| 371 | workspace: string; | |
| 372 | plan: PlanKind; | |
| 373 | typicalMonthMicros: number; | |
| 374 | thisMonthMicros: number; | |
| 375 | costMicros: number; | |
| 376 | marginMicros: number; | |
| 377 | spike: Spike | null; | |
| 378 | topEntries: LedgerEntry[]; | |
| 379 | goodwill: Goodwill; | |
| 380 | goodwillAvailable: boolean; | |
| 381 | lastGoodwillAt: string | null; | |
| 382 | request: LimitRequest | null; | |
| 383 | }; | |
| 384 | ||
| 385 | /** One workspace's recent pace. */ | |
| 386 | export type Velocity = { | |
| 387 | workspace: string; | |
| 388 | plan: PlanKind; | |
| 389 | lastHourMicros: number; | |
| 390 | averageHourMicros: number; | |
| 391 | lastDayMicros: number; | |
| 392 | thisMonthMicros: number; | |
| 393 | ratio: number; | |
| 394 | spike: Spike | null; | |
| 395 | firstSeen: string | null; | |
| 396 | }; | |
| 397 | ||
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 398 | /** g1t's capped budgets for free usage this month. */ |
| 399 | export type Pools = { | |
| 400 | month: string; | |
| 401 | trialGrantedMicros: number; | |
| 402 | trialPoolMicros: number; | |
| 403 | trialGrants: number; | |
| 404 | ossUsedMicros: number; | |
| 405 | ossPoolMicros: number; | |
| 406 | ossRepoMicros: number; | |
| 407 | }; | |
| 408 | ||
| Billing accounts, terms and enterprises; g1t is no longer free | 409 | export type AccountSummary = { |
| 410 | account: PayingAccount; | |
| 411 | limit: Limit; | |
| 412 | chargedMicros: number; | |
| 413 | costMicros: number; | |
| 414 | paidMicros: number; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 415 | /** The same figures for each of the account's workspaces that has any. */ |
| 416 | byWorkspace: WorkspaceFigures[]; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 417 | /** The last six months, oldest first. */ |
| 418 | months?: MonthFigures[]; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 419 | }; |
| 420 | ||
| 421 | /** One workspace's share of an `AccountSummary`. */ | |
| 422 | export type WorkspaceFigures = { workspace: string; chargedMicros: number; costMicros: number; paidMicros: number }; | |
| 423 | ||
| Stripe webhooks, enterprise invoices, and sudo for both | 424 | export type StripeStatus = { |
| 425 | /** `test` or `live`, from the key; `off` without one. */ | |
| 426 | mode: "test" | "live" | "off" | string; | |
| Stripe's webhook secret is a Worker secret, STRIPE_WEBHOOK_SECRET, from a destination made in Stripe's dashboard | 427 | /** Whether `STRIPE_WEBHOOK_SECRET` is set, so events can be checked. */ |
| 428 | secretSet: boolean; | |
| 429 | /** The destination at billing's address in Stripe, as Stripe has it. */ | |
| 430 | webhook: { url: string; endpointId: string; status: "enabled" | "disabled" | string; events: string[]; createdAt: string } | null; | |
| 431 | /** Events billing handles that the destination does not send. */ | |
| 432 | missingEvents: string[]; | |
| Stripe webhooks, enterprise invoices, and sudo for both | 433 | recentEvents: { id: string; kind: string; outcome: string; receivedAt: string }[]; |
| 434 | error: string | null; | |
| 435 | }; | |
| 436 | ||
| 437 | /** An enterprise's invoice: one line per workspace, paid on Stripe's page. */ | |
| 438 | export type EnterpriseInvoice = { | |
| 439 | invoiceId: string; | |
| 440 | hostedUrl: string | null; | |
| 441 | amountMicros: number; | |
| 442 | status: "open" | "paid" | "overdue" | "void" | string; | |
| 443 | period: string; | |
| 444 | lines: { workspace: string; amountMicros: number }[]; | |
| 445 | createdAt: string; | |
| 446 | }; | |
| 447 | ||
| Two limits, real invoices, trust that grows by itself, sales signals | 448 | /** A workspace's invoice: monthly, or when charged near its limit. Itemised, in Stripe's billing page. */ |
| 449 | export type WorkspaceInvoice = { | |
| 450 | invoiceId: string; | |
| 451 | workspace: string; | |
| 452 | reason: "month" | "threshold" | string; | |
| 453 | period: string; | |
| 454 | amountMicros: number; | |
| 455 | status: "paid" | "open" | "failed" | "void" | string; | |
| 456 | hostedUrl: string | null; | |
| 457 | pdfUrl: string | null; | |
| 458 | lines: { description: string; amountMicros: number }[]; | |
| 459 | createdAt: string; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 460 | /** The card processing fee on top of `amountMicros` when charged to a card, and the tax Stripe added once known. */ |
| 461 | feeMicros?: number; | |
| 462 | taxMicros?: number; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 463 | }; |
| 464 | ||
| The statement is a month at a time, a line per kind of charge | 465 | /** A month of the ledger, grouped by day or project, a line per kind of charge. */ |
| 466 | export type Statement = { | |
| 467 | month: string; | |
| 468 | months: string[]; | |
| 469 | groups: { | |
| 470 | key: string; | |
| 471 | label: string; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 472 | /** `coveredMicros`: what the plan's included usage, the trial, the open-source pool or g1t paid, not in `chargedMicros`. */ |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 473 | /** `priceMicros`: usage at its price; `discountMicros`: what the account's discount took off it. */ |
| 474 | lines: { | |
| 475 | kind: string; | |
| 476 | count: number; | |
| 477 | chargedMicros: number; | |
| 478 | costMicros: number; | |
| 479 | coveredMicros?: number; | |
| 480 | priceMicros?: number; | |
| 481 | discountMicros?: number; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 482 | /** On `Tax` and `Card processing fees` lines: what was paid with payments on top of what reached the balance. Never charged. */ |
| 483 | passedMicros?: number; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 484 | }[]; |
| The statement is a month at a time, a line per kind of charge | 485 | chargedMicros: number; |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 486 | priceMicros?: number; |
| 487 | discountMicros?: number; | |
| The statement is a month at a time, a line per kind of charge | 488 | }[]; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 489 | totals: { |
| 490 | chargedMicros: number; | |
| 491 | paidMicros: number; | |
| 492 | costMicros: number; | |
| 493 | entries: number; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 494 | /** Usage at price, and what the discount took off: charged is the price less the discount and what paid for it. */ |
| 495 | priceMicros?: number; | |
| 496 | discountMicros?: number; | |
| 497 | /** The account's discount now, in percent; absent without one. */ | |
| 498 | discountPercent?: number | null; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 499 | /** What paid for usage before it was charged, such as "Paid by g1t's open-source pool". */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 500 | covered?: { source: "included" | "trial" | "oss_pool" | "given" | string; label: string; micros: number }[]; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 501 | /** Owed when the month closed but under the minimum charge: on the next invoice. */ |
| 502 | carriedMicros?: number; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 503 | /** Tax and card processing fees paid with the month's payments, on top of `paidMicros`. */ |
| 504 | taxMicros?: number; | |
| 505 | cardFeeMicros?: number; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 506 | }; |
| The statement is a month at a time, a line per kind of charge | 507 | }; |
| 508 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 509 | export type MonthFigures = { |
| 510 | month: string; | |
| 511 | /** Usage charged, after what paid for it first. */ | |
| 512 | chargedMicros: number; | |
| 513 | /** What usage cost g1t: never a workspace's own model provider. */ | |
| 514 | costMicros: number; | |
| 515 | paidMicros: number; | |
| 516 | /** The plan's monthly price, paid. */ | |
| 517 | plansMicros?: number; | |
| 518 | /** What g1t gave at price (internal use, trials, the open-source pool, goodwill, covered). Not margin. */ | |
| 519 | givenMicros?: number; | |
| 520 | }; | |
| 521 | ||
| 522 | /** What g1t gave this month from one source. */ | |
| 523 | export type GivenFigures = { source: "internal" | "trial" | "oss_pool" | "goodwill" | "covered" | string; label: string; micros: number; costMicros: number }; | |
| 524 | ||
| 525 | /** One internal workspace's use this month, and why it is not charged. */ | |
| 526 | export type InternalUse = { workspace: string; reason: string; costMicros: number; entries: number }; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 527 | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 528 | export type SignalKind = "at_limit" | "near_ceiling" | "declined" | "growing" | "established" | "first_payment" | "high_spend" | "cost_over_revenue"; |
| Two limits, real invoices, trust that grows by itself, sales signals | 529 | |
| 530 | /** Why a workspace is worth reaching out to. */ | |
| 531 | export type Signal = { | |
| 532 | workspace: string; | |
| 533 | kind: SignalKind; | |
| 534 | detail: string; | |
| 535 | valueMicros: number; | |
| 536 | stage: string | null; | |
| 537 | owner: string | null; | |
| Billing lists every invoice and every staff change; signals carry follow-ups | 538 | nextStep?: string | null; |
| 539 | /** When the next step is due, YYYY-MM-DD. */ | |
| 540 | nextAt?: string | null; | |
| 541 | }; | |
| 542 | ||
| 543 | /** One invoice g1t has sent, a workspace's or an enterprise's. */ | |
| 544 | export type InvoiceSummary = { | |
| 545 | invoiceId: string; | |
| 546 | kind: "workspace" | "enterprise"; | |
| 547 | account: string; | |
| 548 | name: string; | |
| 549 | reason: string; | |
| 550 | period: string; | |
| 551 | amountMicros: number; | |
| 552 | status: string; | |
| 553 | hostedUrl: string | null; | |
| 554 | createdAt: string; | |
| 555 | paidAt: string | null; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 556 | }; |
| 557 | ||
| 558 | export type SalesStage = "none" | "lead" | "contacted" | "negotiating" | "won" | "lost" | "churn_risk"; | |
| 559 | ||
| 560 | export type SalesRecord = { | |
| 561 | workspace: string; | |
| 562 | stage: SalesStage | string; | |
| 563 | owner: string | null; | |
| 564 | nextStep: string | null; | |
| 565 | nextAt: string | null; | |
| 566 | notes: { id: string; text: string; by: string; createdAt: string }[]; | |
| 567 | updatedAt: string | null; | |
| 568 | }; | |
| 569 | ||
| 570 | export type Overview = { | |
| 571 | month: string; | |
| 572 | months: MonthFigures[]; | |
| 573 | byKind: { kind: string; chargedMicros: number; costMicros: number }[]; | |
| 574 | payingWorkspaces: number; | |
| 575 | stopped: number; | |
| 576 | nearCeiling: number; | |
| 577 | declined: number; | |
| 578 | openInvoicesMicros: number; | |
| 579 | followUpsDue: number; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 580 | /** g1t's capped budgets for free usage, this month. */ |
| 581 | pools?: Pools | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 582 | /** Usage charged plus the plan's price paid, this month. */ |
| 583 | revenueMicros?: number; | |
| 584 | activePlans?: number; | |
| 585 | planMrrMicros?: number; | |
| 586 | /** What g1t gave this month, by source, apart from its margin. */ | |
| 587 | given?: GivenFigures[]; | |
| 588 | /** g1t's own and Flagon's workspaces: what their use cost, and why they are not charged. */ | |
| 589 | internal?: InternalUse[]; | |
| 590 | openRequests?: number; | |
| 591 | overages?: number; | |
| 592 | openSpikes?: number; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 593 | }; |
| 594 | ||
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 595 | /** A customer's Stripe billing page, for staff to send them. */ |
| 596 | export type BillingLink = { | |
| 597 | /** One-time and short-lived, signed in already. */ | |
| 598 | portalUrl: string; | |
| 599 | /** The page's sign-in, which does not expire: the customer signs in by email. */ | |
| 600 | loginUrl: string | null; | |
| 601 | customerEmail: string | null; | |
| 602 | expiresNote: string; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 603 | }; |
| 604 | ||
| 605 | export type AdminAction = { id: string; account: string; action: string; detail: string; by: string; createdAt: string }; | |
| 606 | ||
| 607 | export type AccountDetail = { | |
| 608 | summary: AccountSummary; | |
| 609 | workspaces: Limit[]; | |
| 610 | ledger: LedgerEntry[]; | |
| 611 | audit: AdminAction[]; | |
| 612 | }; | |
| 613 | ||
| 614 | /** Staff-only billing, for sudo.g1t.sh. Every change names who made it. */ | |
| 615 | export interface BillingAdminApi { | |
| 616 | accounts(query?: string): Promise<AccountSummary[]>; | |
| 617 | account(id: string): Promise<Result<AccountDetail>>; | |
| 618 | setTerms(id: string, terms: Terms, by: string): Promise<Result<PayingAccount>>; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 619 | /** Team on or off without charge, and the account's share of the pools. Needs a note. */ |
| 620 | setAllowances(id: string, allowances: Allowances, note: string, by: string): Promise<Result<PayingAccount>>; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 621 | createEnterprise(name: string, workspaces: string[], by: string): Promise<Result<PayingAccount>>; |
| 622 | attach(workspace: string, account: string | null, by: string): Promise<Result<PayingAccount>>; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 623 | /** Credit for a workspace: promotional, goodwill or a refund; the owners are emailed. */ |
| 624 | credit(workspace: string, amountMicros: number, note: string, by: string, options?: CreditOptions): Promise<Result<LedgerEntry>>; | |
| 625 | /** Every credit g1t gave, filtered, with each month's totals by kind. */ | |
| 626 | credits(filter?: { workspace?: string | null; kind?: CreditKind | null; month?: string | null; by?: string | null }): Promise<AdminCredits>; | |
| 627 | /** What is left of a credit, taken back, with why. */ | |
| 628 | revokeCredit(id: string, note: string, by: string): Promise<Result<CreditGrant>>; | |
| sudo: reset a test workspace's billing so it starts again as a new customer; refused on a live Stripe key, for comped workspaces and for an enterprise's | 629 | /** A test workspace's billing wiped, to start again as a new customer. Only on Stripe's test key; never comped or enterprise. Logged. */ |
| 630 | resetBilling(workspace: string, confirm: string, note: string, by: string): Promise<Result<BillingReset>>; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 631 | /** The workspace's Stripe billing page, to send to the customer. Logged. */ |
| 632 | billingLink(workspace: string, by: string): Promise<Result<BillingLink>>; | |
| Stripe webhooks, enterprise invoices, and sudo for both | 633 | /** Where billing stands with Stripe; with `setup`, registers the webhook first. */ |
| Stripe's webhook secret is a Worker secret, STRIPE_WEBHOOK_SECRET, from a destination made in Stripe's dashboard | 634 | /** Stripe's state for billing; `fix` enables the destination and adds missing events first. */ |
| 635 | stripe(fix?: boolean, by?: string): Promise<StripeStatus>; | |
| Stripe webhooks, enterprise invoices, and sudo for both | 636 | /** Where an enterprise's invoices go; makes its Stripe customer. */ |
| 637 | enterpriseBilling(id: string, email: string, by: string): Promise<Result<PayingAccount>>; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 638 | /** The enterprise's billing address and tax ID, on its Stripe customer: Stripe Tax works its invoices out from them. */ |
| 639 | enterpriseAddress(id: string, address: PostalAddress, taxIdType: string | null, taxId: string | null, by: string): Promise<Result<boolean>>; | |
| Stripe webhooks, enterprise invoices, and sudo for both | 640 | /** Sends an enterprise its invoice now, for what its workspaces owe. */ |
| 641 | invoiceEnterprise(id: string, by: string): Promise<Result<EnterpriseInvoice>>; | |
| 642 | /** Exactly these workspaces' accounts, such as one page of the list. */ | |
| 643 | accountsFor(workspaces: string[]): Promise<AccountSummary[]>; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 644 | /** Every workspace worth reaching out to, most urgent first. */ |
| 645 | signals(): Promise<Signal[]>; | |
| 646 | /** The business at a glance. */ | |
| 647 | overview(): Promise<Overview>; | |
| 648 | /** A workspace's sales record. */ | |
| 649 | sales(workspace: string): Promise<SalesRecord>; | |
| 650 | setSales(workspace: string, record: { stage: string; owner?: string | null; nextStep?: string | null; nextAt?: string | null }, by: string): Promise<Result<SalesRecord>>; | |
| 651 | addNote(workspace: string, text: string, by: string): Promise<Result<SalesRecord>>; | |
| 652 | /** A workspace's invoices from g1t, for staff. */ | |
| 653 | workspaceInvoices(workspace: string): Promise<WorkspaceInvoice[]>; | |
| Billing lists every invoice and every staff change; signals carry follow-ups | 654 | /** Every invoice g1t has sent, newest first. */ |
| 655 | allInvoices(filter?: { status?: string; month?: string }): Promise<InvoiceSummary[]>; | |
| 656 | /** Every change made in sudo and by Stripe, newest first, 100 at a time. */ | |
| 657 | audit(filter?: { by?: string; action?: string; before?: string }): Promise<AdminAction[]>; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 658 | /** Limit and overage requests, with each workspace's history; `open` by default. */ |
| 659 | limitRequests(status?: "open" | "approved" | "declined" | "all"): Promise<LimitRequestReview[]>; | |
| 660 | /** Approve (at the amount asked, or another) or decline; the owner is told in the app and by email. */ | |
| 661 | decideLimitRequest(id: string, decision: "approve" | "decline", amountMicros: number | null, note: string, by: string): Promise<Result<LimitRequest>>; | |
| 662 | /** The Overages queue. */ | |
| 663 | overages(): Promise<Overage[]>; | |
| 664 | /** A goodwill credit; no amount is the one-click credit. Larger, or a second in 12 months, needs a reason. */ | |
| 665 | goodwill(workspace: string, amountMicros: number | null, reason: string, by: string, day?: string | null): Promise<Result<LedgerEntry>>; | |
| 666 | /** Workspaces spending in the last day, fastest first. */ | |
| 667 | velocity(): Promise<Velocity[]>; | |
| 668 | /** Money that reached g1t outside the card pages, such as a bank transfer: entered as a payment. */ | |
| 669 | recordPayment(workspace: string, amountMicros: number, reference: string, note: string, by: string): Promise<Result<LedgerEntry>>; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 670 | /** Costs & margin: Cloudflare's bill against what g1t charged, over the last `days` (7 to 90, 30 by default). */ |
| 671 | costs(days?: number): Promise<CostsReport>; | |
| 672 | /** The open margin alerts, for the banner on every page. */ | |
| 673 | costAlerts(): Promise<MarginAlert[]>; | |
| Spend caps: a monthly budget for comped workspaces and a daily breaker on what g1t pays | 674 | /** g1t's own spend against its caps: the daily breaker and comped budgets. */ |
| 675 | spendCaps(): Promise<SpendCaps>; | |
| 676 | /** Lets hosted-model runs start again for the rest of today (UTC); needs a note. */ | |
| 677 | liftBreaker(note: string, by: string): Promise<Result<SpendCaps>>; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 678 | /** Approve or reject a price proposal; a rejection needs a note. An approved rise waits out the notice period. */ |
| 679 | decideProposal(id: string, decision: "approve" | "reject", note: string, by: string): Promise<Result<PriceProposal>>; | |
| 680 | setCostSettings(settings: CostSettings, by: string): Promise<Result<CostSettings>>; | |
| 681 | setCostMapping(mapping: CostMappingInput, by: string): Promise<Result<CostMapping>>; | |
| 682 | /** Reads Cloudflare's bill and reconciles now, as the daily run does. */ | |
| 683 | runCosts(by: string): Promise<Result<CostsRun>>; | |
| Models: g1t keeps up with new models, and staff choose each default in sudo | 684 | /** Agents & models: the catalogue, each purpose's default, and the latest checks. */ |
| 685 | models(): Promise<AdminModels>; | |
| 686 | /** Approve a model (its prices confirmed), retire it, or restore it. Needs a reason. */ | |
| 687 | decideModel( | |
| 688 | model: string, | |
| 689 | decision: "approve" | "retire" | "restore", | |
| 690 | details: { name?: string | null; tierHint?: string | null; prices?: ModelPrices | null }, | |
| 691 | reason: string, | |
| 692 | by: string, | |
| 693 | ): Promise<Result<CatalogueModel>>; | |
| 694 | /** One purpose's default: a model, or for a job its tier and effort. Needs a reason. */ | |
| 695 | setModelDefault( | |
| 696 | purpose: string, | |
| 697 | value: { model?: string | null; tier?: string | null; effort?: string | null }, | |
| 698 | reason: string, | |
| 699 | by: string, | |
| 700 | ): Promise<Result<ModelDefault>>; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 701 | } |
| 702 | ||
| Usage limits: unpaid usage can only go so far | 703 | /** How much a workspace has earned g1t's trust with money. */ |
| Two limits, real invoices, trust that grows by itself, sales signals | 704 | export type Trust = "new" | "paid" | "established" | "reviewed" | "internal"; |
| Usage limits: unpaid usage can only go so far | 705 | |
| 706 | /** | |
| 707 | * How far a workspace's unpaid usage has gone this month, and where its | |
| 708 | * work stops: past `ceilingMicros`, no new sandboxes, builds or app | |
| 709 | * requests. Usage counts at its cost to g1t or its charge, whichever is | |
| 710 | * more, so it counts while g1t is free too. | |
| 711 | */ | |
| 712 | export type Limit = { | |
| 713 | workspace: string; | |
| Billing accounts, terms and enterprises; g1t is no longer free | 714 | /** The account that pays: the workspace's own (`ws_<slug>`), or its enterprise's. */ |
| 715 | account: string; | |
| 716 | accountName: string; | |
| Usage limits: unpaid usage can only go so far | 717 | trust: Trust; |
| 718 | exposureMicros: number; | |
| 719 | /** The lower of g1t's ceiling and the owner's spend limit; null for g1t's own. */ | |
| 720 | ceilingMicros: number | null; | |
| 721 | trustCeilingMicros: number | null; | |
| 722 | spendLimitMicros: number | null; | |
| 723 | state: "ok" | "warning" | "stopped"; | |
| 724 | message: string | null; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 725 | /** Charged this month: what the spend limit is measured against. */ |
| 726 | spentMicros?: number; | |
| 727 | /** True while the owners have not chosen a limit, so the automatic one applies: $200, or twice last month's spend. */ | |
| 728 | defaultSpendLimit?: boolean; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 729 | /** The most owners may set their own limit to without asking: the highest ceiling ever, plus what is prepaid. */ |
| Two limits, real invoices, trust that grows by itself, sales signals | 730 | availableMicros?: number | null; |
| 731 | /** How the ceiling grows from here, in a sentence. */ | |
| 732 | growth?: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 733 | /** Paid in advance and not used yet; raises what can be used before work stops by as much. */ |
| 734 | prepaidMicros?: number; | |
| 735 | /** The highest ceiling the workspace has had. */ | |
| 736 | maxCeilingMicros?: number | null; | |
| 737 | /** The most owners may raise the limit to themselves, once: twice the highest ceiling. Null once used. */ | |
| 738 | raiseOnceMicros?: number | null; | |
| 739 | /** When the one-time raise was used. */ | |
| 740 | raisedAt?: string | null; | |
| 741 | /** A paid workspace's first billing cycle, on the starting ceiling. */ | |
| 742 | firstMonth?: boolean; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 743 | /** The budget's alerts, in percent of the spend limit: some of 50, 75, 90 and 100. */ |
| 744 | alertLevels?: number[]; | |
| 745 | /** Whether usage pauses at the spend limit (the default); off, it only alerts. */ | |
| 746 | pauseAtLimit?: boolean; | |
| 747 | /** An HTTPS address told of each budget alert. */ | |
| 748 | budgetWebhook?: string | null; | |
| Usage limits: unpaid usage can only go so far | 749 | }; |
| 750 | ||
| Prices keep themselves current with what g1t pays | 751 | /** One metered unit: what it costs g1t and what it is sold at; the price follows the cost. */ |
| 752 | export type Price = { | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 753 | meter: |
| 754 | | "sandbox_second" | |
| 755 | | "build_second" | |
| 756 | | "app_requests" | |
| 757 | | "app_cpu" | |
| 758 | | "app_month" | |
| 759 | | "custom_domain_month" | |
| 760 | | "private_storage" | |
| 761 | | "embedding_tokens" | |
| 762 | | "scan_cpu" | |
| 763 | | "scan_rows" | |
| 764 | | string; | |
| Prices keep themselves current with what g1t pays | 765 | title: string; |
| 766 | unit: string; | |
| 767 | costMicros: number; | |
| 768 | markupPercent: number; | |
| 769 | priceMicros: number; | |
| 770 | /** `list`: Cloudflare's published price. `cloudflare`: measured from Cloudflare's bill. */ | |
| 771 | source: "list" | "cloudflare" | string; | |
| 772 | checkedAt: string | null; | |
| 773 | updatedAt: string; | |
| 774 | }; | |
| 775 | ||
| 776 | export type PriceChange = { | |
| 777 | meter: string; | |
| 778 | oldCostMicros: number; | |
| 779 | newCostMicros: number; | |
| 780 | markupPercent: number; | |
| Prices are what g1t pays plus 20%, from the first second | 781 | /** The markup before, when the change was to the markup rather than the cost. */ |
| 782 | oldMarkupPercent?: number; | |
| Prices keep themselves current with what g1t pays | 783 | reason: string; |
| 784 | createdAt: string; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 785 | /** When a change still to come takes effect: a rise is announced before it is charged. */ |
| 786 | effectiveAt?: string; | |
| Prices keep themselves current with what g1t pays | 787 | }; |
| 788 | ||
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 789 | export type PriceBook = { |
| 790 | prices: Price[]; | |
| 791 | changes: PriceChange[]; | |
| 792 | modelMarginPercent: number; | |
| 793 | /** Every plan, as sold now. */ | |
| 794 | plans?: FeaturePlan[]; | |
| 795 | /** What is free, and the capped budgets that pay for it. */ | |
| 796 | free?: FreeTier | null; | |
| 797 | }; | |
| Prices keep themselves current with what g1t pays | 798 | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 799 | /** One kind of meter's usage this month, from `usage_meters`. */ |
| 800 | export type MeterUsage = { | |
| 801 | /** `agents`, `builds`, `requests`, `domains`, `git_storage` or `search_scans`. */ | |
| 802 | key: string; | |
| 803 | label: string; | |
| 804 | /** At price (cost plus 20%, on the account's terms), before what paid for it. */ | |
| 805 | micros: number; | |
| 806 | /** How much, when it is known: `12 runs`, `41 build minutes`. */ | |
| 807 | quantity?: string | null; | |
| 808 | }; | |
| 809 | ||
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 810 | /** What g1t gives without a plan; each is paid for by a capped budget. */ |
| 811 | export type FreeTier = { | |
| 812 | /** Each new workspace's trial credit, once. */ | |
| 813 | trialWorkspaceMicros: number; | |
| 814 | /** Trial grants each month, in all; new trials wait when it is spent. */ | |
| 815 | trialMonthlyPoolMicros: number; | |
| 816 | /** g1t's open-source pool each month, and any one repository's share. */ | |
| 817 | ossPoolMicros: number; | |
| 818 | ossRepoMicros: number; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 819 | /** Private repository storage free for every workspace. Past it, the plan pays; a free workspace's pushes stop. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 820 | freePrivateStorageBytes: number; |
| Audit logs are kept by plan: a week on free, 90 days on the plan, and what staff set for an account in sudo | 821 | /** Days of audit log a free workspace keeps. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 822 | auditRetentionDays: number; |
| Audit logs are kept by plan: a week on free, 90 days on the plan, and what staff set for an account in sudo | 823 | /** Days of audit log the g1t plan keeps, and g1t's own and enterprise workspaces; longer by arrangement. */ |
| 824 | planAuditRetentionDays?: number; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 825 | /** The smallest amount a card is charged when a month closes; less carries over. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 826 | minChargeMicros: number; |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 827 | /** Git operations free for every workspace each month. Past it, the plan pays; a free workspace is slowed down. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 828 | gitOperationsIncluded?: number; |
| 829 | /** A new paid workspace's ceiling in its first month. */ | |
| 830 | paidStartCeilingMicros?: number; | |
| 831 | /** The most a one-click goodwill credit can cost g1t. */ | |
| 832 | overageForgiveCostMicros?: number; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 833 | }; |
| 834 | ||
| 835 | /** | |
| 836 | * A workspace's trial credit: one grant per workspace, made the first time | |
| 837 | * it uses something, out of a pool that resets each calendar month. Mirrors | |
| 838 | * `Trial` in `crates/contracts/src/billing.rs`. | |
| 839 | */ | |
| A free allowance on g1t's models, so anyone can try its agents | 840 | export type Trial = { |
| 841 | open: boolean; | |
| 842 | usedMicros: number; | |
| 843 | limitMicros: number; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 844 | /** No longer used: trials do not end on a date. */ |
| A free allowance on g1t's models, so anyone can try its agents | 845 | endsAt: string | null; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 846 | /** Why it is closed: `off`, `used` (this workspace's grant is spent) or `pool` (this month's are given out). */ |
| A free allowance on g1t's models, so anyone can try its agents | 847 | reason: "off" | "ended" | "used" | "pool" | null; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 848 | /** Whether the workspace has its grant already. */ |
| 849 | granted?: boolean; | |
| 850 | /** With `pool`: when new trials start again, the first of next month. */ | |
| 851 | waitsUntil?: string | null; | |
| A free allowance on g1t's models, so anyone can try its agents | 852 | }; |
| 853 | ||
| Paid features: a workspace turns on Deployments with a monthly plan | 854 | /** |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 855 | * What a workspace pays a monthly price for: the g1t plan (`plan`), and the |
| 856 | * Security and quality activation (`security`), sold on its own. Deployments | |
| 857 | * are part of the plan; `has_feature` for `deployments` answers whether the | |
| 858 | * workspace has the plan. Mirrors `Feature` in `crates/contracts/src/billing.rs`. | |
| Paid features: a workspace turns on Deployments with a monthly plan | 859 | */ |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 860 | export type Feature = "plan" | "deployments" | "security"; |
| Paid features: a workspace turns on Deployments with a monthly plan | 861 | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 862 | /** |
| 863 | * What deployments cost g1t, in millionths of a dollar: fallbacks for when | |
| 864 | * billing's price book cannot be read. Not an allowance: on the plan every | |
| 865 | * unit is metered from the first, at cost plus 20%, and drawn from the | |
| 866 | * plan's included usage first. Projects, previews and the apps behind them | |
| 867 | * are not metered at all. Mirrors `deployment_costs`. | |
| 868 | */ | |
| 869 | export const DEPLOYMENT_COSTS = { | |
| Paid features: a workspace turns on Deployments with a monthly plan | 870 | microsPerMillionRequests: 300_000, |
| 871 | microsPerMillionCpuMs: 20_000, | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 872 | /** One second of a build's sandbox: a fallback; billing charges the price book's `build_second`. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 873 | microsPerBuildSecond: 15, |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 874 | /** One custom domain for a month. */ |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 875 | microsPerDomainMonth: 100_000, |
| Paid features: a workspace turns on Deployments with a monthly plan | 876 | } as const; |
| 877 | ||
| 878 | export type FeaturePlan = { | |
| 879 | feature: Feature; | |
| 880 | title: string; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 881 | /** Charged every month while the plan is on, in cents, excluding tax. */ |
| Paid features: a workspace turns on Deployments with a monthly plan | 882 | monthlyCents: number; |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 883 | /** The card processing fee on top each month, in cents (0 when off), excluding tax. */ |
| 884 | cardFeeCents?: number; | |
| Paid features: a workspace turns on Deployments with a monthly plan | 885 | /** What the price includes, one line each. */ |
| 886 | includes: string[]; | |
| 887 | /** How usage past the allowance is charged. */ | |
| 888 | overage: string; | |
| 889 | }; | |
| 890 | ||
| 891 | export type SubscriptionStatus = "active" | "canceling" | "past_due" | "canceled"; | |
| 892 | ||
| 893 | export type Subscription = { | |
| 894 | feature: Feature; | |
| 895 | status: SubscriptionStatus; | |
| 896 | /** RFC 3339: when the period paid for ends. */ | |
| 897 | periodEnd: string | null; | |
| 898 | startedBy: string; | |
| 899 | startedAt: string; | |
| 900 | }; | |
| 901 | ||
| 902 | /** A feature as a workspace sees it. */ | |
| 903 | export type FeatureState = { | |
| 904 | plan: FeaturePlan; | |
| 905 | subscription: Subscription | null; | |
| 906 | /** Whether the feature works for the workspace now. */ | |
| 907 | on: boolean; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 908 | /** On without a plan: comped terms, or given by g1t. Nothing to pay or turn off. */ |
| 909 | included?: boolean; | |
| Paid features: a workspace turns on Deployments with a monthly plan | 910 | }; |
| 911 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 912 | export interface BillingApi { |
| 913 | status(): Promise<BillingStatus>; | |
| 914 | /** Members of the workspace only. */ | |
| 915 | account(workspace: string, viewer: Viewer): Promise<Result<BillingAccount>>; | |
| 916 | /** Newest first. Members of the workspace only. */ | |
| 917 | ledger(workspace: string, viewer: Viewer): Promise<Result<LedgerEntry[]>>; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 918 | /** Credits from g1t, newest first, with what is left of each. Members only. */ |
| 919 | credits(workspace: string, viewer: Viewer): Promise<Result<Credits>>; | |
| The statement is a month at a time, a line per kind of charge | 920 | /** A month of the ledger, grouped by `day` (default) or `project`. Members only. */ |
| 921 | statement(workspace: string, viewer: Viewer, month?: string | null, group?: "day" | "project"): Promise<Result<Statement>>; | |
| 922 | /** One statement line's entries, 50 at a time; `before` is the last id seen. */ | |
| 923 | statementEntries( | |
| 924 | workspace: string, | |
| 925 | viewer: Viewer, | |
| 926 | filter: { month: string; kind: string; day?: string | null; project?: string | null; before?: string | null }, | |
| 927 | ): Promise<Result<LedgerEntry[]>>; | |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 928 | /** What the workspace's agents cost since `since`, broken down. Members only. */ |
| 929 | usage(workspace: string, viewer: Viewer, since: string): Promise<Result<Usage>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 930 | /** |
| Mission control shows model usage, yours and the workspace's: tokens, cost, active days, cache share, each day, and the mix | 931 | * The model tokens the workspace's runs used, day by day over the last |
| 932 | * `days` (42, at most 366), for everyone or for one `person`. Members | |
| 933 | * only; a member may ask only for themselves, an owner for anyone. | |
| 934 | */ | |
| 935 | tokenUsage(workspace: string, viewer: User, options?: { person?: string; days?: number }): Promise<Result<TokenUsage>>; | |
| 936 | /** | |
| 937 | * What one model answer used, added to its run's count for the day. The | |
| 938 | * model proxy sends it; for usage views only, as runs are priced from AI | |
| 939 | * Gateway. False when there was nothing to count. | |
| 940 | */ | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 941 | /** What the AI Gateway offers on g1t's key, with prices per million tokens. */ |
| 942 | gatewayModels(): Promise<GatewayModel[]>; | |
| Models: g1t keeps up with new models, and staff choose each default in sudo | 943 | /** Every purpose's default model as it applies now, and each job's tier and effort. */ |
| 944 | modelDefaults(): Promise<ModelDefaults>; | |
| 945 | /** What one provider lists now, from the models service's discovery. */ | |
| 946 | recordDiscovery(provider: string, models: ProviderModel[], by: string, error?: string | null): Promise<DiscoveryResult>; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 947 | /** |
| 948 | * Whether a workspace's next AI Gateway request may go to g1t's models: | |
| 949 | * fails with `payment_required` and what to do when it is over its spend | |
| 950 | * limit, out of AI credit, or not on the plan. | |
| 951 | */ | |
| 952 | gatewayAdmit(workspace: string): Promise<Result<boolean>>; | |
| 953 | /** Logs one AI Gateway request, and charges it when it used tokens on g1t's models. */ | |
| 954 | recordGateway(record: GatewayRecord): Promise<Result<boolean>>; | |
| 955 | /** A workspace's recent AI Gateway requests, newest first. Members only. */ | |
| 956 | gatewayRequests(workspace: string, viewer: Viewer, options?: { limit?: number; before?: string | null }): Promise<Result<GatewayRequests>>; | |
| Mission control shows model usage, yours and the workspace's: tokens, cost, active days, cache share, each day, and the mix | 957 | recordTokens(usage: { |
| 958 | workspace: string; | |
| 959 | /** The model session's id, one per run. */ | |
| 960 | session: string; | |
| 961 | /** The person the run is for, by username. */ | |
| 962 | person?: string | null; | |
| 963 | model: string; | |
| Merge branch 'model-routing' | 964 | tier?: "small" | "large" | "frontier" | null; |
| Mission control shows model usage, yours and the workspace's: tokens, cost, active days, cache share, each day, and the mix | 965 | input: number; |
| 966 | output: number; | |
| 967 | cacheRead: number; | |
| 968 | cacheWrite: number; | |
| 969 | }): Promise<Result<boolean>>; | |
| 970 | /** | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 971 | * Prepays usage ($25 at least) and returns the page to send the person to: |
| 972 | * by card with 3-D Secure, or by bank transfer from $1,000. Owners only. | |
| 973 | * The payment's id comes back to `returnUrl` as `session`. | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 974 | */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 975 | checkout( |
| 976 | actor: User, | |
| 977 | workspace: string, | |
| 978 | amountCents: number, | |
| 979 | returnUrl: string, | |
| 980 | method?: "card" | "bank_transfer", | |
| 981 | ): Promise<Result<{ url: string }>>; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 982 | /** |
| 983 | * Stripe's hosted billing page for the workspace: card, invoices, billing | |
| 984 | * email and address. g1t never handles card numbers. Owners only. | |
| 985 | */ | |
| 986 | billingPortal(actor: User, workspace: string, returnUrl: string): Promise<Result<{ url: string }>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 987 | /** Credits a payment once the processor says it was made. Safe to repeat. */ |
| 988 | confirm(workspace: string, viewer: Viewer, session: string): Promise<Result<BillingAccount>>; | |
| 989 | /** | |
| 990 | * Whether a workspace may start an agent now, asked before anything is | |
| 991 | * opened for it. A failure, with the reason to show, when it has no credit. | |
| 992 | */ | |
| 993 | canStart(workspace: string): Promise<Result<boolean>>; | |
| A free allowance on g1t's models, so anyone can try its agents | 994 | /** A workspace's free allowance on g1t's hosted models; `exempt` are open to them anyway. */ |
| 995 | trial(workspace: string, exempt: string[]): Promise<Trial>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 996 | /** |
| 997 | * Asks whether a workspace may start an agent and opens the run it will be | |
| 998 | * charged for. Null when billing is off; a failure when there is no credit. | |
| 999 | */ | |
| Paid features: a workspace turns on Deployments with a monthly plan | 1000 | /** Every paid feature and the workspace's plan for each. Members only. */ |
| 1001 | features(workspace: string, viewer: Viewer): Promise<Result<FeatureState[]>>; | |
| 1002 | /** | |
| 1003 | * Starts the card page for a feature's monthly plan. Owners only. The | |
| 1004 | * page's id comes back to `returnUrl` as `session`. | |
| 1005 | */ | |
| 1006 | subscribe(actor: User, workspace: string, feature: Feature, returnUrl: string): Promise<Result<{ url: string }>>; | |
| 1007 | /** Turns the feature on once the plan is paid for. Safe to repeat. */ | |
| 1008 | confirmSubscription(workspace: string, viewer: Viewer, session: string): Promise<Result<FeatureState>>; | |
| 1009 | /** Ends a plan at the end of its period, or (`resume`) takes that back. Owners only. */ | |
| 1010 | cancelSubscription(actor: User, workspace: string, feature: Feature, resume?: boolean): Promise<Result<FeatureState>>; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 1011 | /** Which of the workspaces are free (on no paid plan); none where payments are not set up. */ |
| 1012 | freeWorkspaces(workspaces: string[]): Promise<string[]>; | |
| Paid features: a workspace turns on Deployments with a monthly plan | 1013 | /** Whether a feature works for a workspace now; a failure with the reason when not. */ |
| 1014 | hasFeature(workspace: string, feature: Feature): Promise<Result<boolean>>; | |
| 1015 | /** | |
| 1016 | * Usage past a plan's allowance, charged from credit at cost plus the | |
| 1017 | * margin, once per `reference`. False if it was charged before. | |
| 1018 | */ | |
| 1019 | chargeFeature(charge: { | |
| 1020 | workspace: string; | |
| 1021 | feature: Feature; | |
| 1022 | costMicros: number; | |
| 1023 | description: string; | |
| 1024 | repo?: string | null; | |
| 1025 | reference: string; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1026 | /** For a build: how long it ran, so the plan's included build time pays for what it can. */ |
| 1027 | buildSeconds?: number | null; | |
| Paid features: a workspace turns on Deployments with a monthly plan | 1028 | }): Promise<Result<boolean>>; |
| Prices keep themselves current with what g1t pays | 1029 | /** |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1030 | * What a source cost g1t so far this month, so the workspace's limit |
| 1031 | * counts it now. Replaces the last report. Billing charges `context` | |
| 1032 | * and `security` itself once the month is over; `deployments` charges | |
| 1033 | * its own. | |
| Prices keep themselves current with what g1t pays | 1034 | */ |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 1035 | notePending( |
| 1036 | workspace: string, | |
| 1037 | source: "deployments" | "domains" | "context" | "security", | |
| 1038 | costMicros: number, | |
| 1039 | /** How much of it, for the Billing page: `1.2 million requests and 3.4 million CPU ms`. */ | |
| 1040 | detail?: string | null, | |
| 1041 | ): Promise<boolean>; | |
| 1042 | /** | |
| 1043 | * This month's usage, one line per kind of meter, at what it is charged | |
| 1044 | * before the plan's included usage or a pool paid for it. Members only. | |
| 1045 | */ | |
| 1046 | usageMeters(workspace: string, viewer: Viewer): Promise<Result<MeterUsage[]>>; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1047 | /** What the workspace may do now: its plan, caps, pause, trial, and what the plan gives it. */ |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1048 | entitlements(workspace: string): Promise<Entitlements>; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1049 | /** |
| 1050 | * Holds a start's estimated cost before the work starts. A failure's code says why not: | |
| 1051 | * `paused`, `limit`, `not_paid`, `trial_used` or `oss_pool_empty`, with a message for the owner. | |
| 1052 | */ | |
| 1053 | reserve(reservation: { | |
| 1054 | workspace: string; | |
| 1055 | repo: RepoPath; | |
| 1056 | public: boolean; | |
| 1057 | kind: ComputeKind; | |
| 1058 | /** The most the work is expected to cost g1t, before the margin. */ | |
| 1059 | estimateMicros: number; | |
| 1060 | }): Promise<Result<ReservationHeld>>; | |
| 1061 | /** Releases a reservation's hold with what the work cost g1t, before the margin. Safe to repeat. */ | |
| 1062 | settle(reservationId: string, actualMicros: number): Promise<Result<boolean>>; | |
| 1063 | /** Stripe's page to save and verify a card (3-D Secure, never charged). Owners only. */ | |
| 1064 | cardCheck(actor: User, workspace: string, returnUrl: string): Promise<Result<{ url: string }>>; | |
| 1065 | /** Records the card check once Stripe says it passed, and grants the trial if it can. Safe to repeat. */ | |
| 1066 | confirmCardCheck(workspace: string, viewer: Viewer, session: string): Promise<Result<Entitlements>>; | |
| 1067 | /** An owner asks for a higher limit, or for help with usage past what was meant. */ | |
| 1068 | requestLimit( | |
| 1069 | actor: User, | |
| 1070 | workspace: string, | |
| 1071 | request: { kind: "limit" | "overage"; amountMicros: number; reason: string; expectedMonthlyMicros: number }, | |
| 1072 | ): Promise<Result<LimitRequest>>; | |
| 1073 | /** The workspace's requests and their answers, newest first. Members only. */ | |
| 1074 | limitRequests(workspace: string, viewer: Viewer): Promise<Result<LimitRequest[]>>; | |
| 1075 | /** | |
| 1076 | * The owners' own caps on agents: one run's spend ($0.10 to $100) and one issue's ($1 to $1,000). | |
| 1077 | * Null goes back to the default ($2 and $10). A cap staff set wins. Owners only. | |
| 1078 | */ | |
| 1079 | setCaps(actor: User, workspace: string, caps: { runCapMicros: number | null; issueCapMicros: number | null }): Promise<Result<Entitlements>>; | |
| 1080 | /** An owner's answer to a spend spike: keep going for 24 hours, or stop. */ | |
| 1081 | confirmSpike(actor: User, workspace: string, keepGoing: boolean): Promise<Result<Entitlements>>; | |
| Prices keep themselves current with what g1t pays | 1082 | /** Every metered price and the recent changes. Public. */ |
| 1083 | prices(): Promise<PriceBook>; | |
| Usage limits: unpaid usage can only go so far | 1084 | /** A workspace's limit, for its members. */ |
| 1085 | limit(workspace: string, viewer: Viewer): Promise<Result<Limit>>; | |
| 1086 | /** The same, for the services that enforce it. */ | |
| 1087 | checkLimit(workspace: string): Promise<Result<Limit>>; | |
| Every sandbox is metered by the second | 1088 | /** |
| Two limits, real invoices, trust that grows by itself, sales signals | 1089 | * The owners' own monthly limit, up to what is available; null goes back |
| 1090 | * to the default, and `useFullLimit` uses everything available. Owners only. | |
| 1091 | */ | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1092 | setSpendLimit( |
| 1093 | actor: User, | |
| 1094 | workspace: string, | |
| 1095 | spendLimitMicros: number | null, | |
| 1096 | useFullLimit?: boolean, | |
| 1097 | /** Use the one-time raise: up to twice the highest ceiling, once per workspace. */ | |
| 1098 | raiseOnce?: boolean, | |
| 1099 | ): Promise<Result<Limit>>; | |
| Two limits, real invoices, trust that grows by itself, sales signals | 1100 | /** The workspace's invoices from g1t, newest first. Members only. */ |
| 1101 | invoices(workspace: string, viewer: Viewer): Promise<Result<WorkspaceInvoice[]>>; | |
| 1102 | /** | |
| Every sandbox is metered by the second | 1103 | * How long a sandbox ran for a workspace, reported when it stops. Its |
| Prices are what g1t pays plus 20%, from the first second | 1104 | * cost is recorded and every second is charged, from the first. False if |
| 1105 | * `reference` was recorded before. | |
| Every sandbox is metered by the second | 1106 | */ |
| 1107 | recordSandbox(usage: { | |
| 1108 | workspace: string; | |
| 1109 | seconds: number; | |
| 1110 | description: string; | |
| 1111 | repo?: string | null; | |
| 1112 | reference: string; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1113 | /** What ran; checks, workflows and the merge queue on public repositories may use the open-source pool. */ |
| 1114 | kind?: ComputeKind | null; | |
| 1115 | /** vCPU-seconds used, when the sandbox can tell: the run is priced on its own CPU. */ | |
| 1116 | cpuSeconds?: number | null; | |
| 1117 | /** The reservation it started under, settled with this cost. */ | |
| 1118 | reservationId?: string | null; | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 1119 | /** It ran on one of the workspace's self-hosted runners: its minutes go on usage at $0. */ |
| 1120 | selfHosted?: boolean; | |
| 1121 | /** The machine it ran on, by label (`g1t-4core`); absent, the standard one. */ | |
| 1122 | instance?: string | null; | |
| Every sandbox is metered by the second | 1123 | }): Promise<Result<boolean>>; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 1124 | startRun(run: { |
| 1125 | workspace: string; | |
| 1126 | repo: RepoPath; | |
| 1127 | number: number; | |
| 1128 | task: string; | |
| 1129 | model: string; | |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 1130 | /** `workspace` when the run uses the workspace's own model provider. */ |
| 1131 | billedTo?: "g1t" | "workspace"; | |
| Merge branch 'model-routing' | 1132 | /** |
| 1133 | * The model session's id: the run is settled at AI Gateway's price by | |
| 1134 | * it, and on the workspace's own provider its tokens are counted under | |
| 1135 | * it for the agent rate. | |
| 1136 | */ | |
| Prices keep themselves current with what g1t pays | 1137 | session?: string | null; |
| Merge branch 'model-routing' | 1138 | /** The tier g1t routed the run to: `small`, `large` or `frontier`. */ |
| 1139 | tier?: "small" | "large" | "frontier" | null; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 1140 | }): Promise<Result<RunTicket | null>>; |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1141 | /** Usage over a range of days (`YYYY-MM-DD`, both included), at price, by product, meter, project and day. Members only. */ |
| 1142 | usageReport( | |
| 1143 | workspace: string, | |
| 1144 | viewer: Viewer, | |
| 1145 | range: { from: string; until: string; products?: string[]; projects?: string[] }, | |
| 1146 | ): Promise<Result<UsageReport>>; | |
| 1147 | /** The workspace's prepaid AI credit, auto-reload and prices. Members only. */ | |
| 1148 | aiCredit(workspace: string, viewer: Viewer): Promise<Result<AiCredit>>; | |
| 1149 | /** Stripe's page to buy AI credit ( to ,000, the card fee on its own line). Owners only. The page's id comes back to `returnUrl` as `ai_credit`. */ | |
| 1150 | buyAiCredit(actor: User, workspace: string, amountCents: number, returnUrl: string): Promise<Result<{ url: string }>>; | |
| 1151 | /** Credits a purchase once Stripe says it was paid, once. Safe to repeat. */ | |
| 1152 | confirmAiCredit(workspace: string, viewer: Viewer, session: string): Promise<Result<AiCredit>>; | |
| 1153 | /** Auto-reload's settings. Owners only. */ | |
| 1154 | setAiReload( | |
| 1155 | actor: User, | |
| 1156 | workspace: string, | |
| 1157 | reload: { enabled: boolean; thresholdMicros: number; targetMicros: number; monthlyMaxMicros: number }, | |
| 1158 | ): Promise<Result<AiCredit>>; | |
| 1159 | /** The monthly budget: the spend limit, its alerts, whether usage pauses at 100%, and a webhook. Owners only. */ | |
| 1160 | setBudget( | |
| 1161 | actor: User, | |
| 1162 | workspace: string, | |
| 1163 | budget: { amountMicros: number | null; alerts: number[]; pauseAtLimit: boolean; webhook: string | null; keepLimit?: boolean }, | |
| 1164 | ): Promise<Result<Limit>>; | |
| 1165 | /** Invoice details from the Stripe customer, the default payment method, invoices and the next invoice. Members only. */ | |
| 1166 | billingDetails(workspace: string, viewer: Viewer): Promise<Result<BillingDetails>>; | |
| 1167 | /** Saves invoice details on the Stripe customer; absent fields stay, empty clears. Owners only. */ | |
| 1168 | setBillingDetails(actor: User, workspace: string, details: BillingDetailsInput): Promise<Result<BillingDetails>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 1169 | } |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 1170 | |
| 1171 | ||
| 1172 | /** One slice of usage: what it was for, what it cost, how many runs. */ | |
| 1173 | export type UsageSlice = { key: string; micros: number; runs: number }; | |
| 1174 | ||
| Mission control shows model usage, yours and the workspace's: tokens, cost, active days, cache share, each day, and the mix | 1175 | /** The model tokens runs used over a window of days. */ |
| 1176 | export type TokenUsage = { | |
| 1177 | /** `YYYY-MM-DD`, the first day counted. */ | |
| 1178 | since: string; | |
| 1179 | /** The window's length: 42 unless asked, 366 at most. */ | |
| 1180 | days: number; | |
| 1181 | /** Null for the whole workspace. */ | |
| 1182 | person: string | null; | |
| 1183 | totalTokens: number; | |
| 1184 | inputTokens: number; | |
| 1185 | outputTokens: number; | |
| 1186 | cacheReadTokens: number; | |
| 1187 | cacheWriteTokens: number; | |
| 1188 | /** What those runs were charged, as `usage` measures it. */ | |
| 1189 | costMicros: number; | |
| 1190 | /** Days in the window with any tokens. */ | |
| 1191 | activeDays: number; | |
| 1192 | /** Every day in the window, oldest first, zeros included. */ | |
| 1193 | byDay: { day: string; tokens: number }[]; | |
| 1194 | }; | |
| 1195 | ||
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1196 | // --- AI Gateway ------------------------------------------------------------- |
| 1197 | ||
| 1198 | /** A model the AI Gateway offers on g1t's key, with its prices per million tokens. */ | |
| 1199 | export type GatewayModel = { | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1200 | /** |
| 1201 | * The provider's own id, such as `claude-sonnet-5-5` or | |
| 1202 | * `@cf/openai/gpt-oss-120b`. A request names it as it is or with its | |
| 1203 | * provider in front (`anthropic/claude-sonnet-5-5`). | |
| 1204 | */ | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1205 | model: string; |
| 1206 | /** For people: `Claude Sonnet 5.5`. */ | |
| 1207 | name: string; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1208 | /** `anthropic` or `workers-ai`. */ |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1209 | provider: string; |
| AI Gateway: OpenAI's format, open models, and your own providers | 1210 | /** `chat`, or `embeddings` for a model that only embeds text. */ |
| 1211 | kind?: "chat" | "embeddings"; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1212 | inputMicros: number; |
| 1213 | outputMicros: number; | |
| 1214 | cacheReadMicros: number; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1215 | /** Cache writes that live five minutes. */ |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1216 | cacheWriteMicros: number; |
| AI Gateway: OpenAI's format, open models, and your own providers | 1217 | /** Cache writes that live an hour. */ |
| 1218 | cacheWrite1hMicros?: number; | |
| 1219 | /** | |
| 1220 | * Priced by the prompt's length: a request whose prompt (input, cache | |
| 1221 | * read and cache write tokens) is longer than this is charged entirely at | |
| 1222 | * the `over` prices. 0 or absent for one price. | |
| 1223 | */ | |
| 1224 | threshold?: number; | |
| 1225 | overInputMicros?: number; | |
| 1226 | overOutputMicros?: number; | |
| 1227 | overCacheReadMicros?: number; | |
| 1228 | overCacheWriteMicros?: number; | |
| 1229 | overCacheWrite1hMicros?: number; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1230 | }; |
| 1231 | ||
| Models: g1t keeps up with new models, and staff choose each default in sudo | 1232 | // --- The model catalogue ------------------------------------------------------ |
| 1233 | ||
| 1234 | /** Where a model stands: only `available` ones are routed to. */ | |
| 1235 | export type ModelStatus = "available" | "new" | "deprecated" | "retired"; | |
| 1236 | ||
| 1237 | /** One model in g1t's catalogue: its prices and what g1t knows about it. */ | |
| 1238 | export type CatalogueModel = GatewayModel & { | |
| 1239 | /** Other ids the provider lists it by, such as a dated one. */ | |
| 1240 | aliases: string[]; | |
| 1241 | family: string; | |
| 1242 | /** The agent tier it suits: `small`, `large`, `frontier`, or empty. */ | |
| 1243 | tierHint: string; | |
| 1244 | contextWindow: number; | |
| 1245 | maxOutput: number; | |
| 1246 | /** Any of `effort`, `thinking`, `tools`, `vision`, `embeddings`. */ | |
| 1247 | capabilities: string[]; | |
| 1248 | dimensions: number; | |
| 1249 | status: ModelStatus; | |
| 1250 | /** Its prices are known. An unpriced model is never routed to, offered or charged for. */ | |
| 1251 | priced: boolean; | |
| 1252 | source: "discovered" | "staff"; | |
| 1253 | firstSeenAt: string | null; | |
| 1254 | lastSeenAt: string | null; | |
| 1255 | missingSince: string | null; | |
| 1256 | approvedBy: string | null; | |
| 1257 | approvedAt: string | null; | |
| 1258 | note: string; | |
| 1259 | /** A typical agent run on it, in millionths of a dollar; 0 when unpriced or embeddings. */ | |
| 1260 | typicalRunMicros: number; | |
| 1261 | }; | |
| 1262 | ||
| 1263 | /** One model as its provider lists it, from the models service's discovery. */ | |
| 1264 | export type ProviderModel = { | |
| 1265 | id: string; | |
| 1266 | name: string; | |
| 1267 | /** `chat`, `embeddings`, or anything else (counted as listed, never added). */ | |
| 1268 | kind: string; | |
| 1269 | contextWindow: number; | |
| 1270 | maxOutput: number; | |
| 1271 | capabilities: string[]; | |
| 1272 | /** Workers AI lists a price per million tokens; Anthropic does not. */ | |
| 1273 | price: { inputMicros: number; outputMicros: number } | null; | |
| 1274 | }; | |
| 1275 | ||
| 1276 | /** What one check of a provider found. */ | |
| 1277 | export type DiscoveryResult = { | |
| 1278 | provider: string; | |
| 1279 | checkedAt: string; | |
| 1280 | by: string; | |
| 1281 | listed: number; | |
| 1282 | added: string[]; | |
| 1283 | deprecated: string[]; | |
| 1284 | restored: string[]; | |
| 1285 | error: string | null; | |
| 1286 | }; | |
| 1287 | ||
| 1288 | /** The purposes a default model is chosen for. */ | |
| 1289 | export type ModelPurpose = "tier_small" | "tier_large" | "tier_frontier" | "background" | "gateway_first"; | |
| 1290 | ||
| 1291 | /** One purpose's default, as staff last set it. */ | |
| 1292 | export type ModelDefault = { | |
| 1293 | /** A `ModelPurpose`, or `job_<kind>`. */ | |
| 1294 | purpose: string; | |
| 1295 | model: string | null; | |
| 1296 | /** For a job: `small`, `large`, `frontier` or `change`. */ | |
| 1297 | tier: string | null; | |
| 1298 | effort: string | null; | |
| 1299 | updatedAt: string; | |
| 1300 | updatedBy: string; | |
| 1301 | reason: string; | |
| 1302 | }; | |
| 1303 | ||
| 1304 | /** A model purpose's default as it applies now. */ | |
| 1305 | export type ResolvedModel = { | |
| 1306 | purpose: string; | |
| 1307 | chosen: string; | |
| 1308 | /** The model to use; null when nothing suits (callers keep their own fallback). */ | |
| 1309 | model: GatewayModel | null; | |
| 1310 | capabilities: string[]; | |
| 1311 | /** Why it is not the chosen model, in a sentence. */ | |
| 1312 | note: string | null; | |
| 1313 | }; | |
| 1314 | ||
| 1315 | /** One kind of agent job's starting tier and effort. */ | |
| 1316 | export type JobDefault = { kind: string; tier: string; effort: string | null }; | |
| 1317 | ||
| 1318 | /** Every purpose's model as it applies now, and each job's tier and effort. */ | |
| 1319 | export type ModelDefaults = { models: ResolvedModel[]; jobs: JobDefault[] }; | |
| 1320 | ||
| 1321 | /** One check of one provider. */ | |
| 1322 | export type ModelCheck = { | |
| 1323 | id: string; | |
| 1324 | provider: string; | |
| 1325 | checkedAt: string; | |
| 1326 | by: string; | |
| 1327 | listed: number; | |
| 1328 | added: string[]; | |
| 1329 | deprecated: string[]; | |
| 1330 | error: string | null; | |
| 1331 | }; | |
| 1332 | ||
| 1333 | /** The tokens of the typical agent run estimates are priced from. */ | |
| 1334 | export type TypicalRun = { requests: number; input: number; output: number; cacheRead: number; cacheWrite: number }; | |
| 1335 | ||
| 1336 | /** sudo's Agents & models. */ | |
| 1337 | export type AdminModels = { | |
| 1338 | catalogue: CatalogueModel[]; | |
| 1339 | defaults: ModelDefault[]; | |
| 1340 | resolved: ModelDefaults; | |
| 1341 | checks: ModelCheck[]; | |
| 1342 | typical: TypicalRun; | |
| 1343 | }; | |
| 1344 | ||
| 1345 | /** A model's prices as staff confirm them, per million tokens in millionths of a dollar. */ | |
| 1346 | export type ModelPrices = { | |
| 1347 | inputMicros: number; | |
| 1348 | outputMicros: number; | |
| 1349 | cacheReadMicros: number; | |
| 1350 | cacheWriteMicros: number; | |
| 1351 | cacheWrite1hMicros: number; | |
| 1352 | threshold: number; | |
| 1353 | overInputMicros: number; | |
| 1354 | overOutputMicros: number; | |
| 1355 | overCacheReadMicros: number; | |
| 1356 | overCacheWriteMicros: number; | |
| 1357 | overCacheWrite1hMicros: number; | |
| 1358 | }; | |
| 1359 | ||
| 1360 | /** The models service's `Discovery` entrypoint, for sudo's "Check for new models". */ | |
| 1361 | export interface ModelDiscoveryApi { | |
| 1362 | /** Lists every provider's models now and records what changed: one result per provider. */ | |
| 1363 | check(by: string): Promise<DiscoveryResult[]>; | |
| 1364 | } | |
| 1365 | ||
| AI Gateway: OpenAI's format, open models, and your own providers | 1366 | /** The format a gateway request was sent in. */ |
| 1367 | export type GatewayFormat = "anthropic" | "openai"; | |
| 1368 | ||
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1369 | /** One AI Gateway request, as the model proxy reports it to billing. */ |
| 1370 | export type GatewayRecord = { | |
| 1371 | /** `gw_…`, chosen by the proxy; recording it twice records it once. */ | |
| 1372 | id: string; | |
| 1373 | workspace: string; | |
| 1374 | tokenId: string; | |
| 1375 | tokenName?: string | null; | |
| 1376 | model: string; | |
| 1377 | input: number; | |
| 1378 | output: number; | |
| 1379 | cacheRead: number; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1380 | /** Every cache write, of either lifetime. */ |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1381 | cacheWrite: number; |
| AI Gateway: OpenAI's format, open models, and your own providers | 1382 | /** Of `cacheWrite`, those that live an hour. */ |
| 1383 | cacheWriteHour?: number; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1384 | /** The HTTP status the caller was answered with. */ |
| 1385 | status: number; | |
| 1386 | /** On the workspace's own provider key: counted, never charged. */ | |
| 1387 | ownKey: boolean; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1388 | format: GatewayFormat; |
| 1389 | /** | |
| 1390 | * Who served it: `anthropic` or `workers-ai` on g1t's key, the | |
| 1391 | * connection's provider on the workspace's own. Empty when it never got | |
| 1392 | * that far. | |
| 1393 | */ | |
| 1394 | provider: string; | |
| 1395 | /** On the workspace's own provider: the connection's name. */ | |
| 1396 | connection?: string | null; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1397 | streamed: boolean; |
| 1398 | durationMs: number; | |
| 1399 | error?: string | null; | |
| 1400 | }; | |
| 1401 | ||
| 1402 | /** One AI Gateway request, as its log keeps it. */ | |
| 1403 | export type GatewayRequest = { | |
| 1404 | id: string; | |
| 1405 | createdAt: string; | |
| 1406 | model: string; | |
| 1407 | tokenId: string; | |
| 1408 | tokenName: string | null; | |
| 1409 | input: number; | |
| 1410 | output: number; | |
| 1411 | cacheRead: number; | |
| 1412 | cacheWrite: number; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1413 | /** Of `cacheWrite`, those that live an hour. */ |
| 1414 | cacheWriteHour: number; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1415 | /** What the tokens cost at the model's price. */ |
| 1416 | costMicros: number; | |
| 1417 | /** What the workspace was charged, before included usage and credit paid for it; 0 on its own key. */ | |
| 1418 | chargedMicros: number; | |
| 1419 | status: number; | |
| 1420 | ownKey: boolean; | |
| AI Gateway: OpenAI's format, open models, and your own providers | 1421 | format: GatewayFormat; |
| 1422 | /** `anthropic` or `workers-ai` on g1t's key; the connection's provider on the workspace's own. */ | |
| 1423 | provider: string; | |
| 1424 | /** On the workspace's own provider: the connection's name. */ | |
| 1425 | connection: string | null; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 1426 | streamed: boolean; |
| 1427 | durationMs: number; | |
| 1428 | error: string | null; | |
| 1429 | }; | |
| 1430 | ||
| 1431 | /** A page of AI Gateway requests, newest first. */ | |
| 1432 | export type GatewayRequests = { | |
| 1433 | requests: GatewayRequest[]; | |
| 1434 | /** The `before` for the next page, when there is one. */ | |
| 1435 | next: string | null; | |
| 1436 | /** How many days requests are kept. */ | |
| 1437 | retentionDays: number; | |
| 1438 | }; | |
| 1439 | ||
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 1440 | /** What a workspace's agents cost over a period. */ |
| 1441 | export type Usage = { | |
| 1442 | since: string; | |
| 1443 | /** Charged, including g1t's margin. */ | |
| 1444 | spentMicros: number; | |
| Billing and Usage reconcile: own-provider runs leave Billing's at-price total, and Usage's not-charged part is at price less charged | 1445 | /** What g1t's usage came to at price, less what was charged: the plan's included usage, the trial, a pool or a free period paid it. Usage at price is `spentMicros` plus this. */ |
| Billing's usage total is labeled at price, and Usage says what part of it was paid for | 1446 | coveredMicros?: number; |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 1447 | /** What the account's discount took off the price; usage at price is spent + covered + this. */ |
| 1448 | discountMicros?: number; | |
| 1449 | /** The account's discount now, in percent; with one, the slices are at price. */ | |
| 1450 | discountPercent?: number | null; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1451 | /** Usage at price: spent + covered + discount, from the same ledger lines. The one usage figure every page shows. */ |
| 1452 | priceMicros?: number; | |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 1453 | /** What g1t's model provider charged, before the margin. */ |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 1454 | costMicros: number; |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 1455 | /** What runs on the workspace's own provider cost there, estimated. Not charged by g1t. */ |
| 1456 | providerMicros: number; | |
| Usage while free is shown at cost; agents get rustfmt and clippy | 1457 | /** What the runs used, at cost: g1t's models and the workspace's own provider together. */ |
| 1458 | usedMicros: number; | |
| 1459 | /** g1t charges nothing for now; the slices then measure usage at cost. */ | |
| 1460 | free: boolean; | |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 1461 | runs: number; |
| 1462 | /** Spend per day and task, keyed `YYYY-MM-DD/task`. */ | |
| 1463 | byDay: UsageSlice[]; | |
| 1464 | byTask: UsageSlice[]; | |
| 1465 | byRepo: UsageSlice[]; | |
| 1466 | /** Keyed `namespace/name#number`. */ | |
| 1467 | byPull: UsageSlice[]; | |
| 1468 | byModel: UsageSlice[]; | |
| 1469 | /** Credit bought in the period. */ | |
| 1470 | addedMicros: number; | |
| 1471 | }; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 1472 | |
| 1473 | /** One of g1t's products (a "bucket") on one day. Money in micros. */ | |
| 1474 | export type CostDay = { day: string; bucket: string; cfCostMicros: number; ownCostMicros: number; valueMicros: number; cashMicros: number }; | |
| 1475 | ||
| 1476 | /** One product over the range: what customers were charged at price against what it cost. */ | |
| 1477 | export type ProductMargin = { | |
| 1478 | bucket: string; | |
| 1479 | title: string; | |
| 1480 | /** Cloudflare's bill, or g1t's own figure where Cloudflare does not bill it (`costSource`). */ | |
| 1481 | costMicros: number; | |
| 1482 | cfCostMicros: number; | |
| 1483 | ownCostMicros: number; | |
| 1484 | valueMicros: number; | |
| 1485 | marginMicros: number; | |
| 1486 | marginPercent: number | null; | |
| 1487 | costSource: "cloudflare" | "ledger" | string; | |
| 1488 | /** Running g1t, paid for by the plan. */ | |
| 1489 | overhead: boolean; | |
| 1490 | }; | |
| 1491 | ||
| 1492 | /** All of g1t: money in (usage and the plan) against every cost. */ | |
| Costs: margin is measured on what was sold; comped workspaces, free periods, the trial and the pools are given away, a budget shown beside it | 1493 | export type OverallMargin = { |
| 1494 | usageMicros: number; | |
| 1495 | plansMicros: number; | |
| 1496 | costMicros: number; | |
| 1497 | marginMicros: number; | |
| 1498 | marginPercent: number | null; | |
| 1499 | /** Of costMicros, what went on usage g1t gave away on purpose: comped workspaces, free periods, the trial and the open-source pool. */ | |
| 1500 | givenMicros?: number; | |
| 1501 | /** Money in against costMicros - givenMicros. */ | |
| 1502 | soldMarginMicros?: number; | |
| 1503 | soldMarginPercent?: number | null; | |
| Costs: a statement that keeps usage sold, running g1t, subscriptions and what was given away (comped, free use, trial, pool) apart, and says who was paid; free use carries its own cost; the run button says it is running | 1504 | /** Usage sold: usageMicros against what that usage cost, less what was given. */ |
| 1505 | usageCostMicros?: number; | |
| 1506 | usageMarginMicros?: number; | |
| 1507 | usageMarginPercent?: number | null; | |
| 1508 | /** Running g1t: plansMicros against the platform's cost, less its given share. */ | |
| 1509 | runningCostMicros?: number; | |
| 1510 | /** Cost no mapping names, less its given share. */ | |
| 1511 | unmappedCostMicros?: number; | |
| 1512 | /** givenMicros by why. Free is free periods, free allowances and overruns g1t covered. */ | |
| 1513 | givenCompedMicros?: number; | |
| 1514 | givenFreeMicros?: number; | |
| 1515 | givenTrialMicros?: number; | |
| 1516 | givenPoolMicros?: number; | |
| Merge branch 'worktree-agent-a633ac0f7f66d419d' | 1517 | /** What discounts on an account's terms took below cost plus the margin: given, not margin lost. */ |
| 1518 | givenDiscountMicros?: number; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 1519 | /** Credits from g1t spent on usage, by kind: given, never money in. Refunds come off money in instead. */ |
| 1520 | givenCreditPromotionalMicros?: number; | |
| 1521 | givenCreditGoodwillMicros?: number; | |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 1522 | /** What testing resets wiped that g1t paid for: the usage still happened, so its cost is given, never a leak. */ |
| 1523 | givenResetMicros?: number; | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 1524 | /** Credits over the range: given (every kind), spent on usage, and refunds' money given back. */ |
| 1525 | creditsGivenMicros?: number; | |
| 1526 | creditsUsedMicros?: number; | |
| 1527 | creditsRefundedMicros?: number; | |
| Costs: a statement that keeps usage sold, running g1t, subscriptions and what was given away (comped, free use, trial, pool) apart, and says who was paid; free use carries its own cost; the run button says it is running | 1528 | /** costMicros by who g1t pays: Cloudflare's bill (billed, after included allowances) and model providers (tokens, not on Cloudflare's bill). */ |
| Costs: the plan's included usage counts as paid for the usage it covered, out of what plans leave for running g1t; the run button shows it is running with CSS alone (sudo ships no JavaScript) | 1529 | /** What the plan's included usage paid for, at price: money in for usage, paid out of plansMicros. */ |
| 1530 | includedMicros?: number; | |
| Costs: a statement that keeps usage sold, running g1t, subscriptions and what was given away (comped, free use, trial, pool) apart, and says who was paid; free use carries its own cost; the run button says it is running | 1531 | cloudflareCostMicros?: number; |
| 1532 | modelsCostMicros?: number; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 1533 | /** Tax collected with payments over the range, net of refunds: owed to tax authorities, never cash or revenue. */ |
| 1534 | taxCollectedMicros?: number; | |
| 1535 | /** Card processing fees passed on with card payments, net of refunds: they pay Stripe's fee, not revenue. */ | |
| 1536 | cardFeesMicros?: number; | |
| Costs: margin is measured on what was sold; comped workspaces, free periods, the trial and the pools are given away, a budget shown beside it | 1537 | }; |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 1538 | |
| 1539 | /** A count, cost or leak that does not add up. */ | |
| 1540 | export type CostDrift = { | |
| 1541 | bucket: string; | |
| 1542 | title: string; | |
| 1543 | kind: "count" | "cost" | "leak" | string; | |
| 1544 | ours: number; | |
| 1545 | cloudflare: number; | |
| 1546 | deltaPercent: number | null; | |
| 1547 | detail: string; | |
| 1548 | foundAt: string; | |
| 1549 | }; | |
| 1550 | ||
| 1551 | export type MarginAlert = { | |
| 1552 | id: string; | |
| 1553 | kind: "margin" | "overall" | "leak" | "drift" | "workspace" | string; | |
| 1554 | /** The product, or the workspace. */ | |
| 1555 | subject: string; | |
| 1556 | detail: string; | |
| 1557 | since: string; | |
| 1558 | openedAt: string; | |
| 1559 | emailedAt: string | null; | |
| 1560 | }; | |
| 1561 | ||
| 1562 | /** A change to a price, measured from what Cloudflare charged. */ | |
| 1563 | export type PriceProposal = { | |
| 1564 | id: string; | |
| 1565 | meter: string; | |
| 1566 | title: string; | |
| 1567 | unit: string; | |
| 1568 | currentCostMicros: number; | |
| 1569 | proposedCostMicros: number; | |
| 1570 | changePercent: number; | |
| 1571 | markupPercent: number; | |
| 1572 | reason: string; | |
| 1573 | source: "keeper" | "reconciler" | string; | |
| 1574 | /** Far off the current cost: look before approving. */ | |
| 1575 | suspect: boolean; | |
| 1576 | status: "open" | "applied" | "approved" | "rejected" | "superseded" | string; | |
| 1577 | createdAt: string; | |
| 1578 | decidedAt: string | null; | |
| 1579 | decidedBy: string | null; | |
| 1580 | note: string | null; | |
| 1581 | effectiveAt: string | null; | |
| 1582 | }; | |
| 1583 | ||
| 1584 | /** One version of one meter's price; never changed once written. */ | |
| 1585 | export type PriceVersion = { | |
| 1586 | id: string; | |
| 1587 | meter: string; | |
| 1588 | version: number; | |
| 1589 | costMicros: number; | |
| 1590 | markupPercent: number; | |
| 1591 | priceMicros: number; | |
| 1592 | effectiveAt: string; | |
| 1593 | reason: string; | |
| 1594 | createdBy: string; | |
| 1595 | appliedAt: string | null; | |
| 1596 | }; | |
| 1597 | ||
| sudo: reset a test workspace's billing so it starts again as a new customer; refused on a live Stripe key, for comped workspaces and for an enterprise's | 1598 | /** What `resetBilling` removed. */ |
| sudo: a billing reset runs the costs analysis again so every figure is fresh; every submit button shows it is working (CSS only); no margin percentage on less than a cent sold | 1599 | export type BillingReset = { workspace: string; rows: number; refreshed?: boolean }; |
| sudo: reset a test workspace's billing so it starts again as a new customer; refused on a live Stripe key, for comped workspaces and for an enterprise's | 1600 | |
| Costs: margin is measured on what was sold; comped workspaces, free periods, the trial and the pools are given away, a budget shown beside it | 1601 | export type WorkspaceCost = { workspace: string; costMicros: number; revenueMicros: number; givenMicros?: number; internal: boolean }; |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 1602 | |
| 1603 | export type CostLineSummary = { | |
| 1604 | product: string; | |
| 1605 | meter: string; | |
| 1606 | rawName: string; | |
| 1607 | unit: string; | |
| 1608 | source: string; | |
| 1609 | quantity: number; | |
| 1610 | costMicros: number; | |
| 1611 | /** Absent when no mapping claims it. */ | |
| 1612 | bucket: string | null; | |
| 1613 | }; | |
| 1614 | ||
| 1615 | export type CostMapping = { | |
| 1616 | product: string; | |
| 1617 | meter: string; | |
| 1618 | bucket: string; | |
| 1619 | priceMeter: string | null; | |
| 1620 | ownMeter: string | null; | |
| 1621 | scaleToOwn: boolean; | |
| 1622 | driftPercent: number; | |
| 1623 | note: string; | |
| 1624 | updatedAt: string; | |
| 1625 | updatedBy: string; | |
| 1626 | }; | |
| 1627 | ||
| 1628 | export type CostMappingInput = { | |
| 1629 | product: string; | |
| 1630 | meter: string; | |
| 1631 | bucket?: string; | |
| 1632 | priceMeter?: string | null; | |
| 1633 | ownMeter?: string | null; | |
| 1634 | scaleToOwn?: boolean; | |
| 1635 | driftPercent?: number | null; | |
| 1636 | note?: string; | |
| 1637 | remove?: boolean; | |
| 1638 | }; | |
| 1639 | ||
| 1640 | export type CostSettings = { | |
| 1641 | autoApply: boolean; | |
| 1642 | autoApplyPercent: number; | |
| 1643 | noticeDays: number; | |
| 1644 | marginFloorPercent: number; | |
| 1645 | alertDays: number; | |
| 1646 | minDailyCostMicros: number; | |
| 1647 | anomalyFactor: number; | |
| 1648 | anomalyFloorMicros: number; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1649 | /** Pass Stripe's card fee on as its own line when AI credit is bought by card. */ |
| 1650 | cardFee: boolean; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 1651 | }; |
| 1652 | ||
| 1653 | export type CostsReport = { | |
| 1654 | configured: boolean; | |
| 1655 | fetchedAt: string | null; | |
| 1656 | since: string; | |
| 1657 | until: string; | |
| 1658 | days: CostDay[]; | |
| 1659 | products: ProductMargin[]; | |
| 1660 | overall: OverallMargin; | |
| 1661 | drift: CostDrift[]; | |
| 1662 | alerts: MarginAlert[]; | |
| 1663 | proposals: PriceProposal[]; | |
| 1664 | versions: PriceVersion[]; | |
| 1665 | topWorkspaces: WorkspaceCost[]; | |
| 1666 | lines: CostLineSummary[]; | |
| 1667 | mappings: CostMapping[]; | |
| 1668 | settings: CostSettings; | |
| Spend caps: a monthly budget for comped workspaces and a daily breaker on what g1t pays | 1669 | /** g1t's own spend against its two caps. */ |
| 1670 | caps: SpendCaps; | |
| 1671 | }; | |
| 1672 | ||
| 1673 | /** What g1t pays for itself, at cost, against its caps (billing's `budget`). */ | |
| 1674 | export type SpendCaps = { | |
| 1675 | /** Today (UTC), YYYY-MM-DD, and this month, YYYY-MM. */ | |
| 1676 | day: string; | |
| 1677 | month: string; | |
| 1678 | /** What g1t paid for itself today across every workspace. */ | |
| 1679 | todayMicros: number; | |
| 1680 | /** `PLATFORM_DAILY_SPEND_CAP_MICROS`; 0: no breaker. */ | |
| 1681 | dailyCapMicros: number; | |
| 1682 | /** New hosted-model agent runs g1t would pay for are paused. */ | |
| 1683 | tripped: boolean; | |
| 1684 | trippedAt: string | null; | |
| 1685 | liftedBy: string | null; | |
| 1686 | liftedAt: string | null; | |
| 1687 | liftNote: string | null; | |
| 1688 | /** This month so far, by what paid: comped, trial, oss, given, unpaid. */ | |
| 1689 | monthBuckets: { bucket: string; title: string; micros: number }[]; | |
| 1690 | comped: CompedBudget[]; | |
| 1691 | /** Free workspaces' share of reconciled costs this month (git, storage, platform). */ | |
| 1692 | freeTierMicros: number; | |
| Costs: Cloudflare's subscriptions read from Cloudflare each day, the estimate only until then; sudo's costs split into Costs & margin and Bill & pricing | 1693 | /** Cloudflare's subscriptions a month: read from Cloudflare each day, else `CLOUDFLARE_FIXED_MONTHLY_MICROS`, an estimate. */ |
| Spend caps: a monthly budget for comped workspaces and a daily breaker on what g1t pays | 1694 | fixedMonthlyMicros: number; |
| Costs: Cloudflare's subscriptions read from Cloudflare each day, the estimate only until then; sudo's costs split into Costs & margin and Bill & pricing | 1695 | fixedSource?: "cloudflare" | "estimate" | string; |
| 1696 | fixedReadAt?: string | null; | |
| 1697 | /** Each subscription, when read from Cloudflare. */ | |
| 1698 | fixedItems?: { name: string; monthlyMicros: number }[]; | |
| Spend caps: a monthly budget for comped workspaces and a daily breaker on what g1t pays | 1699 | /** Money in this month, through the last reconciled day. */ |
| 1700 | revenueMicros: number; | |
| 1701 | }; | |
| 1702 | ||
| 1703 | /** A comped account's monthly budget, at cost. */ | |
| 1704 | export type CompedBudget = { | |
| 1705 | account: string; | |
| 1706 | name: string; | |
| 1707 | usedMicros: number; | |
| 1708 | /** 0: no budget. */ | |
| 1709 | ceilingMicros: number; | |
| 1710 | /** `COMPED_MONTHLY_CEILING_MICROS`, not the account's own limit. */ | |
| 1711 | defaultCeiling: boolean; | |
| 1712 | /** 50, 75, 90, 100, or 0. */ | |
| 1713 | level: number; | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 1714 | }; |
| 1715 | ||
| 1716 | export type CostsRun = { lines: number; days: number; proposals: number; alerts: number; problems: string[] }; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1717 | |
| 1718 | /** The product families the Usage page groups meters into, in order. */ | |
| 1719 | export const PRODUCTS = [ | |
| 1720 | { key: "agent", label: "Agent" }, | |
| 1721 | { key: "sandboxes", label: "Sandboxes" }, | |
| 1722 | { key: "gateway", label: "AI Gateway" }, | |
| 1723 | { key: "deployments", label: "Deployments" }, | |
| 1724 | { key: "git_storage", label: "Git & storage" }, | |
| 1725 | { key: "packages", label: "Packages" }, | |
| 1726 | { key: "security", label: "Security & quality" }, | |
| 1727 | { key: "search", label: "Search" }, | |
| 1728 | ] as const; | |
| 1729 | ||
| 1730 | export type ProductKey = (typeof PRODUCTS)[number]["key"]; | |
| 1731 | ||
| 1732 | /** What usage came to over a range, and what paid for it: price − discount − included − credits = charged. */ | |
| 1733 | export type UsageTotals = { | |
| 1734 | /** Usage at price, pending usage included. */ | |
| 1735 | priceMicros: number; | |
| 1736 | discountMicros: number; | |
| 1737 | /** Paid by the plan's included usage, the trial and g1t's pools. */ | |
| 1738 | includedMicros: number; | |
| 1739 | /** Paid by AI credit and credit from g1t. */ | |
| 1740 | creditsMicros: number; | |
| 1741 | /** Left for the workspace to pay. */ | |
| 1742 | chargedMicros: number; | |
| 1743 | /** Metered this month, charged when it closes. */ | |
| 1744 | pendingMicros: number; | |
| 1745 | costMicros: number; | |
| 1746 | }; | |
| 1747 | ||
| 1748 | export type UsageDay = { day: string; product: string; micros: number }; | |
| 1749 | ||
| 1750 | export type UsageAllowance = { used: number; of: number; unit: string }; | |
| 1751 | ||
| 1752 | export type ProjectUsage = { project: string; micros: number; quantity: number }; | |
| 1753 | ||
| 1754 | /** One meter over a range. */ | |
| 1755 | export type MeterLine = { | |
| 1756 | key: string; | |
| 1757 | label: string; | |
| 1758 | product: string; | |
| 1759 | /** `tokens`, `seconds`, `bytes`, `operations`, `requests` or `entries`. */ | |
| 1760 | unit: string; | |
| 1761 | quantity: number; | |
| 1762 | micros: number; | |
| 1763 | pendingMicros?: number; | |
| 1764 | /** Every day of the range, oldest first, at price. */ | |
| 1765 | daily: number[]; | |
| 1766 | allowance?: UsageAllowance | null; | |
| 1767 | byProject: ProjectUsage[]; | |
| Merge branch 'model-routing' | 1768 | /** How the quantity is counted, when that needs saying (the agent rate's token weights). */ |
| 1769 | note?: string | null; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1770 | }; |
| 1771 | ||
| 1772 | export type FeatureUsage = { key: string; label: string; micros: number; count: number }; | |
| 1773 | ||
| 1774 | export type ProductUsage = { key: string; label: string; micros: number; meters: MeterLine[]; features?: FeatureUsage[] }; | |
| 1775 | ||
| Merge branch 'model-routing' | 1776 | /** The tokens one model used over a range, as the model proxy counted them. */ |
| 1777 | export type ModelTokens = { model: string; input: number; output: number; cacheRead: number; cacheWrite: number }; | |
| 1778 | ||
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1779 | export type UsageReport = { |
| 1780 | from: string; | |
| 1781 | until: string; | |
| 1782 | totals: UsageTotals; | |
| 1783 | days: UsageDay[]; | |
| 1784 | products: ProductUsage[]; | |
| 1785 | projects: string[]; | |
| Merge branch 'model-routing' | 1786 | /** Agent tokens by model over the range, most first. */ |
| 1787 | models?: ModelTokens[]; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1788 | /** The plan's included usage this month, in micros. */ |
| 1789 | included?: UsageAllowance | null; | |
| 1790 | discountPercent?: number | null; | |
| 1791 | aiCreditMicros: number; | |
| 1792 | creditMicros: number; | |
| 1793 | trialMicros?: number | null; | |
| 1794 | plan: PlanKind; | |
| 1795 | free: boolean; | |
| 1796 | }; | |
| 1797 | ||
| 1798 | export type AiReload = { | |
| 1799 | enabled: boolean; | |
| 1800 | thresholdMicros: number; | |
| 1801 | targetMicros: number; | |
| 1802 | monthlyMaxMicros: number; | |
| 1803 | reloadedMicros?: number; | |
| 1804 | failedAt?: string | null; | |
| 1805 | error?: string | null; | |
| 1806 | }; | |
| 1807 | ||
| 1808 | export type CardFee = { on: boolean; percentMicros: number; fixedCents: number }; | |
| 1809 | ||
| 1810 | /** Prepaid AI credit: what Agent and AI Gateway usage draws on. */ | |
| 1811 | export type AiCredit = { | |
| 1812 | balanceMicros: number; | |
| 1813 | purchasedMicros: number; | |
| 1814 | givenMicros: number; | |
| 1815 | grants: CreditGrant[]; | |
| 1816 | /** A 100% discount pays for AI usage: nothing to buy. */ | |
| 1817 | freeViaDiscount: boolean; | |
| 1818 | /** Invoiced after use (an enterprise). */ | |
| 1819 | postpaid: boolean; | |
| 1820 | /** New runs on g1t's models are refused for want of credit. */ | |
| 1821 | blocked: boolean; | |
| 1822 | canBuy: boolean; | |
| 1823 | presetsCents: number[]; | |
| 1824 | minCents: number; | |
| 1825 | maxCents: number; | |
| 1826 | cardFee: CardFee; | |
| 1827 | reload: AiReload; | |
| 1828 | /** The agent rate per million tokens, at price. */ | |
| 1829 | agentRateMicros: number; | |
| 1830 | modelMarkupPercent: number; | |
| 1831 | gatewayMarkupPercent: number; | |
| 1832 | upgradeCreditMicros: number; | |
| 1833 | expiresDays: number; | |
| 1834 | }; | |
| 1835 | ||
| 1836 | export type PostalAddress = { line1: string; line2: string; city: string; state: string; postalCode: string; country: string }; | |
| 1837 | ||
| 1838 | export type PaymentMethod = { | |
| 1839 | kind: string; | |
| 1840 | brand?: string | null; | |
| 1841 | last4?: string | null; | |
| 1842 | expMonth?: number | null; | |
| 1843 | expYear?: number | null; | |
| 1844 | }; | |
| 1845 | ||
| 1846 | export type StripeInvoice = { | |
| 1847 | id: string; | |
| 1848 | number?: string | null; | |
| 1849 | status: string; | |
| 1850 | totalCents: number; | |
| 1851 | currency: string; | |
| 1852 | createdAt: string; | |
| 1853 | description?: string | null; | |
| 1854 | hostedUrl?: string | null; | |
| 1855 | pdfUrl?: string | null; | |
| 1856 | }; | |
| 1857 | ||
| 1858 | export type UpcomingInvoice = { closesAt: string; subscriptionsMicros: number; usageMicros: number; totalMicros: number }; | |
| 1859 | ||
| 1860 | export type BillingDetails = { | |
| 1861 | customer: boolean; | |
| 1862 | email: string | null; | |
| 1863 | name: string | null; | |
| 1864 | address: PostalAddress | null; | |
| 1865 | taxIdType: string | null; | |
| 1866 | taxId: string | null; | |
| 1867 | poNumber: string | null; | |
| 1868 | language: string | null; | |
| 1869 | paymentMethod: PaymentMethod | null; | |
| 1870 | invoices: StripeInvoice[]; | |
| 1871 | upcoming: UpcomingInvoice; | |
| 1872 | unavailable?: string | null; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 1873 | /** Whether Stripe Tax can place the customer from the address; without it nothing is charged. */ |
| 1874 | taxLocation?: boolean; | |
| 1875 | /** Set when g1t did not charge for want of a billing address. */ | |
| 1876 | taxAddressNeededAt?: string | null; | |
| 1877 | /** Stripe's check of the tax ID: pending, verified, unverified or unavailable. */ | |
| 1878 | taxIdStatus?: string | null; | |
| 1879 | /** none, exempt or reverse, as set at Stripe. */ | |
| 1880 | taxExempt?: string | null; | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1881 | }; |
| 1882 | ||
| 1883 | export type BillingDetailsInput = { | |
| 1884 | email?: string; | |
| 1885 | name?: string; | |
| 1886 | address?: PostalAddress; | |
| 1887 | taxIdType?: string; | |
| 1888 | taxId?: string; | |
| 1889 | poNumber?: string; | |
| 1890 | language?: string; | |
| 1891 | }; |
This file's history is long; its oldest lines are credited to the oldest commit read.