Skip to content
WeChat · SecureNexusLab·Indexed by this site · Originally published· Event →SelectedAttention39

OpenAI GhostCompact billing vulnerability: token billing differs by 669x

OpenAI GhostCompact 计费漏洞:token计费差了 669 倍

AI summary

Researcher Xint discovered a billing logic vulnerability in the OpenAI API and named it GhostCompact. For the same input of about 200,000 tokens, merely changing whether the model's next step is to reply with a message or call a tool results in billed input tokens of 200,749 and 300, respectively—a 669-fold difference. The vulnerability occurs in scenarios where inline compression is immediately followed by a tool call; the API bills only for the small number of compressed tokens, while the tool call return still carries the full compressed items. OpenAI confirmed the issue and released a fix on September 21. In the range of 100,000 to 272,000 token contexts with 1,000 to 5,000 token compressed items, GhostCompact is 20 to 200 times cheaper than standalone compression. Most agent frameworks disable inline compression by default, but several popular tools, including OpenClaw, enable it by default.

Why it was selected

For the same input, the billing comparison between replying with a message and calling a tool shows a 669x difference, and inline compression may be unintentionally triggered in agent loops. This is for reference by teams that rely on this API's billing.

Read originalmp.weixin.qq.com