1.7 Billion Tokens in a Day: Cost Governance for AI-Assisted R&D

    This article examines an internal observation of roughly 1.703 billion tokens consumed in one day and uses it to frame cost governance for AI-assisted development. It breaks the bill into cache hits, uncached input, output, and request volume; describes the engineering context of a lightweight modeling and quantity-calculation kernel for linear projects; and presents a six-layer governance framework covering task tiering, context engineering, output constraints, model routing and budget guardrails, observability, and evaluation. It also recommends separate governance for AI assistant testing and offers a practical implementation checklist.

    A daily consumption of about 1.703 billion tokens is enough to prompt a re-examination of the cost structure of AI-assisted R&D. More notably, it is not the whole picture: after multiple platforms, tools, and tasks are stacked, the queryable backend records are only part of it. The real question is not whether the number is alarming, but whether a team can turn token consumption into engineering metrics that are observable, budgetable, reusable, and evaluable. This article starts from an internal observation and discusses the cost sources and governance methods for large-scale AI-assisted development of a linear engineering modeling and quantity-calculation kernel.

    1. The Token Bill Is Not a Single Total but a Set of Slices

    In one internal observation, daily consumption was about 1.703 billion tokens, with a cache hit rate of about 97.4%, uncached input of about 43.95 million tokens, and output of about 3.11 million tokens. Another period recorded about 930 million tokens and more than 15,000 requests, with cost on the order of a few hundred RMB. Looking only at the total makes it easy to conclude that the model is expensive, but the breakdown is more meaningful.

    First, a high cache hit rate means that a large amount of context is being reused. Caching can significantly reduce the cost of repeated input, but it is not free: poor cache key design, unstable stable prefixes, and unstable ordering of retrieved fragments can turn content that should have hit the cache into uncached input. Second, uncached input and output are the more direct cost variables. Output of 3.11 million tokens may look small, but if the output contains many repeated explanations, invalid code blocks, or repeated clarifications, it still raises cost and increases manual screening effort. Finally, request count itself carries fixed overhead. More than 15,000 requests means many short interactions; if each one includes system prompts, tool descriptions, and format constraints, the cumulative cost cannot be ignored.

    Therefore, token governance cannot focus only on total tokens. It should establish layered metrics: tag by project, task type, user, environment, model tier, cache hit, and input/output; at the same time, observe first-pass rate, rework rate, human adoption rate, and defect rate. Otherwise, a team may sacrifice R&D efficiency to reduce tokens, or let cost spiral out of control in pursuit of generation speed.

    2. What Engineering Work the 1.7 Billion Tokens Funded

    This consumption mainly occurred during the development of a lightweight modeling and quantity-calculation kernel for linear projects. The kernel targets linear projects such as channels and roads. It includes terrain TIN, plan, profile, cross-section, and 3D viewports; after component assembly, it sets out by station, and quantities are calculated in linkage with the model. The goal is to walk a line completely from start to end without relying on a heavy commercial modeling suite.

    This type of engineering imposes special requirements on AI-assisted development. First, it is domain-knowledge intensive: stationing, setting out, components, cross-section templates, and quantity rules are tightly coupled, and the model needs to continuously understand domain semantics. Second, geometry and rules are intertwined: TIN terrain, profile interpolation, cross-section assembly, and quantity statistics involve both geometric algorithms and business rules. Third, the context is long: interface contracts, data structures, quantity formulas, test cases, and viewport interaction logic are often spread across multiple files. Fourth, iteration is frequent: a change to one quantity rule may affect modeling, setting out, statistics, and validation across multiple chains.

    In this scenario, high token consumption is usually not caused by a single long conversation but by a combination of factors: repeatedly inserting entire files into context, clarifying interfaces repeatedly in natural language, asking the model to generate large code blocks that could be replaced by a diff, launching separate requests for each test scenario, and replaying similar inputs in AI assistant testing. Without context engineering, the model keeps re-understanding the same set of domain constraints, and cost naturally rises.

    3. A Six-Layer Framework for Cost Governance

    The first layer is task tiering. Requirement clarification, interface design, code implementation, test generation, refactoring, and documentation writing should use different models, different contexts, and different budgets. Classification, summarization, and test data augmentation can be handled by lighter models; complex geometry design and cross-module refactoring can be assigned to stronger models. Task tiering is not about lowering quality; it is about avoiding the use of maximum context for every task.

    The second layer is context engineering. Stable prefixes should be templated, and changing content should be placed afterward; domain dictionaries, interface contracts, and quantity rule tables should be structured and cached; retrieved fragments should be assembled in a fixed order; code modifications should prefer diff patches over full-file rewrites. Cache keys should include the stable prefix version, retrieval fragment hash, and task type to avoid invalid cache invalidation.

    The third layer is output constraints. Require the model to output structured JSON, patches, unit tests, or checklists, and reduce long explanations. For code generation tasks, require “only output the change block + impact scope + validation steps.” This reduces output tokens and makes human review easier.

    The fourth layer is model routing and budget guardrails. Set daily budgets, task budgets, and anomaly thresholds by project; trigger alerts when single-request context exceeds a threshold, a single task is retried too many times, or the cache hit rate drops abnormally. Budget guardrails should not simply block requests; they should suggest degradation strategies, such as switching to a smaller model, compressing context, splitting tasks, or handing off to a human.

    The fifth layer is observability and audit. Uniformly record request time, task tags, model tier, input/output tokens, cache hits, latency, and result adoption. Log services and monitoring alerts can serve as a common observability foundation. Weekly reports should not list only total tokens; they should list “token cost per effective commit,” “token cost per passing test,” and “share of rework requests.”

    The sixth layer is the evaluation loop. If tokens are saved but the first-pass rate drops, overall cost may be higher. Track the adoption rate of AI-generated code, unit test pass rate, defect density, and manual modification time at the same time. Only by placing token metrics alongside R&D output metrics can a team judge whether governance is effective.

    4. AI Assistant Testing Needs Independent Governance

    Another period recorded about 930 million tokens and more than 15,000 requests, concentrated on AI assistant testing in a component editor. This phenomenon is typical: token consumption during development attracts attention, while testing is often ignored. AI assistant testing often includes many similar scenarios, boundary inputs, and regression replays. Without isolation, test traffic can easily be mixed into the development budget.

    It is advisable to bring AI assistant testing into independent governance: establish a sandbox environment with a fixed sample set and random seeds; perform stratified sampling on requests and prioritize caching for high-frequency scenarios; batch and replay similar inputs; set an independent budget and circuit breaker for the test environment; and tag test results separately from development environment logs. The goal of testing is not to run more requests, but to cover key behavior with as few requests as possible.

    An illustrative pseudocode example is as follows:

    1. build_context(task, stable_prefix, retrieved, budget):
    2. ctx = stable_prefix + retrieved
    3. if estimate_tokens(ctx) > budget.context:
    4. ctx = compress(ctx, budget.context)
    5. return ctx
    6. guard(request, budget):
    7. if request.task in budget.blocked_tasks: return degrade(request)
    8. if request.estimated_tokens > budget.single_limit: return split(request)
    9. if today_usage + request.estimated_tokens > budget.daily_limit: return alarm()
    10. return execute(request)

    5. Implementation Checklist

    A team can start with five actions: unify token logs and tags; create stable prefixes and cache templates for high-frequency tasks; replace full-file generation with diff patches; set an independent budget and replay mechanism for the test environment; and establish a weekly report covering “token cost + R&D output.” After that, gradually introduce model routing, retrieval compression, budget guardrails, and anomaly detection.

    1.7 billion tokens is a signal, not a goal. It reminds us that AI-assisted R&D has moved from a personal tool into a production system. Only by bringing context, caching, models, budgets, logs, and evaluation into engineering management can cost remain controllable and efficiency remain sustainable.