Skip to content

KLAI AI Cost

Menu Location: Kiva Tools > KLAI AI Cost

Last Updated: 2026-09-28


Overview

The KLAI AI Cost page (klai-costs.php) is a read-only spend report for the AI work KLAI does. It answers "what is this costing me, and where is it going" by summing KLAI's Claude Code sessions out of the session ledger, then showing single-shot LLM and image spend as secondary context.

Pick a date range and the page reports totals, spend broken down by kind of KLAI work, spend by AI engine, and a day-by-day trend so you can spot a spike.

Primary Features

Date Range

A Show the last dropdown at the top selects the reporting window: 7, 14, 30, 60, 90, 180, or 365 days. The default is 30 days. Changing the dropdown reloads the page.

Headline Totals

Four tiles across the top:

Tile What it shows
Total AI spend KLAI sessions + single-shot LLM + images, combined, for the selected range
KLAI sessions Cost of KLAI's Claude Code sessions, with the number of runs
Single-shot LLM Cost of one-off LLM calls, with the call count
Images Cost of AI image generation, with the image count

Scope of the Numbers

An explanatory note under the tiles spells out an important difference:

  • KLAI session cost is the durable, cross-run figure. It is recorded on the kivalogic.com master database and is never pruned, so it is the complete picture.
  • Single-shot LLM and image totals only count calls logged on whichever database you are viewing. The LLM call log is a rolling 60-day log. Because of this, those two totals undercount the fleet as a whole; view them per tenant store to see that tenant's own spend.

KLAI Spend by Event Type

The main table groups sessions by the kind of KLAI work that spawned them, most expensive first:

Column Meaning
Event type The kind of work (for example a support ticket, error auto-fix, or daily journal)
Sessions How many sessions ran
Total cost Combined cost of those sessions
Avg / session Average cost of one session of that type
Total turns Combined conversation turns across those sessions
Avg turns Average turns per session

A Total row at the bottom sums the sessions and cost. Sessions that are not tied to a recorded event show as (no event / legacy).

Sessions with no linked event, and any event type with no sessions in the range, behave the same way: the table simply omits them, and the page prints "No KLAI sessions in this range" when there is nothing at all. That table only has data on the kivalogic.com master database, where the KLAI cron runs, so an empty table on a tenant store is expected.

KLAI Spend by Provider

When there is data, a second table splits the same sessions by which AI engine ran them (Anthropic or DeepSeek), with session count and total cost. This is how you check whether routing a kind of work to a cheaper engine actually saved money. Older sessions with no recorded engine show as (legacy / unknown).

KLAI Spend by Day

A third table lists each day in the range with its session count and cost, plus a red bar sized relative to the most expensive day, so the expensive days stand out at a glance.

Common Use Cases

Finding What Is Driving AI Spend

Set the range to 30 days and read the KLAI spend by event type table top to bottom. It is sorted most expensive first, so the first row is where the money is going.

Checking Whether a Cheaper Engine Is Saving Money

After routing a kind of work to DeepSeek on the AI Routing page, compare the by provider table and the avg turns column before and after. A cheaper engine that loops to the turn limit shows up as far more turns per session for the same work.

Spotting a Spike

The KLAI spend by day table shows the daily trend in one view; the day with the tallest red bar is the outlier worth investigating.

Troubleshooting

The page shows no KLAI sessions

The session ledger only holds data on the kivalogic.com master database. On a tenant store the page shows "No KLAI sessions in this range," which is normal.

The Single-shot LLM and Images totals look too low

They are per-database, and the LLM call log only keeps 60 days. They cannot add up to the fleet-wide figure. Use them to compare tenants, not to total your spend.

Recent Updates

  • 2026-09-28: Added the KLAI AI Cost page: spend by event type, by provider, and by day, with headline totals and a selectable date range (r28090).