ECN_CREDIT_USD_VALUE). Pricing is cost-plus: credits track the real cost of
each action, so a call can never be billed below what it actually cost to run.
What gets metered
| Cost type | How it’s priced | What’s recorded |
|---|---|---|
| LLM / embeddings (via OpenRouter) | real provider cost × markup | UsageEvent (with cost_usd) + CreditTransaction spend, written by ai/gateway.py |
| Paid external APIs (e.g. Apify actor runs) | real run cost × the same markup | UsageEvent (provider="apify", feature="lead_signal_fetch"), plus a CreditTransaction when a managed wallet is charged, via metering.meter_external_cost |
| Free public data (e.g. Socrata permits) | not billed | DataQueryLog only |
python manage.py check_margins can audit realized gross margin per
feature across both. There is no un-metered paid-API expense.
How a call is metered
Preflight
The gateway estimates the credit cost from the rate card and checks it against
your org’s budgets. Over budget → rejected before any provider call.
Rate card
The rate card sets a preflight floor per feature; the actual charge is the real cost-plus amount. Features include (non-exhaustive):profile_draft, context_author, context_refresh, context_pack_compile,
lead_enrichment, lead_qualify, outreach_draft, lead_signal_fetch (paid
data, priced from real cost), x_reply_draft, funnel_generate.
The authoritative, current list is whatever GET /api/v1/credits/rate-cards/
returns for your environment — treat this as illustrative, not exhaustive.
Query the live rate card at GET /api/v1/credits/rate-cards/ and your balance at
GET /api/v1/credits/wallet/ (or the get_wallet_balance MCP tool).
Managed credits, not BYOK
The hosted product uses ECN-managed provider keys (OPENROUTER_API_KEY,
APIFY_API_TOKEN, …) and meters usage to your org’s wallet. There is no
customer-facing bring-your-own-key in the hosted product.
Self-hosting your own keys (so you pay providers directly, $0 to ECN) is a
self-host / Community edition capability, gated by
ECN_DEPLOYMENT_MODE — see
BYOK & self-host. It is not a hosted billing feature.