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.
{
"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.
- MRR
- $7,091.00
- LLM COGS
- $3,555.70
- Gross margin
- 50%
- Negative-margin tenants
- 2
| Tenant | Tier | MRR | LLM COGS | Margin | Top feature |
|---|---|---|---|---|---|
| acme-legal | Pro | $99.00 | $298.20 | -201% | contract-review |
| umbrella-hr | Starter | $49.00 | $52.30 | -7% | resume-screen |
| massive-dynamic | Pro | $99.00 | $93.70 | 5% | research-agent |
| stark-sales | Team | $299.00 | $272.60 | 9% | call-notes |
| soylent-health | Enterprise | $1,800.00 | $1,233.20 | 31% | chart-summary |
| pied-piper | Team | $299.00 | $193.80 | 35% | code-review |
| northwind-ops | Team | $299.00 | $125.70 | 58% | inbox-triage |
| wayne-finance | Enterprise | $2,400.00 | $862.50 | 64% | report-drafts |
| hooli-support | Pro | $99.00 | $27.50 | 72% | reply-suggest |
| globex-ai | Enterprise | $1,500.00 | $379.40 | 75% | agent-runs |
| initech | Pro | $99.00 | $12.20 | 88% | ticket-summary |
| vandelay-import | Starter | $49.00 | $4.60 | 91% | 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.
| Provider | Fields the provider returns | PALM SOUQ ledger fields |
|---|---|---|
| OpenAI / Azure OpenAI | prompt_tokens, prompt_tokens_details.cached_tokens, completion_tokens_details.reasoning_tokens | input_uncached, cache_read, output, reasoning |
| Anthropic / Bedrock (Claude) | input_tokens, cache_creation_input_tokens, cache_read_input_tokens, output_tokens | input_uncached, cache_write, cache_read, output |
| Google Gemini / Vertex AI | promptTokenCount, cachedContentTokenCount, candidatesTokenCount, thoughtsTokenCount | input_uncached, cache_read, output, reasoning |
| DeepSeek | prompt_cache_hit_tokens, prompt_cache_miss_tokens, completion_tokens | cache_read, input_uncached, output |
| Groq, Mistral, Together AI | prompt_tokens, completion_tokens | input_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 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