claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Potential Token Consumption Anomaly in Anthropic API Interaction.

Open izydorczyk opened this issue 1 year ago • 2 comments

Bug Description Hello, yesterday (25/3) I tested claude code with anthropic API for the first time. I was surprised how fast I was able to use 40M tokens.

Today I tested a simple "ping" query.

  • I created an empty test folder (mkdir test && cd test) just in case.
  • ran claude and entered the prompt "ping"
  • I got the response "pong"
  • I found two entries in the console in the logs at the appropriate time:
    • with model claude-3-5-haiku-20241022 about 100 tokens (for example input 86 / output 22)
    • with model claude-3-7-sonnet-20250219 about 15k-20k (for example input 14210 / output 11)

When I asked claude.ai/chat: "When I sent to you via the claude code "ping" prompt then I got "pong". And in logs (in console settings anthropic api) I see about 20k input token spend. How is that possible?", got "That's an unusual observation. When you send a simple "ping" prompt, it should not consume anywhere near 20,000 tokens. A typical "ping" response would be very short and lightweight, consuming only a few tokens."

Let me ask you too, how is this possible and is it ok?

I have registered the Anthropic API under the email from which I am writing to you. This is the Claude Code workspace.

Jan Izydorczyk

Environment Info

  • Platform: linux
  • Terminal: WarpTerminal
  • Version: 0.2.54
  • Feedback ID: 82df67ce-3530-4292-b261-17e9760bb65f

Errors

[]

izydorczyk avatar Mar 26 '25 14:03 izydorczyk

@izydorczyk Thanks for the report. The context you're seeing comes from the system prompt, which is expected and always present when you're chatting with Claude Code. This context is important for instructing Claude Code on how to behave. There's no built-in concept of just a 'ping'—it's treated the same as any other request you might enter. Claude Code isn't aware of all the details of its own protocol.

reverie avatar Mar 26 '25 15:03 reverie

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 11 '25 14:08 github-actions[bot]