GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - copyleftdev/rational: AI cost, with the vibes removed. Exact-rational models + a live calculator for the 8 LLM inference-cost decisions every agent builder faces — model choice, routing, self-host, the reasoning-token tax, cascades, caching, and the O(K²) agent loop. Every number reproducible.

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
article
article
 
 
data
data
 
 
docs
docs
 
 
models
models
 
 
.gitignore
.gitignore
 
 
.impeccable.md
.impeccable.md
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 

Repository files navigation

Rational — AI cost, with the vibes removed

Tip my tokens

Exact financial models for AI infrastructure decisions. Make the LLM do the modeling — but never the arithmetic. Live site: copyleftdev.github.io/rational

This repo is the companion to the guide "The AI Cost Modeling Handbook." Every number here is produced by a two-stage pipeline:

  1. Research agents pull live, cited provider prices and quality benchmarks (observed dates recorded in data/).
  2. agent-calc — an AI-native exact rational computation kernel — does the arithmetic. No float drift, no LLM hallucinating a multiplication. Where a solver must use floats (LP), the result is re-verified in exact rationals.

The point: a cost model you can audit. Re-run any chapter and you get bit-identical numbers, with the source of every input price one file away.

The workload model

All chapters share one production-agentic workload profile (Hermes-Agent-style tool loops):

Component Share of tokens Why
Fresh input 21.25% New context each turn
Cached input 63.75% System prompt + skills + history re-sent every tool-loop step (75% of input is a cache hit)
Output 15% Agents emit little text, mostly tool-call args

blended $/1M = 0.2125·in + 0.6375·cached + 0.15·out

Chapters

# Model Money question agent-calc domain Status
00 Token-provider ranking Cheapest provider per quality unit to drive an agent rational ✅ data/
01 Multi-provider routing LP Optimal traffic split minimizing spend under a quality + privacy floor linear + eval ✅
02 Self-host vs. serverless Utilization a GPU node must hold to beat per-token API finance, eval ✅
03 The reasoning-token tax Cost per solved task once you count thinking tokens eval, solve ✅
04 The retry cascade Cheap→premium escalation: near-total coverage at a fraction of frontier cost stats, eval ✅
05 NPV of waiting Reserved-capacity prepay vs. riding the price decline finance ✅
06 Prompt-cache ROI Reuse count where caching pays off vs. write premium eval, interval ✅
07 Agent-loop compounding Why turn N costs O(N²) without compaction polynomial ✅

Site & article

  • Site — a kinetic single-page presentation of the findings in docs/ (light-mode, self-drawing SVG charts). Deploy via Settings → Pages → branch main, folder /docs. Serve locally with python3 -m http.server -d docs.
  • Article — the full write-up in article/the-ai-cost-modeling-handbook.md, all eight chapters as one narrative with charts. Regenerate figures with python3 article/charts/make_charts.py.

Reproduce

make ch01      # optimal routing LP frontier
make all       # every chapter

Every model script is self-contained Python that shells out to agent-calc. Inputs live in data/ with observation dates and source URLs.

About

AI cost, with the vibes removed. Exact-rational models + a live calculator for the 8 LLM inference-cost decisions every agent builder faces — model choice, routing, self-host, the reasoning-token tax, cascades, caching, and the O(K²) agent loop. Every number reproducible.

copyleftdev.github.io/rational/

Topics

aiai-agentsai-toolsartificial-intelligencebenchmarkcalculatorclaudecost-optimizationdata-visualizationdeepseekgenerative-aigpuinferencelarge-language-modelsllmllm-inferencellmopsmachine-learningopenrouterprompt-engineering

Resources

Readme
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.