admin

Get Economics

ROI calculation: coins charged vs estimated Vertex AI costs.

Two source tables are joined:

  • coin_transactions — authoritative revenue journal. Includes non-AI operations like export_pdf that spend coins without hitting Vertex AI.
  • ai_usage_log — authoritative token/USD cost journal, keyed by prompt_key. A single user operation may span multiple prompts (e.g. dream_interpret uses both dream_clarify and dream_interpret), and sub-operation prompts like tts_summarize bill under the parent operation audio_tts.

Previously revenue was read exclusively from ai_usage_log, so export_pdf spend was silently missing from the admin dashboard (revenue appeared as 0). dream_clarify and dream_interpret also showed as two separate rows with a misleading 0-coin entry for the dream_interpret prompt (coin_cost=0 is correct telemetry — charge happens once on dream_clarify — but admin saw "0 монет" per the per-prompt grouping and mistook the operation for free).

This query groups both tables by the stable operation identifier (same key used in cost_<op> and coin_transactions), merging multi-prompt and non-AI operations into one row each. group_by = model or day keeps the legacy AI-only view since non-AI ops have no model or per-day AI token breakdown.

get/api/admin/economics

Request

  • Base URL: https://api.stellara.natlex.it (the document declares no server; this is the origin it was published from)
  • URL: https://api.stellara.natlex.it/api/admin/economics
  • Auth: HTTP bearer

Query parameters

periodstring
group_bystring

Response

Successful Response

period_daysinteger required
group_bystring required
pricing_as_ofstring
models_missing_pricestring[]

Changes

No recorded changes to this operation across all 1 revision of this API.