Skip to content

Instantly share code, notes, and snippets.

View devasheeshG's full-sized avatar
🚢
Shipping

Devasheesh Mishra devasheeshG

🚢
Shipping
View GitHub Profile
@devasheeshG
devasheeshG / llm_cost_calc.py
Last active March 26, 2026 20:42
Cost estimator for agentic LLM runs with prompt caching — models per-turn input, output, cache read/write across tool call loops.
def estimate_agent_cost(
# pricing (per token)
input_price: float,
output_price: float,
cache_read_price: float,
cache_write_price: float,
# initial turn
# global system prompt + tool definitions
system_prompt_tokens: int,