Skip to content

high input token usage on a small project #1172

Closed

Description

@jakubdonovan

I’m also seeing extremely high input token usage on a relatively small SvelteKit project, even after adding an AGENTS.md file that excludes node_modules, .svelte-kit/, and build/ folders.

Since last night, I’ve already burned through $15 in usage, which is far beyond what is expected for a project of this size.

Here’s the exact error I’m now encountering on each prompt:

[!ERROR]
{
  "data": {
    "message": "AI_APICallError: input length and max_tokens exceed context limit: 172775 + 32000 > 200000, decrease input length or max_tokens and try again"
  },
  "name": "UnknownError"
}

I also pulled my Claude usage logs and saw input token counts regularly in the 160k–172k range, all within minutes:

2025-07-20 14:29:30 — 172,448 tokens
2025-07-20 14:29:25 — 172,242 tokens
2025-07-20 14:29:15 — 171,931 tokens
...

I’ve tried compacting the session and deleting recent messages, but I’m now completely blocked due to the context limit being exceeded on every request.

I don't have access to our conversation from 18 minutes ago due to the context limit error you're seeing. Each conversation session starts > fresh for me.

As a result, I am unable to do anything.

I’d be happy to share my session log privately if that helps with debugging.

Activity

  1. self-assigned this
    on Jul 20, 2025
  2. thdxr commented on Jul 20, 2025

    @thdxr
    Member

    what model are you using?

  3. thdxr commented on Jul 20, 2025

    @thdxr
    Member

    also are you on latest? and does your project have a lot of type errors?

  4. jakubdonovan commented on Jul 21, 2025

    @jakubdonovan
    Author

    what model are you using?

    I use claude-sonnet-4-20250514 for build mode. I'm on latest, and my project has no type errors. I as able to overcome the issue by switching to Gemini Pro 2.5 but It started doing things contrary to what was planned in the planning stage at the start of the initial conversation, so it looks like there was some context loss when I switched models.

  5. jaredbarranco commented on Jul 22, 2025

    @jaredbarranco

    This might be a longshot, but do you have any MCP servers setup? If yes, how many?

    The input tools array counts against your input token usage. If you have a massive number of unique tools, it could cause input token overages, and wouldn't be addressable with the /compact feature since tools are sent on every request.

  6. jakubdonovan commented on Jul 22, 2025

    @jakubdonovan
    Author

    This might be a longshot, but do you have any MCP servers setup? If yes, how many?

    The input tools array counts against your input token usage. If you have a massive number of unique tools, it could cause input token overages, and wouldn't be addressable with the /compact feature since tools are sent on every request.

    Just these two:
    Image

  7. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions