amplegest / COSTS.md
Viney's picture
deploy: Primer app for HF Spaces β€” clean orphan history
35676b4
|
Raw
History Blame Contribute Delete
3.15 kB

A newer version of the Streamlit SDK is available: 1.61.1

Upgrade

Token & API Costs

All costs from data/cost_log.jsonl. Each row is one "Generate Brief" run from the Streamlit UI.


Haiku 4.5 runs (current model: claude-haiku-4-5-20251001)

Date (UTC) Ticker Input tokens Output tokens Cost (USD)
2026-05-05 16:16 AAPL 23,200 3,022 $0.0306
2026-05-05 16:19 AAPL 33,949 3,673 $0.0419
2026-05-05 16:48 AAPL 33,948 3,875 $0.0427
2026-05-05 17:12 AAPL 34,684 3,990 $0.0437
2026-05-05 17:19 AAPL 38,185 4,920 $0.0502
2026-05-05 17:39 AAPL 34,684 4,353 $0.0452
2026-05-05 19:37 AAPL 34,212 4,071 $0.0437
2026-05-05 19:39 AAPL 34,212 3,948 $0.0432
2026-05-05 20:22 AAPL 34,212 3,937 $0.0431
2026-05-05 20:39 AAPL 34,212 3,903 $0.0430
2026-05-05 21:44 AAPL 37,207 4,463 $0.0476
2026-05-05 21:54 AAPL 34,212 4,081 $0.0437
2026-05-06 08:29 AAPL 26,620 3,388 $0.0348
2026-05-06 08:32 AAPL 31,084 3,999 $0.0409
2026-05-06 08:39 AAPL 31,084 4,297 $0.0421
2026-05-06 15:01 AAPL 39,303 4,324 $0.0487
2026-05-06 15:50 AAPL 39,303 4,378 $0.0490
2026-05-06 17:24 NVDA 35,991 4,919 $0.0485
2026-05-06 22:18 NVDA 38,891 4,522 $0.0492
2026-05-06 22:52 NVDA 62,802 4,419 $0.0679
Total 711,995 82,482 $0.8995

Average per brief (haiku-4-5): $0.045


Earlier dev runs (claude-sonnet-4-6, now replaced by haiku-4-5)

Date (UTC) Ticker Input tokens Output tokens Cost (USD)
2026-05-05 12:20 AAPL 29,531 2,209 $0.1217
2026-05-05 12:25 AAPL 22,812 2,529 $0.1064
2026-05-05 12:36 AAPL 27,459 2,397 $0.1183
2026-05-05 12:40 AAPL 22,754 2,602 $0.1073
2026-05-05 12:43 AAPL 29,535 2,646 $0.1283
2026-05-05 15:29 AAPL 66,933 3,709 $0.2564
2026-05-05 15:48 AAPL 45,406 3,747 $0.1924
2026-05-05 15:58 AAPL 58,849 3,683 $0.2318
2026-05-05 16:05 AAPL 50,982 3,738 $0.2090
Total 354,261 27,260 $1.4717

Average per brief (sonnet-4-6): $0.164
The switch to haiku-4-5 reduced cost per brief by ~73%.


Summary

Haiku 4.5 (current) Sonnet 4.6 (dev)
Runs 20 9
Avg cost / brief $0.045 $0.164
Total spend $0.90 $1.47

Grand total across all runs: $2.37


Cost components per brief

  • LLM: 1 agent loop (typically 4–7 tool rounds) + 1 synthesis call. All billed through Anthropic API.
  • Tavily (search_news): free tier β€” no cost within standard limits.
  • SEC EDGAR: public API β€” no cost.
  • yfinance: public library β€” no cost.
  • Reranker (BAAI/bge-reranker-base): runs locally β€” no API cost.

Worst-case bound: MAX_TOOL_ROUNDS = 10 in agent/graph.py caps the agent loop, bounding the maximum spend per brief at ~$0.08 on haiku-4-5.


Log source: data/cost_log.jsonl β€” appended automatically on each Streamlit run via agent/cost_log.py.