Make opencode prefer claude subscription over tokens #2835

Open
opened 2026-02-16 17:37:28 -05:00 by yindo · 7 comments
Owner

Originally created by @igordertigor on GitHub (Nov 13, 2025).

Question

I have a claude pro subscription and an api key. I would like to have opencode use the subscription until it hits the usage limit and then switch to token usage. I thought that was the default, but that seems to not be the case. What am I missing? Unfortunately, the auth documentation seems to only cover the login flow. What am I missing?

Originally created by @igordertigor on GitHub (Nov 13, 2025). ### Question I have a claude pro subscription and an api key. I would like to have opencode use the subscription until it hits the usage limit and then switch to token usage. I thought that was the default, but that seems to not be the case. What am I missing? Unfortunately, the [auth documentation](https://opencode.ai/docs/cli/#auth) seems to only cover the login flow. What am I missing?
Author
Owner

@github-actions[bot] commented on GitHub (Nov 13, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #870: Working is hanging and Claude usage limit reached not reported - discusses similar issues with Claude Pro subscription limits not being handled properly
  • #777: No errors when usage limit is reached (Claude Pro) - also addresses the problem of usage limit handling with Claude subscription
  • #924: Dramatic increase in token consumption - discusses token usage patterns with Claude subscription

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 13, 2025): This issue might be a duplicate of existing issues. Please check: - #870: Working is hanging and Claude usage limit reached not reported - discusses similar issues with Claude Pro subscription limits not being handled properly - #777: No errors when usage limit is reached (Claude Pro) - also addresses the problem of usage limit handling with Claude subscription - #924: Dramatic increase in token consumption - discusses token usage patterns with Claude subscription Feel free to ignore if none of these address your specific case.
Author
Owner

@conradkoh commented on GitHub (Nov 13, 2025):

@igordertigor did you try using the /models command and choose the model anthropic/claude-sonnet-4.5? you can also try seeing whether the provider was added by using the opencode models command I think!

@conradkoh commented on GitHub (Nov 13, 2025): @igordertigor did you try using the /models command and choose the model `anthropic/claude-sonnet-4.5`? you can also try seeing whether the provider was added by using the `opencode models` command I think!
Author
Owner

@igordertigor commented on GitHub (Nov 13, 2025):

Thank you @conradkoh , the issue is that I have both, a claude pro subscription and an API key. So both are anthropic models. It seems that it prefers the API key over the subscription while the subscription and I would like to prefer the subscription and use the tokens as a fallback.

@igordertigor commented on GitHub (Nov 13, 2025): Thank you @conradkoh , the issue is that I have both, a claude pro subscription and an API key. So both are anthropic models. It seems that it prefers the API key over the subscription while the subscription and I would like to prefer the subscription and use the tokens as a fallback.
Author
Owner

@rekram1-node commented on GitHub (Nov 13, 2025):

Hmm we dont do that fallback behavior for auth but we prolly should allow for that

I think the ai sdk for anthropic prioritizes the env vars over the creds passed to it

@rekram1-node commented on GitHub (Nov 13, 2025): Hmm we dont do that fallback behavior for auth but we prolly should allow for that I think the ai sdk for anthropic prioritizes the env vars over the creds passed to it
Author
Owner

@grenaad commented on GitHub (Nov 14, 2025):

@conradkoh I managed to work around this problem by using the OpenCode Zen provider. They have Bring Your Own Key, so I used my API key with them and then use my subscription with the Anthropic provider. You can just switch between them with /models.

Right now I have two subscriptions: One for work and one for my own private use.
I saw the docs on Zen that Subscription plans and a free tier are coming soon., then I can use this method again.

@grenaad commented on GitHub (Nov 14, 2025): @conradkoh I managed to work around this problem by using the [OpenCode Zen](https://opencode.ai/auth) provider. They have Bring Your Own Key, so I used my API key with them and then use my subscription with the Anthropic provider. You can just switch between them with `/models`. Right now I have two subscriptions: One for work and one for my own private use. I saw the docs on Zen that `Subscription plans and a free tier are coming soon.`, then I can use this method again.
Author
Owner

@rekram1-node commented on GitHub (Nov 14, 2025):

Oh that's not a bad solution, I should've suggested that

@rekram1-node commented on GitHub (Nov 14, 2025): Oh that's not a bad solution, I should've suggested that
Author
Owner

@igordertigor commented on GitHub (Nov 20, 2025):

@grenaad , that's a decent workaround but only if you are free to pick the source of tokens. Once you have a bunch of anthropic tokens, going with a different provider isn't really a good option.

I would also argue that it's still a workaround: Once my subscription reaches a limit, I need to manually switch the model rather than automatically falling back to pay as you go.

@igordertigor commented on GitHub (Nov 20, 2025): @grenaad , that's a decent workaround but only if you are free to pick the source of tokens. Once you have a bunch of anthropic tokens, going with a different provider isn't really a good option. I would also argue that it's still a workaround: Once my subscription reaches a limit, I need to manually switch the model rather than automatically falling back to pay as you go.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2835