Hitting Anthropic API Rate Limits #115

Closed
opened 2026-02-16 17:25:16 -05:00 by yindo · 14 comments
Owner

Originally created by @NeutronicMC on GitHub (Jun 18, 2025).

Originally assigned to: @thdxr on GitHub.

Are there any plans to add a context compacting feature or something like it?

I have tier 3 Anthropic api rate limits, and on small to mid-size projects I'm hitting the max input tokens per minute pretty regularly (at a total context size of around 30-50k tokens). Ultimately for me this means that it'll only run for around 10 minutes before I need to start a new session. I've considered Claude Max, as it seems my Claude pro account doesn't have this same limitation until it hits the hard cap, but I don't use $100 in api credits per month yet so it's a hard sell.

Originally created by @NeutronicMC on GitHub (Jun 18, 2025). Originally assigned to: @thdxr on GitHub. Are there any plans to add a context compacting feature or something like it? I have tier 3 Anthropic api rate limits, and on small to mid-size projects I'm hitting the max input tokens per minute pretty regularly (at a total context size of around 30-50k tokens). Ultimately for me this means that it'll only run for around 10 minutes before I need to start a new session. I've considered Claude Max, as it seems my Claude pro account doesn't have this same limitation until it hits the hard cap, but I don't use $100 in api credits per month yet so it's a hard sell.
yindo closed this issue 2026-02-16 17:25:16 -05:00
Author
Owner

@adamdotdevin commented on GitHub (Jun 18, 2025):

we already auto-compact, but i need to add the explicit command, will do so today

@adamdotdevin commented on GitHub (Jun 18, 2025): we already auto-compact, but i need to add the explicit command, will do so today
Author
Owner

@luuk00101 commented on GitHub (Jun 18, 2025):

This is WAY worse on the API, it really pushes me towards Claude Pro, but when you say you're hitting limits even there... Can't justify spending THAT much just on AI tools just yet...

@luuk00101 commented on GitHub (Jun 18, 2025): This is WAY worse on the API, it really pushes me towards Claude Pro, but when you say you're hitting limits even there... Can't justify spending THAT much just on AI tools just yet...
Author
Owner

@adamdotdevin commented on GitHub (Jun 18, 2025):

@NeutronicMC what version of opencode are you on? we made a ton of improvements to token efficiency yesterday

@adamdotdevin commented on GitHub (Jun 18, 2025): @NeutronicMC what version of opencode are you on? we made a ton of improvements to token efficiency yesterday
Author
Owner

@NeutronicMC commented on GitHub (Jun 18, 2025):

@NeutronicMC what version of opencode are you on? we made a ton of improvements to token efficiency yesterday

v0.1.76

@NeutronicMC commented on GitHub (Jun 18, 2025): > @NeutronicMC what version of opencode are you on? we made a ton of improvements to token efficiency yesterday v0.1.76
Author
Owner

@thdxr commented on GitHub (Jun 18, 2025):

can you hit the limit and then send me a /share url

@thdxr commented on GitHub (Jun 18, 2025): can you hit the limit and then send me a `/share` url
Author
Owner

@NeutronicMC commented on GitHub (Jun 18, 2025):

Here you go: https://dev.opencode.ai/s/501e5869
This also occurs fairly often with 3.5 Sonnet on the 160k input tokens per minute limit, but it would've taken a little longer to reproduce.

As a side note, it'd be nice if /share copied the link to your clipboard.

@NeutronicMC commented on GitHub (Jun 18, 2025): Here you go: https://dev.opencode.ai/s/501e5869 This also occurs fairly often with 3.5 Sonnet on the 160k input tokens per minute limit, but it would've taken a little longer to reproduce. As a side note, it'd be nice if `/share` copied the link to your clipboard.
Author
Owner

@thdxr commented on GitHub (Jun 18, 2025):

yeah so looking at this it's because of the effect mcp doc tool call

it's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit

@thdxr commented on GitHub (Jun 18, 2025): yeah so looking at this it's because of the effect mcp doc tool call<br><br>it's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit
Author
Owner

@NeutronicMC commented on GitHub (Jun 18, 2025):

Yeah, I used the Effect MCP to fill up the context fast, but in pre-existing code bases (without effect) when it reads a lot of files it'll do the same thing. It was very difficult to work around on tier 2 though. You could get it to hit the rate limit in this codebase pretty quickly I think.

@NeutronicMC commented on GitHub (Jun 18, 2025): Yeah, I used the Effect MCP to fill up the context fast, but in pre-existing code bases (without effect) when it reads a lot of files it'll do the same thing. It was very difficult to work around on tier 2 though. You could get it to hit the rate limit in this codebase pretty quickly I think.
Author
Owner

@NeutronicMC commented on GitHub (Jun 18, 2025):

