Skip to main content

Budget Allocation & Token Cost Management

PostQode Enterprise provides multi-tier budget controls and real-time cost analytics in the PostQode Web Console (/budget, /billing-usage, /analytics), allowing organizations to set precise spending limits and prevent unexpected API overruns.


1. Multi-Tier Budget Hierarchy

PostQode enforces a hierarchical budgeting model, allowing administrators to configure spending boundaries at three distinct levels:

┌────────────────────────────────────────────────────────┐
│ Account-Level Budget │
│ (Organization Total / Monthly Cap) │
└───────────────────────────┬────────────────────────────┘

┌───────────────┴───────────────┐
▼ ▼
┌───────────────────────┐ ┌───────────────────────┐
│ Team-Level Budget │ │ Team-Level Budget │
│ (e.g., Team A) │ │ (e.g., Team B) │
└───────────┬───────────┘ └───────────┬───────────┘
│ │
┌───────┴───────┐ ┌───────┴───────┐
▼ ▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
│Member │ │Member │ │Member │ │Member │
│Budget │ │Budget │ │Budget │ │Budget │
└───────┘ └───────┘ └───────┘ └───────┘

Hierarchy Breakdown

Budget LevelScopeConfigured InDescription
Account BudgetEntire Organization/budget or /organizationSets the global expenditure limit across all teams, proxy keys, and developers.
Team BudgetSpecific Team/teams ➔ Team DetailsAllocates a dedicated spend envelope for an engineering squad or project group.
Member BudgetIndividual Developer/members ➔ Member DetailsCaps individual developer consumption to ensure equitable token distribution.

2. Configuring Budgets & Reset Periods

When configuring budgets for an account, team, or member, administrators define two core parameters:

Budget Parameters

  1. Limit ($): The dollar amount allocated for the target scope (e.g. $50.00, $250.00).
  2. Period:
    • MONTHLY: Automatically resets at the start of each calendar month, allocating fresh credits for the new billing cycle.
    • TOTAL: Sets a lifetime fixed ceiling. The limit remains fixed until manually adjusted or removed by an administrator.

Visual Spend Indicators & Thresholds

The Web Console displays real-time progress bars and color-coded status badges based on consumption:

Consumption RatioVisual IndicatorStatus Behavior
0% – 79%🟢 Green (text-green-600)Normal operating state. Requests route without restriction.
80% – 99%🟠 Amber (text-amber-500)Warning threshold reached. Team leads can monitor upcoming limits.
≥ 100%🔴 Red (text-red-500)Budget depleted. Gateway requests are automatically throttled until reset or budget increased.

3. Bulk Budget Management

To streamline onboarding across large engineering organizations, administrators can assign and update member budgets in bulk:

  1. Navigate to Members (/members) in the PostQode Web Console.
  2. Select multiple developers using the table checkboxes.
  3. Click Bulk Budget Management.
  4. Set the desired Limit ($) and select the Period (MONTHLY or TOTAL).
  5. Click Save Budget to apply the policy across all selected members simultaneously.
Bulk Deletion

Administrators can also remove individual or bulk member budgets with a single click, reverting developers to their parent team's shared allocation.


4. Real-Time Cost & Token Analytics

The Analytics Dashboard (/analytics or /dashboard) aggregates live telemetry across four dedicated views:

  • General View (👁️): High-level KPI cards (Total Cost, Total Tokens In/Out, Total Requests), member-level comparison bar charts with Cost / Tokens toggles, and model summary tables.
  • Member View (👥): Individual developer drilldown, tracking specific user token consumption, model choices, and CSV export.
  • Teams View (⛓️): Squad-level budget consumption, team totals, and member contributions within the team.
  • Gateway View (): Telemetry per proxy key, prompt caching read/write rates, and dollar expenditures.

Cost & Token Visualizations

  • Cost Overview Chart: Tracks total spending trajectories over daily, weekly, and monthly intervals.
  • Token Usage Chart: Real-time breakdown of Prompt Tokens, Completion Tokens, and total request counts.
  • Cache Token Usage Chart: Measures Cache Read Tokens versus uncached tokens, visualizing the 90%+ cost reductions achieved via prompt caching on supported providers (Anthropic Claude, DeepSeek, OpenAI).
  • Model Usage Table: Breakdown of spending and token distribution across models (claude-sonnet-5, deepseek-reasoner, gpt-4o, gemini-2.5-flash).
  • Team & Member Usage Tables: Granular leaderboards showing consumption per engineer and squad.

5. Gateway Key Usage & Invoices

Per-Key Usage Logs (/gateway-keys/:keyId/usage)

Inspect request-level telemetry for each generated gateway key:

  • Exact Model used per invocation.
  • Prompt, completion, and total tokens.
  • Calculated per-request dollar cost.
  • HTTP status code and response latency.

Billing Records & Invoices (/billing-usage)

  • Monthly consolidated billing statements.
  • Itemized breakdown of raw LLM costs, calculated platform charges, and enterprise licenses.
  • Invoice status tracking (DRAFT, FINALIZED, PENDING, PAID) with downloadable records.