CoIn: Counting the Invisible Reasoning Tokens in Commercial Opaque LLM APIs

Guoheng Sun, Ziyao Wang, Bowei Tian, Meng Liu, Zheyu Shen, Shwai He, Yexiao He, Wanghao Ye, Yiting Wang, Ang Li

Abstract

As post-training techniques evolve, large language models (LLMs) are increasingly augmented with structured multi-step reasoning abilities, often optimized through reinforcement learning. These reasoning-enhanced models outperform standard LLMs on complex tasks and now underpin many commercial LLM APIs. However, to protect proprietary behavior and reduce verbosity, providers typically conceal the reasoning traces while returning only the final answer. This opacity introduces a critical transparency gap: users are billed for invisible reasoning tokens, which often account for the majority of the cost, yet have no means to verify their authenticity. This opens the door to token count inflation, where providers may overreport token usage or inject synthetic, low-effort tokens to inflate charges. To address this issue, we propose CoIn, a verification framework that audits both the quantity and semantic validity of hidden tokens. CoIn constructs a verifiable hash tree from token embedding fingerprints to check token counts, and uses embedding-based relevance matching to detect fabricated reasoning content. Experiments demonstrate that CoIn, when deployed as a trusted third-party auditor, can effectively detect token count inflation with a success rate reaching up to 94.7%, showing the strong ability to restore billing transparency in opaque LLM services.

Introduction: The Era of Opaque Reasoning

The landscape of Large Language Models (LLMs) is shifting toward "inference-time scaling." Models like OpenAI’s o1/o3 and DeepSeek-R1 generate extensive "chains of thought" to solve complex problems. While these reasoning-enhanced models outperform standard LLMs, they introduce a significant transparency gap. To protect proprietary logic and prevent model distillation, providers typically conceal these reasoning traces, returning only the final answer.

This creates a Commercial Opaque LLM API (COLA) environment where users are billed for every generated token—including the invisible ones. This information asymmetry allows for potential token count inflation, where providers might overreport usage (Naive Inflation) or inject low-effort synthetic tokens to increase costs (Adaptive Inflation).

The Scale of Invisible Reasoning

The financial stakes are high because reasoning tokens often dwarf the final answer. In many cases, the "hidden" portion of the bill is the most significant part.

Reasoning-to-answer token ratios across models (a) and domains (b).

As shown in the figure above, reasoning tokens can outnumber answer tokens by a factor of 20 to nearly 50. For enterprise users running high-volume or complex tasks, this "hidden tax" can translate into substantial unverified expenses.

The CoIn Framework: Auditing the Invisible

To restore billing transparency, the authors propose CoIn (Counting the Invisible), a verification framework designed for a trusted third-party auditor. CoIn addresses the problem through two primary mechanisms:

1. Token Quantity Verification

To verify the number of tokens without requiring the provider to reveal the content, CoIn utilizes a Merkle Hash Tree. The provider generates embeddings for each reasoning token, which are then organized into a verifiable tree structure. The auditor can perform probabilistic "spot-checks" on specific leaves. If the provider attempts to inflate the token count, the cryptographic integrity of the Merkle root will fail.

2. Semantic Validity Verification

To ensure providers aren't simply padding the trace with irrelevant text, CoIn employs Matching Heads. These are lightweight neural networks that calculate relevance scores at two levels:

  • Token-to-Block: Validates if a specific token belongs in its immediate reasoning context.
  • Block-to-Answer: Ensures the reasoning block logically contributes to the final answer.
Key components and terminology of the CoIn auditing workflow.

By auditing embedding fingerprints rather than raw text, CoIn preserves the provider's trade secrets while providing the user with a verifiable "receipt" for the work performed.

Experimental Results

The framework was evaluated using five diverse datasets (Medical, Code, Math, Math-OOD, and General) derived from DeepSeek-R1 traces. Key findings include:

  • High Detection Accuracy: CoIn achieved a 94.7% success rate in detecting sophisticated adaptive inflation attacks.
  • Sensitivity: Even with a subtle 10% inflation rate, CoIn maintains a 40.1% probability of detection in a single audit round.
  • Efficiency: The computational overhead for constructing Merkle trees is described as "nearly negligible," making it feasible for production environments.
  • Robustness: The semantic matching heads generalized well to Out-of-Domain (OOD) tasks, indicating the framework's broad applicability across different subjects.

Conclusion and Future Outlook

CoIn demonstrates that it is possible to audit opaque LLM APIs without compromising proprietary data. While implementation currently requires provider cooperation (to share Merkle roots and embeddings), it paves the way for "self-attesting" bills and greater accountability in the AI industry. Future directions include refining the probabilistic sampling to minimize false positives and integrating these proofs directly into provider infrastructure.

Reference: Sun, G., et al. (2025). CoIn: Counting the Invisible Reasoning Tokens in Commercial Opaque LLM APIs. arXiv:2505.13778v1 [cs.AI].

Summary updated

BibTeX
@misc{sun2025coin,
  author = {Guoheng Sun and Ziyao Wang and Bowei Tian and Meng Liu and Zheyu Shen and Shwai He and Yexiao He and Wanghao Ye and Yiting Wang and Ang Li},
  title = {{CoIn: Counting the Invisible Reasoning Tokens in Commercial Opaque LLM APIs}},
  year = {2025},
  eprint = {2505.13778},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.13778},
}

Loading related content...

Figure