Skip to content

[P1] Attribute provider usage and COGS by user, feature, and plan #122

Description

@postigodev

Context

Preppie cannot safely choose permanent pricing from flat per-user assumptions. OpenAI, ElevenLabs, vision, infrastructure, storage, and payment processing have different cost drivers. Voice duration is currently the largest unknown and may determine whether a $6.99/month plan is viable.

The product needs cost attribution that is operationally useful without retaining private prompts, transcripts, images, or recipe content.

Scope

Provider usage capture

  • Capture request counts, token/input/output usage, image usage, model/provider, latency, success/failure, and provider-reported cost fields where available for OpenAI operations.
  • Capture voice session start/end, connected duration, provider-billed duration/credits, silence discount where exposed, reconnects, model/provider, and outcome for ElevenLabs.
  • Capture vision CPU/GPU duration, request size, result count, and provider/infrastructure allocation where meaningful.
  • Capture external retailer/product-provider calls that have rate or financial implications.
  • Capture Stripe processing and Billing fees from settled transaction/invoice data rather than one flat percentage.

Cost model

  • Maintain versioned provider price tables with currency, unit, effective date, source URL, and verification date.
  • Calculate estimated cost per event using the applicable price version.
  • Reconcile estimates against actual provider invoices or dashboard exports monthly.
  • Separate variable provider COGS from shared fixed infrastructure allocation.
  • Preserve raw provider usage quantities so past periods can be recalculated if the cost formula was wrong.

Product reporting

Provide views for:

  • Cost per active free user, paid user, and voice-active user.
  • Cost per feature/category.
  • Cost and contribution margin by plan and cohort.
  • Heavy-user distribution and p50/p90/p95 usage.
  • Voice connected minutes versus provider-billed minutes.
  • Free-to-paid subsidy and trial cost.
  • Revenue, refunds, fees, net revenue, variable COGS, and contribution margin.

Guardrails

  • Add alerts for abnormal token use, long/repeated voice sessions, reconnect loops, provider price changes, invoice variance, and plan-level negative margin.
  • Support provider and application spend caps where available.
  • Define a monthly pricing review using measured data from this issue and the source register.

Privacy

  • Do not persist raw prompts, transcripts, audio, images, recipes, or pantry contents solely for cost analytics.
  • Use opaque user/account references and sanitized feature metadata.
  • Define retention and aggregation policy for detailed events.

Acceptance criteria

  • OpenAI and ElevenLabs usage can be attributed to user, plan, feature, and billing period without storing content.
  • Voice reports distinguish connected duration from provider-billed duration where the provider exposes both.
  • Stripe fees use settled transaction/invoice evidence rather than a fixed modeled percentage.
  • Provider price tables are versioned and source-linked.
  • Estimated monthly provider cost is reconciled against actual invoices/dashboard totals.
  • Contribution margin is visible by plan and usage cohort.
  • Alerts detect reconnect loops, extreme users, cost spikes, and materially negative plan margin.
  • Pricing decisions can be made using at least two complete billing cycles of measured data.

Dependencies

Out of scope

  • Full corporate accounting or GAAP revenue recognition.
  • Storing private content for analytics convenience.
  • Automatically changing customer pricing without human approval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions