SShortSingh.
Back to feed

Claude Code API Costs Explained: What a Typical Coding Session Actually Runs You

0
·3 views

A developer who tracked Claude Code usage over 95 days has broken down the real API costs of running the agentic coding tool. Unlike standard chat interfaces, Claude Code can trigger 10 to 40 model calls per user request, and every call re-sends the entire conversation history as input tokens, making input volume the primary cost driver. A typical mid-size session of 40 model calls across a medium-sized repo generates roughly 3.6 million input tokens, costing around $11.40 on Sonnet or $19 on Opus at Anthropic's list prices before caching discounts. Prompt caching and the /compact command can meaningfully reduce costs, but the core billing mechanic remains: every token in the active window is charged on every subsequent call. To manage spending, the author recommends keeping CLAUDE.md files lean, scoping file reads tightly, and starting fresh sessions per task rather than letting context windows grow unchecked.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

Climate.gov taken offline, but open data efforts help preserve its content

The U.S. government climate information website Climate.gov was shut down, removing public access to years of climate data and resources. Open data advocates and archivists stepped in to preserve and restore much of the site's content before it was lost permanently. The incident highlights the vulnerability of publicly funded scientific resources when government priorities shift. It also underscores the importance of open data practices, which made recovery efforts possible in this case.

0
ProgrammingDEV Community ·

Green CI checks can mask untested release pipeline steps, developer warns

A developer discovered that two consecutive green CI runs on a release pipeline were misleading — both passed because the tool, python-semantic-release, correctly detected no release was needed and exited early without executing the critical push step. Since the triggering commits were of types like 'docs:' and 'ci:', which do not warrant a version bump, the pipeline short-circuited before ever testing the protected-branch push or the release token. A separate bug also revealed that build artifacts were not automatically staged for commit, meaning they were silently absent from releases despite all job steps exiting with code 0. The author argues that a zero exit code only confirms a command ran without error, not that it performed the intended work. The key takeaway is that engineers should verify actual pipeline effects — such as whether a tag was created or artifacts were staged — rather than relying solely on a passing status badge.

0
ProgrammingDEV Community ·

Engram Launches Developer Learning Tool Using Spaced Repetition and First Principles

Engram is a newly launched educational tool designed specifically for developers, combining first-principles curricula, free-recall verification, and FSRS-based spaced repetition to improve knowledge retention. The platform also features 'explorable artifacts,' which let users interact with complex technical concepts in a hands-on, visual manner. Since its launch, Engram has attracted 775 GitHub stars, signalling early interest from the developer community. It positions itself as a more evidence-based alternative to established platforms like Codecademy and Coursera, which it argues lack scientific rigor in their learning frameworks. The tool aims to address the growing demand for personalized, flexible learning strategies among developers managing multiple skill sets.

Claude Code API Costs Explained: What a Typical Coding Session Actually Runs You · ShortSingh