Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(billing): show Desktop usage components (#79067)

Adam Bowkerb267242cb9b1
diff --git a/ee/billing/billing_manager.py b/ee/billing/billing_manager.py
index dbcf508c490f..4bd29fd37745 100644
--- a/ee/billing/billing_manager.py
+++ b/ee/billing/billing_manager.py
@@ -244,6 +244,17 @@ class BillingManager:
response["stripe_portal_url"] = f"{settings.SITE_URL}/api/billing/portal"
+ usage_summary = response.get("usage_summary") or {}
+ if organization.usage:
+ for usage_key, usage in usage_summary.items():
+ # both dicts carry non-usage entries, e.g. "period" is a list
+ org_usage = organization.usage.get(usage_key)
+ if not isinstance(org_usage, dict) or not isinstance(usage, dict):
+ continue
+ todays_usage = org_usage.get("todays_usage")
+ if todays_usage is not None:
+ usage["todays_usage"] = todays_usage
+
# Extend the products with accurate usage_limit info
for product in response["products"]:
usage_key = product.get("usage_key")
@@ -254,12 +265,8 @@ class BillingManager:
billing_reported_usage = usage.get("usage") or 0
current_usage = billing_reported_usage
- product_usage: dict[str, Any] = {}
- if organization and organization.usage:
- product_usage = organization.usage.get(usage_key) or {}
-
- if product_usage.get("todays_usage"):
- todays_usage = product_usage["todays_usage"]
+ if usage.get("todays_usage"):
+ todays_usage = usage["todays_usage"]
current_usage = billing_reported_usage + todays_usage
product["current_usage"] = current_usage
diff --git a/ee/billing/test/test_billing_manager.py b/ee/billing/test/test_billing_manager.py
index 3beb381fbad0..3454616d9b7c 100644
--- a/ee/billing/test/test_billing_manager.py
+++ b/ee/billing/test/test_billing_manager.py
@@ -76,6 +76,41 @@ class TestBillingManager(BaseTest):
"https://billing.posthog.com/api/products-v2", params={"plan": "standard"}, headers={}
)
+ def test_get_billing_adds_todays_usage_to_usage_summary(self):
+ license = super(LicenseManager, cast(LicenseManager, License.objects)).create(
+ key="key123::key123",
+ plan="enterprise",
+ valid_until=datetime.datetime(2038, 1, 19, 3, 14, 7),
+ )
+ self.organization.usage = {
+ "posthog_code_token_credits": {"usage": 1200, "todays_usage": 34, "limit": None},
+ "period": ["2022-10-07T11:12:48", "2022-11-07T11:12:48"],
+ }
+ manager = BillingManager(license)
+ billing_response = {
+ "customer": {
+ "products": [],
+ "usage_summary": {
+ "posthog_code_token_credits": {"usage": 1200, "limit": None},
+ "period": ["2022-10-07T11:12:48", "2022-11-07T11:12:48"],
+ },
+ }
+ }
+
+ with (
+ patch.object(manager, "_get_billing", return_value=billing_response),
+ patch.object(manager, "update_org_details"),
+ patch.object(manager, "get_default_products", return_value={"products": []}),
+ ):
+ response = manager.get_billing(self.organization)
+
+ assert response["usage_summary"]["posthog_code_token_credits"] == {
+ "usage": 1200,
+ "limit": None,
+ "todays_usage": 34,
+ }
+ assert response["usage_summary"]["period"] == ["2022-10-07T11:12:48", "2022-11-07T11:12:48"]
+
@parameterized.expand(
[
("with_ip", "203.0.113.7", True),
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 20e9543e60b3..f77ac7362229 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8088,6 +8088,18 @@ snapshots:
hash: v1.k794b7964.924843ea467d84943495cc8a3056c6f469da31ea69ed097cb485f6348410f77e.qyTPRNCs1NnpxcMQ3t1SthuCpSr4_HIXQXDtWL-QdwQ
scenes-other-billing-billinglinegraph--with-marker-at-range-start--light:
hash: v1.k794b7964.5948fea6ef855d327f6d59f1ed10eb3fd55808540eda078bee5fed552523a4c0.FTXekbDFuL1YE5ad9VyyBtq5lOBiNalah41lHdISQOE
+ scenes-other-billing-desktopusagebreakdown--no-usage--dark:
+ hash: v1.k794b7964.c4a269e9294e2a91457f55f61c92fd7a2be76bd01697be8110a6a521ffe4e259.zVql89Qrf4TpYEZLsF8P0YBEmeSWfjWu3ug_Vn05TNE
+ scenes-other-billing-desktopusagebreakdown--no-usage--light:
+ hash: v1.k794b7964.52c84b283c7c7a66a3dff631676a4f38f2638ae40797d521b026c0af162ae865.EtK9KPsvnlS8w6lGGNaBV5xFWxySGm5viXNk9JWHegA
+ scenes-other-billing-desktopusagebreakdown--resources-unavailable--dark:
+ hash: v1.k794b7964.8dffd1fbfec28d0acf7f1cfacac16498ccefbea6cf0a36fe95b3bff9298a38f9.8OOExOg6aw4wbIPCEB25pSMwoMC4eqFt1KIZiyDD2zE
+ scenes-other-billing-desktopusagebreakdown--resources-unavailable--light:
+ hash: v1.k794b7964.cee76c88340ad14f6123d80e03faa8b0fa30cd8229a8a1f3f882bfdd2f5fbe4a.HoHDeKm6rYX-Sl3uPkZo1mstXYtwF-bMWHMMbcUSAoM
+ scenes-other-billing-desktopusagebreakdown--usage-mix--dark:
+ hash: v1.k794b7964.2c28449c679f7e5e89ec05fd6d681ddebbf9b031102a88ab08cd975e555b919f.YK_K1fOZZ8wYf8qvJlLRXZuKd31GnNaEhiKJOm0hci0
+ scenes-other-billing-desktopusagebreakdown--usage-mix--light:
+ hash: v1.k794b7964.a78b7addf891aa84f730a810d99c8e34c048b49fd8a489e755ed064cb64ebe68.ssx9pdKw8PVqxdqpUcP7LZ-9gNLa11vNHRoy6Uzg94Q
scenes-other-billing-product--billing-product-inclusion-only-with-addon--dark:
hash: v1.k794b7964.ce05ab37980f7fc148ea8681fee7b0eeb1f046266e8a7df22fbfc5cc8cefb8e7.hjk8pf9SicO_kBVjVXooUrPaBUj_76AzOPVXuwydGkE
scenes-other-billing-product--billing-product-inclusion-only-with-addon--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index a6775f088213..f63f967e39ae 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -435,6 +435,7 @@ export const FEATURE_FLAGS = {
POSTHOG_AI_QUEUE_MESSAGES_SYSTEM: 'posthog-ai-queue-messages-system', // owner: #team-posthog-ai
POSTHOG_CODE_BILLING: 'posthog-code-billing', // owner: #team-posthog-code
POSTHOG_CONNECT: 'posthog-connect', // owner: @Gilbert09, gates the "connect another PostHog project" personal integration
+ POSTHOG_DESKTOP_CLOUD_COMPUTE_BILLING: 'posthog-desktop-cloud-compute-billing', // owner: #team-posthog-code
PRODUCT_ANALYTICS_DASHBOARD_COLORS: 'dashboard-colors', // owner: @thmsobrmlr #team-product-analytics
PRODUCT_ANALYTICS_DASHBOARD_MODAL_SMART_DEFAULTS: 'product-analytics-dashboard-modal-smart-defaults', // owner: @sam #team-product-analytics
PRODUCT_ANALYTICS_INSIGHT_HORIZONTAL_CONTROLS: 'insight-horizontal-controls', // owner: #team-product-analytics
diff --git a/frontend/src/scenes/billing/BillingProduct.tsx b/frontend/src/scenes/billing/BillingProduct.tsx
index c40b83a39cdf..522fd6de8352 100644
--- a/frontend/src/scenes/billing/BillingProduct.tsx
+++ b/frontend/src/scenes/billing/BillingProduct.tsx
@@ -7,7 +7,7 @@ import { IconChevronRight } from '@posthog/icons'
import { LemonButton, LemonTag, Link } from '@posthog/lemon-ui'
import { BillingUpgradeCTA } from 'lib/components/BillingUpgradeCTA'
-import { FeatureFlagKey, UNSUBSCRIBE_SURVEY_ID } from 'lib/constants'
+import { FEATURE_FLAGS, FeatureFlagKey, UNSUBSCRIBE_SURVEY_ID } from 'lib/constants'
import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { More } from 'lib/lemon-ui/LemonButton/More'
@@ -33,6 +33,7 @@ import { BillingProductAddon } from './BillingProductAddon'
import { billingProductLogic } from './billingProductLogic'
import { BillingProductPricingTable } from './BillingProductPricingTable'
import { REALTIME_DESTINATIONS_BILLING_START_DATE } from './constants'
+import { DesktopUsageBreakdown } from './DesktopUsageBreakdown'
import { paymentEntryLogic } from './paymentEntryLogic'
import { PlatformAddonComparison } from './PlatformAddonComparison'
import { ProductPricingModal } from './ProductPricingModal'
@@ -530,6 +531,11 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
</div>
)}
+ {product.type === 'posthog_code_usage' &&
+ featureFlags[FEATURE_FLAGS.POSTHOG_DESKTOP_CLOUD_COMPUTE_BILLING] && (
+ <DesktopUsageBreakdown summary={billing?.usage_summary} />
+ )}
+
{product.price_description ? (
<LemonBanner type="info">
<span>{product.price_description}</span>
diff --git a/frontend/src/scenes/billing/DesktopUsageBreakdown.stories.tsx b/frontend/src/scenes/billing/DesktopUsageBreakdown.stories.tsx
new file mode 100644
index 000000000000..875c68dfc3db
--- /dev/null
+++ b/frontend/src/scenes/billing/DesktopUsageBreakdown.stories.tsx
@@ -0,0 +1,72 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { BillingType } from '~/types'
+
+import { DesktopUsageBreakdown } from './DesktopUsageBreakdown'
+
+type UsageSummary = BillingType['usage_summary']
+
+const summary = ({
+ tokenCredits,
+ computeCredits,
+ cpuMillicoreSeconds,
+ memoryMibSeconds,
+}: {
+ tokenCredits: number
+ computeCredits: number
+ cpuMillicoreSeconds?: number
+ memoryMibSeconds?: number
+}): UsageSummary => ({
+ posthog_code_token_credits: { usage: tokenCredits },
+ sandbox_compute_credits: { usage: computeCredits },
+ sandbox_compute_cpu_millicore_seconds: { usage: cpuMillicoreSeconds },
+ sandbox_compute_memory_mib_seconds: { usage: memoryMibSeconds },
+})
+
+const meta: Meta<typeof DesktopUsageBreakdown> = {
+ title: 'Scenes-Other/Billing/DesktopUsageBreakdown',
+ component: DesktopUsageBreakdown,
+ parameters: { layout: 'padded' },
+ decorators: [
+ (Story) => (
+ <div className="w-[720px] max-w-full">
+ <Story />
+ </div>
+ ),
+ ],
+}
+
+export default meta
+
+type Story = StoryObj<typeof DesktopUsageBreakdown>
+
+export const UsageMix: Story = {
+ args: {
+ summary: summary({
+ tokenCredits: 1_250,
+ computeCredits: 750,
+ cpuMillicoreSeconds: 45_000,
+ memoryMibSeconds: 92_160,
+ }),
+ },
+}
+
+export const NoUsage: Story = {
+ args: {
+ summary: summary({
+ tokenCredits: 0,
+ computeCredits: 0,
+ cpuMillicoreSeconds: 0,
+ memoryMibSeconds: 0,
+ }),
+ },
+}
+
+export const ResourcesUnavailable: Story = {
+ args: {
+ summary: summary({
+ tokenCredits: 1_250,
+ computeCredits: 750,
+ }),
+ },
+}
diff --git a/frontend/src/scenes/billing/DesktopUsageBreakdown.test.tsx b/frontend/src/scenes/billing/DesktopUsageBreakdown.test.tsx
new file mode 100644
index 000000000000..3d585107317d
--- /dev/null
+++ b/frontend/src/scenes/billing/DesktopUsageBreakdown.test.tsx
@@ -0,0 +1,57 @@
+import '@testing-library/jest-dom'
+
+import { render, screen } from '@testing-library/react'
+
+import { DesktopUsageBreakdown, getDesktopUsageComponents } from './DesktopUsageBreakdown'
+
+describe('DesktopUsageBreakdown', () => {
+ it('converts credits and resource quantities for display', () => {
+ render(
+ <DesktopUsageBreakdown
+ summary={{
+ posthog_code_token_credits: { usage: 1234 },
+ sandbox_compute_credits: { usage: 266 },
+ sandbox_compute_cpu_millicore_seconds: { usage: 1500 },
+ sandbox_compute_memory_mib_seconds: { usage: 4608 },
+ }}
+ />
+ )
+ const usageMix = screen.getByLabelText('82% tokens and 18% cloud compute')
+ expect(usageMix.firstElementChild).toHaveStyle({ width: '82%' })
+ expect(screen.getByText(/\$12\.34/)).toBeTruthy()
+ expect(screen.getByText(/\$2\.66/)).toBeTruthy()
+ expect(screen.getByText(/1\.5 core-seconds · 4\.5 GiB-seconds/)).toBeTruthy()
+ })
+
+ it('preserves explicit zero', () => {
+ render(
+ <DesktopUsageBreakdown
+ summary={{
+ posthog_code_token_credits: { usage: 0 },
+ sandbox_compute_credits: { usage: 0 },
+ }}
+ />
+ )
+ expect(screen.getByLabelText('0% tokens and 0% cloud compute')).toBeTruthy()
+ expect(screen.getAllByText(/\$0\.00/)).toHaveLength(2)
+ expect(screen.getByText(/CPU unavailable · Memory unavailable/)).toBeTruthy()
+ })
+
+ it('includes todays usage in component totals', () => {
+ expect(
+ getDesktopUsageComponents({
+ posthog_code_token_credits: { usage: 1200, todays_usage: 34 },
+ sandbox_compute_credits: { usage: 200, todays_usage: 66 },
+ })
+ ).toMatchObject({ tokenCredits: 1234, computeCredits: 266 })
+ })
+
+ it('hides the breakdown when credit components are absent or incomplete', () => {
+ const { container, rerender } = render(<DesktopUsageBreakdown summary={undefined} />)
+ expect(container).toBeEmptyDOMElement()
+ expect(getDesktopUsageComponents(undefined)).toBeNull()
+
+ rerender(<DesktopUsageBreakdown summary={{ posthog_code_token_credits: { usage: 0 } }} />)
+ expect(container).toBeEmptyDOMElement()
+ })
+})
diff --git a/frontend/src/scenes/billing/DesktopUsageBreakdown.tsx b/frontend/src/scenes/billing/DesktopUsageBreakdown.tsx
new file mode 100644
index 000000000000..9c50e5039ae5
--- /dev/null
+++ b/frontend/src/scenes/billing/DesktopUsageBreakdown.tsx
@@ -0,0 +1,112 @@
+import { humanFriendlyCurrency } from 'lib/utils/numbers'
+
+import { BillingType } from '~/types'
+
+type UsageSummary = BillingType['usage_summary']
+
+export interface DesktopUsageComponents {
+ tokenCredits: number | null
+ computeCredits: number | null
+ cpuMillicoreSeconds: number | null
+ memoryMibSeconds: number | null
+}
+
+const componentValue = (summary: UsageSummary, key: string): number | null => {
+ const component = summary?.[key]
+ return component?.usage == null ? null : component.usage + (component.todays_usage ?? 0)
+}
+
+export const getDesktopUsageComponents = (summary: UsageSummary): DesktopUsageComponents | null => {
+ const keys = [
+ 'posthog_code_token_credits',
+ 'sandbox_compute_credits',
+ 'sandbox_compute_cpu_millicore_seconds',
+ 'sandbox_compute_memory_mib_seconds',
+ ]
+ if (!summary || !keys.some((key) => key in summary)) {
+ return null
+ }
+ return {
+ tokenCredits: componentValue(summary, keys[0]),
+ computeCredits: componentValue(summary, keys[1]),
+ cpuMillicoreSeconds: componentValue(summary, keys[2]),
+ memoryMibSeconds: componentValue(summary, keys[3]),
+ }
+}
+
+const formatQuantity = (value: number, divisor: number, unit: string): string =>
+ `${new Intl.NumberFormat(undefined, { maximumFractionDigits: 3 }).format(value / divisor)} ${unit}`
+
+const MixLegend = ({
+ color,
+ label,
+ percent,
+ value,
+}: {
+ color: string
+ label: string
+ percent: number
+ value: string
+}): JSX.Element => (
+ <div className="flex items-center gap-2 text-sm">
+ <span className={`size-2 rounded-full ${color}`} />
+ <span>
+ <strong>{percent}%</strong> {label}
+ <span className="text-secondary"> · {value}</span>
+ </span>
+ </div>
+)
+
+export const DesktopUsageBreakdown = ({ summary }: { summary: UsageSummary }): JSX.Element | null => {
+ const components = getDesktopUsageComponents(summary)
+ if (components?.tokenCredits == null || components.computeCredits == null) {
+ return null
+ }
+
+ const totalCredits = components.tokenCredits + components.computeCredits
+ const tokenPercent = totalCredits > 0 ? (components.tokenCredits / totalCredits) * 100 : 0
+ const roundedTokenPercent = Math.round(tokenPercent)
+ const computePercent = totalCredits > 0 ? 100 - roundedTokenPercent : 0
+ const resourceDetails = [
+ components.cpuMillicoreSeconds == null
+ ? 'CPU unavailable'
+ : formatQuantity(components.cpuMillicoreSeconds, 1_000, 'core-seconds'),
+ components.memoryMibSeconds == null
+ ? 'Memory unavailable'
+ : formatQuantity(components.memoryMibSeconds, 1_024, 'GiB-seconds'),
+ ].join(' · ')
+
+ return (
+ <div className="mt-4 rounded bg-bg-light p-4 space-y-3">
+ <h4 className="mb-0">Usage mix</h4>
+ <div
+ role="img"
+ aria-label={`${roundedTokenPercent}% tokens and ${computePercent}% cloud compute`}
+ className="flex h-3 w-full overflow-hidden rounded-full bg-border"
+ >
+ {totalCredits > 0 && (
+ <>
+ <div className="bg-accent" style={{ width: `${roundedTokenPercent}%` }} />
+ <div className="flex-1 bg-[var(--data-color-2)]" />
+ </>
+ )}
+ </div>
+ <div className="flex flex-wrap items-center gap-x-5 gap-y-2">
+ <MixLegend
+ color="bg-accent"
+ label="Tokens"
+ percent={roundedTokenPercent}
+ value={humanFriendlyCurrency(components.tokenCredits / 100)}
+ />
+ <MixLegend
+ color="bg-[var(--data-color-2)]"
+ label="Cloud compute"
+ percent={computePercent}
+ value={humanFriendlyCurrency(components.computeCredits / 100)}
+ />
+ </div>
+ <p className="mb-0 text-xs text-secondary">Compute resources: {resourceDetails}</p>
+ <p className="mb-0 text-xs text-secondary">Usage reporting may be delayed by 15–20 minutes.</p>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/billing/billingUsageLogic.test.ts b/frontend/src/scenes/billing/billingUsageLogic.test.ts
new file mode 100644
index 000000000000..b191aff6ea14
--- /dev/null
+++ b/frontend/src/scenes/billing/billingUsageLogic.test.ts
@@ -0,0 +1,60 @@
+import { BillingUsageResponse, BillingUsageResponseBreakdownType, convertDesktopUsageSeries } from './billingUsageLogic'
+
+const series = (label: string, usageType: string, data: number[]): BillingUsageResponse['results'][number] => ({
+ id: 1,
+ label,
+ data,
+ dates: ['2026-08-01'],
+ breakdown_type: BillingUsageResponseBreakdownType.TYPE,
+ breakdown_value: usageType,
+})
+
+describe('convertDesktopUsageSeries', () => {
+ it.each([
+ [
+ 'PostHog Desktop token credits',
+ 'posthog_code_token_credits_used_in_period',
+ 1234,
+ 12.34,
+ 'PostHog Desktop token spend (USD)',
+ ],
+ ['Sandbox compute credits', 'sandbox_compute_credits_used_in_period', 266, 2.66, 'Cloud compute spend (USD)'],
+ [
+ 'Sandbox compute CPU millicore-seconds',
+ 'sandbox_compute_cpu_millicore_seconds_in_period',
+ 1500,
+ 1.5,
+ 'Cloud compute CPU (core-seconds)',
+ ],
+ [
+ 'Sandbox compute memory MiB-seconds',
+ 'sandbox_compute_memory_mib_seconds_in_period',
+ 4608,
+ 4.5,
+ 'Cloud compute memory (GiB-seconds)',
+ ],
+ ])('converts %s without changing missing points', (label, usageType, input, output, expectedLabel) => {
+ expect(convertDesktopUsageSeries(series(label, usageType, [input]))).toMatchObject({
+ label: expectedLabel,
+ data: [output],
+ })
+ })
+
+ it('leaves unrelated usage series unchanged', () => {
+ const input = series('Events', 'events', [10])
+ expect(convertDesktopUsageSeries(input)).toBe(input)
+ })
+
+ it('converts a project breakdown and preserves its label', () => {
+ const input = {
+ ...series('my-project::PostHog Desktop token credits', 'posthog_code_token_credits_used_in_period', [1234]),
+ breakdown_type: BillingUsageResponseBreakdownType.MULTIPLE,
+ breakdown_value: ['posthog_code_token_credits_used_in_period', 'my-project'],
+ }
+
+ expect(convertDesktopUsageSeries(input)).toMatchObject({
+ label: 'my-project::PostHog Desktop token spend (USD)',
+ data: [12.34],
+ })
+ })
+})
diff --git a/frontend/src/scenes/billing/billingUsageLogic.ts b/frontend/src/scenes/billing/billingUsageLogic.ts
index 35acc10d3bd8..facd9d97a789 100644
--- a/frontend/src/scenes/billing/billingUsageLogic.ts
+++ b/frontend/src/scenes/billing/billingUsageLogic.ts
@@ -54,6 +54,35 @@ export interface BillingUsageResponse {
next?: string
}
+const DESKTOP_USAGE_SERIES_CONVERSIONS: Record<string, { divisor: number; label: string }> = {
+ posthog_code_token_credits_used_in_period: { divisor: 100, label: 'PostHog Desktop token spend (USD)' },
+ sandbox_compute_credits_used_in_period: { divisor: 100, label: 'Cloud compute spend (USD)' },
+ sandbox_compute_cpu_millicore_seconds_in_period: {
+ divisor: 1_000,
+ label: 'Cloud compute CPU (core-seconds)',
+ },
+ sandbox_compute_memory_mib_seconds_in_period: {
+ divisor: 1_024,
+ label: 'Cloud compute memory (GiB-seconds)',
+ },
+}
+
+export const convertDesktopUsageSeries = (
+ series: BillingUsageResponse['results'][number]
+): BillingUsageResponse['results'][number] => {
+ const usageType = Array.isArray(series.breakdown_value) ? series.breakdown_value[0] : series.breakdown_value
+ const conversion = usageType ? DESKTOP_USAGE_SERIES_CONVERSIONS[usageType] : undefined
+ const labelSeparatorIndex = series.label.lastIndexOf('::')
+ const labelPrefix = labelSeparatorIndex === -1 ? '' : series.label.slice(0, labelSeparatorIndex + 2)
+ return conversion
+ ? {
+ ...series,
+ label: `${labelPrefix}${conversion.label}`,
+ data: series.data.map((value) => value / conversion.divisor),
+ }
+ : series
+}
+
export const DEFAULT_BILLING_USAGE_FILTERS: BillingFilters = {
breakdowns: ['type'],
usage_types: [],
@@ -387,7 +416,7 @@ export const billingUsageLogic = kea<billingUsageLogicType>([
return []
}
- return response.results
+ return response.results.map(convertDesktopUsageSeries)
},
],
dates: [
diff --git a/frontend/src/scenes/billing/constants.ts b/frontend/src/scenes/billing/constants.ts
index 59e568c207ae..74203a002438 100644
--- a/frontend/src/scenes/billing/constants.ts
+++ b/frontend/src/scenes/billing/constants.ts
@@ -27,10 +27,10 @@ export const SPEND_TYPES = [
] as const
export const USAGE_ONLY_TYPES = [
- { label: 'PostHog Desktop token credits', value: 'posthog_code_token_credits_used_in_period' },
- { label: 'Sandbox compute credits', value: 'sandbox_compute_credits_used_in_period' },
- { label: 'Sandbox compute CPU millicore-seconds', value: 'sandbox_compute_cpu_millicore_seconds_in_period' },
- { label: 'Sandbox compute memory MiB-seconds', value: 'sandbox_compute_memory_mib_seconds_in_period' },
+ { label: 'PostHog Desktop token spend (USD)', value: 'posthog_code_token_credits_used_in_period' },
+ { label: 'Cloud compute spend (USD)', value: 'sandbox_compute_credits_used_in_period' },
+ { label: 'Cloud compute CPU (core-seconds)', value: 'sandbox_compute_cpu_millicore_seconds_in_period' },
+ { label: 'Cloud compute memory (GiB-seconds)', value: 'sandbox_compute_memory_mib_seconds_in_period' },
] as const
export const USAGE_TYPES = [...SPEND_TYPES, ...USAGE_ONLY_TYPES] as const
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 74a7496c4648..089ce6a5df26 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -2377,6 +2377,7 @@ export interface BillingType {
projected_total_amount_usd_with_limit?: string
projected_total_amount_usd_with_limit_after_discount?: string
products: BillingProductV2Type[]
+ usage_summary?: Record<string, { usage?: number | null; limit?: number | null; todays_usage?: number | null }>
custom_limits_usd?: {
[key: string]: number | null