206 lines · 5.1 KB
/** The meter catalog: every billable thing the platform records. Pure data, shared by server and UI. */
export type MeterKind = "counter" | "gauge";
export type MeterCategory = "storage" | "compute" | "network" | "ai" | "ops";

export type MeterDef = {
  id: string;
  label: string;
  category: MeterCategory;
  unit: "bytes" | "seconds" | "ms" | "count" | "tokens";
  kind: MeterKind;
  /** Price in micro-cents (1e-6 cent) per unit above the plan's included amount; 0 means free. */
  microCentsPerUnit: number;
};

const GB = 1024 ** 3;

export const METERS = [
  {
    id: "storage.artifacts",
    label: "Repository storage",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: 2_000_000 / GB,
  },
  {
    id: "storage.lfs",
    label: "LFS storage",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: 7_000_000 / GB,
  },
  {
    id: "storage.ci_cache",
    label: "Actions cache",
    category: "storage",
    unit: "bytes",
    kind: "gauge",
    microCentsPerUnit: 7_000_000 / GB,