yeah so looking at this it's because of the effect mcp doc tool callit's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit

Yeah, I'm not entirely sure what's going on under the hood but I'm 100% certain that my rate limit is 80k input a minute, and I'm using an API key connected to that account. Here's what it looks like from the dashboard:

Image
Image

That specific chat that I shared had 40k total tokens in the context, but I can hit the rate limit of 160k on 3.5 sonnet the same way with only 40k - 50k tokens.

Edit: The new compact command does help quite a bit, although it'd still be nice if that could be managed automatically somehow.

@NeutronicMC commented on GitHub (Jun 18, 2025): > yeah so looking at this it's because of the effect mcp doc tool callit's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit Yeah, I'm not entirely sure what's going on under the hood but I'm 100% certain that my rate limit is 80k input a minute, and I'm using an API key connected to that account. Here's what it looks like from the dashboard: ![Image](https://github.com/user-attachments/assets/63cf9495-e112-478a-8cee-1b9dbb0a15db) ![Image](https://github.com/user-attachments/assets/1c0a6fab-ce20-4322-b38f-13a7af1a8ddb) That specific chat that I shared had 40k total tokens in the context, but I can hit the rate limit of 160k on 3.5 sonnet the same way with only 40k - 50k tokens. Edit: The new compact command does help quite a bit, although it'd still be nice if that could be managed automatically somehow.
Author
Owner

@adamdotdevin commented on GitHub (Jun 19, 2025):

yeah so looking at this it's because of the effect mcp doc tool callit's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit

Yeah, I'm not entirely sure what's going on under the hood but I'm 100% certain that my rate limit is 80k input a minute, and I'm using an API key connected to that account. Here's what it looks like from the dashboard:

Image
Image

That specific chat that I shared had 40k total tokens in the context, but I can hit the rate limit of 160k on 3.5 sonnet the same way with only 40k - 50k tokens.

Edit: The new compact command does help quite a bit, although it'd still be nice if that could be managed automatically somehow.

compact is called automatically, but not until you hit a threshold that's close to the context window limit

@thdxr we should make the threshold configurable

@adamdotdevin commented on GitHub (Jun 19, 2025): > > yeah so looking at this it's because of the effect mcp doc tool callit's quite expensive to load into context so you're hitting rate limits. although you said you have tier 3 this looks more like the 20K a minute rate limit > > Yeah, I'm not entirely sure what's going on under the hood but I'm 100% certain that my rate limit is 80k input a minute, and I'm using an API key connected to that account. Here's what it looks like from the dashboard: > > ![Image](https://github.com/user-attachments/assets/63cf9495-e112-478a-8cee-1b9dbb0a15db) > ![Image](https://github.com/user-attachments/assets/1c0a6fab-ce20-4322-b38f-13a7af1a8ddb) > > That specific chat that I shared had 40k total tokens in the context, but I can hit the rate limit of 160k on 3.5 sonnet the same way with only 40k - 50k tokens. > > Edit: The new compact command does help quite a bit, although it'd still be nice if that could be managed automatically somehow. > compact is called automatically, but not until you hit a threshold that's close to the context window limit @thdxr we should make the threshold configurable
Author
Owner

@mhamza15 commented on GitHub (Jun 19, 2025):

This session hit the limit pretty quick: https://opencode.ai/s/ece77cea

I haven't really ever hit the limit with Claude Code when using it for similar usecases

@mhamza15 commented on GitHub (Jun 19, 2025): This session hit the limit pretty quick: https://opencode.ai/s/ece77cea I haven't really ever hit the limit with Claude Code when using it for similar usecases
Author
Owner

@thdxr commented on GitHub (Jun 20, 2025):

try v0.1.117 - did some large optimizations

@thdxr commented on GitHub (Jun 20, 2025): try v0.1.117 - did some large optimizations
Author
Owner

@NeutronicMC commented on GitHub (Jun 21, 2025):

try v0.1.117 - did some large optimizations

This is great, ran it with the previous example with the same prompt and it was able to get all the way through, and managed to hit $20 which is a new record for me! I ended up switching to Claude Max anyway, but this will be nice if I ever manage to hit that rate limit.

@NeutronicMC commented on GitHub (Jun 21, 2025): > try v0.1.117 - did some large optimizations This is great, ran it with the previous example with the same prompt and it was able to get all the way through, and managed to hit $20 which is a new record for me! I ended up switching to Claude Max anyway, but this will be nice if I ever manage to hit that rate limit.
Author
Owner

@johnsaigle commented on GitHub (Jun 22, 2025):

v0.1.117 is working much better for me too. I'm able to work way longer before hitting limits.

@johnsaigle commented on GitHub (Jun 22, 2025): `v0.1.117` is working much better for me too. I'm able to work way longer before hitting limits.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#115