Cloud or self-hosted, same integration
Lago is an open-source usage billing platform that many teams run inside their own infrastructure. PALM SOUQ supports Lago Cloud and self-hosted Lago through the same events API: you give the gateway your Lago API URL and API key, and it posts events to /api/v1/events with a transaction_id for de-duplication.
For self-hosted Lago behind a private network, PALM SOUQ Scale customers can run the billing sync worker inside their VPC so events never cross the public internet.
Billable metric codes
Lago aggregates events by a billable metric code. PALM SOUQ lets you map gateway measurements to codes: for example llm_input_tokens, llm_output_tokens and llm_cached_tokens as three metrics with separate charges, or a single llm_cost metric with a markup. Events reference the customer's external subscription id so they land on the right plan.
If a tenant has more than one active subscription, for example a base plan and an add-on for an agent product, the X-PalmSouq-Feature header can route usage from that feature to the add-on subscription.
Wallets and prepaid credits
Lago supports prepaid credit wallets. PALM SOUQ reads wallet balance changes through Lago webhooks and can move a tenant into a fallback or blocked state when credits run out, so the product enforces the same limit the billing system tracks.
Teams that prefer to keep the full billing stack open source often pair Lago with the OpenTelemetry export, so both money and metrics stay in systems they operate.
Rolling it out safely
Point PALM SOUQ at a Lago staging instance first and create the billable metrics there. Lago's event list makes it easy to confirm that codes, subscription ids and properties arrive as expected before you connect production.
If you self-host Lago, check that your events endpoint can absorb your peak request rate, or choose per-minute aggregation, which keeps event volume proportional to the number of active tenants rather than the number of model calls.
Use Lago's wallet thresholds together with PALM SOUQ quota policies so the two systems agree on what happens at zero. A typical setup uses Lago's wallet webhooks so PALM SOUQ sends your app a soft-cap notice when the balance runs low, and switches the tenant to a fallback model when the wallet is empty. Customers keep working while they top up, and you never serve frontier-model traffic against a balance that no longer exists.