Skip to content
PALM SOUQ

Per-tenant metering

Know exact LLM COGS for every customer down to the microcent.

Every request is priced from the provider's own usage counts and attributed to the tenant, workspace, user and feature that caused it. Finance gets margin per customer while the month is still open.

Six attribution keys · cache reads, writes and reasoning tokens priced separately
ledger record · req_01JD8Q4M2X9F
{
  "request_id": "req_01JD8Q4M2X9F",
  "ts": "2026-11-08T09:14:22.418Z",
  "tenant": "acme-legal",          // X-PalmSouq-Tenant
  "workspace": "litigation-team",  // X-PalmSouq-Workspace
  "user": "u_7f21c0",              // X-PalmSouq-User
  "feature": "contract-review",    // X-PalmSouq-Feature
  "tier": "pro",                   // X-PalmSouq-Tier
  "provider": "anthropic",
  "model": "claude-sonnet-4.5",
  "usage": {
    "input_uncached": 2240,
    "cache_read": 16000,
    "cache_write": 0,
    "output": 912,
    "reasoning": 0
  },
  "cost_usd": 0.02520,
  "currency_source": "USD list",
  "policy": "served",
  "payload_stored": false
}

Customer profitability

Find the customers your pricing is losing money on.

MRR comes from your billing system, COGS from the gateway ledger. Sort by worst margin, switch to the weekly heatmap, and see which tenants turned negative and when.

tenants / profitability
MRR
$7,091.00
LLM COGS
$3,555.70
Gross margin
50%
Negative-margin tenants
2
TenantTierMRRLLM COGS Margin Top feature
acme-legalPro$99.00$298.20-201%contract-review
umbrella-hrStarter$49.00$52.30-7%resume-screen
massive-dynamicPro$99.00$93.705%research-agent
stark-salesTeam$299.00$272.609%call-notes
soylent-healthEnterprise$1,800.00$1,233.2031%chart-summary
pied-piperTeam$299.00$193.8035%code-review
northwind-opsTeam$299.00$125.7058%inbox-triage
wayne-financeEnterprise$2,400.00$862.5064%report-drafts
hooli-supportPro$99.00$27.5072%reply-suggest
globex-aiEnterprise$1,500.00$379.4075%agent-runs
initechPro$99.00$12.2088%ticket-summary
vandelay-importStarter$49.00$4.6091%doc-extract

Attribution keys

Six ways to slice every dollar.

Pass identity as headers and PALM SOUQ writes it onto the ledger record. Nothing is inferred from prompt content.

Tenant ID
Your customer or org id. Required. Joins to MRR in billing.
Workspace ID
Team or project inside a tenant, for seat-based plans.
End-user ID
Find the power user inside a profitable account.
Feature / tag
Which product surface spent it: chat, agent, summary.
Model
Resolved serving model, after any fallback rewrite.
Token type
Prompt vs completion vs cache read vs cache write vs reasoning.

Normalisation

Five usage formats in, one ledger out.

Every provider reports tokens differently, and several bill cached or reasoning tokens at their own rate. PALM SOUQ maps them to one schema so cross-provider reports add up.

ProviderFields the provider returnsPALM SOUQ ledger fields
OpenAI / Azure OpenAIprompt_tokens, prompt_tokens_details.cached_tokens, completion_tokens_details.reasoning_tokensinput_uncached, cache_read, output, reasoning
Anthropic / Bedrock (Claude)input_tokens, cache_creation_input_tokens, cache_read_input_tokens, output_tokensinput_uncached, cache_write, cache_read, output
Google Gemini / Vertex AIpromptTokenCount, cachedContentTokenCount, candidatesTokenCount, thoughtsTokenCountinput_uncached, cache_read, output, reasoning
DeepSeekprompt_cache_hit_tokens, prompt_cache_miss_tokens, completion_tokenscache_read, input_uncached, output
Groq, Mistral, Together AIprompt_tokens, completion_tokensinput_uncached, output

Worked example, priced from the PALM SOUQ price table: the ledger record above is a Claude Sonnet 4.5 call with 2,240 uncached input tokens at $3/M, 16,000 cache reads at $0.3/M and 912 output tokens at $15/M, which comes to $0.02520. Without the cache split the same call would be priced at $0.06840, overstating that tenant's COGS by 171%.

anomaly · acme-legal4.6x baseline
Hourly spend for tenant acme-legal: steady near $4.20 per hour, then rising to $19.40 by 19:00, outside the 7-day baseline band.$0$5$10$15$20alert 17:0000:0005:0010:0015:0019:00
baseline $4.20/hband ±$0.90 (3σ, 7 days)webhook spend.anomaly sent

Anomaly detection

Alerts against each tenant's own baseline.

A fixed threshold either fires all day for your biggest customer or never fires for your smallest. PALM SOUQ learns a 7-day rolling baseline per tenant and hour of day, and alerts when spend leaves the band.

  • Alert to Slack, PagerDuty, email or your own webhook.
  • Attach an action: tighten the quota, force a fallback, or open the breaker.
  • Seasonality aware: Monday mornings do not page anyone.

Export

Your data, in the tools you already use.

  • CSVAny filtered view in the console, or a scheduled daily file to S3, GCS or Azure Blob.All plans
  • ParquetHourly partitioned ledger files for Snowflake, BigQuery or Databricks. Columns match the ledger record above.Growth and Scale
  • OpenTelemetryOTLP metrics and spans with GenAI semantic conventions and palmsouq.* attributes.Growth and Scale
  • DatadogMetrics and breaker events tagged by tenant, tier, model and feature.Growth and Scale
  • PrometheusA scrape endpoint per org exposing palmsouq_tokens_total and palmsouq_cost_usd_total counters.Growth and Scale
Attribution keys per request
6
Token types priced separately
5
Ledger retention on Growth
13 mo
Prompt content stored
0 bytes

Metering questions

How precise is the cost per tenant?

Each request is priced from the provider's own usage counts against the list price for that model, cache state and price band, to six decimal places of a dollar. If you have negotiated rates or provisioned capacity, upload your rate card and PALM SOUQ uses it instead.

What if a request has no tenant header?

It is metered under an unattributed bucket and flagged in the console, so you can find the code path that forgot the header. You can also make the tenant header required, in which case untagged calls get a 400 response.

Can I attribute to more than one level?

Yes. Tenant is required; workspace, user and feature are optional and can be combined freely. Reports roll up from user to workspace to tenant, and any level can carry its own quota.

How are currencies handled?

Providers bill in USD. PALM SOUQ stores USD as the source of truth and converts to INR, EUR, GBP or another currency at a daily reference rate for reporting, so finance can compare COGS with revenue in the currency the customer pays.

See margin per customer before the invoice closes.

Route your agent traffic through PALM SOUQ in 2 minutes. Change one base URL, pass a tenant header, and every token is attributed and governed.

14-day free production trial · 100k requests included · no card required