Have multiple instances of the same provider
Question
Curious if it's possible to have multiple instances of the same provider from the same provider?
One user group that will benefit this are people managing multiple OpenRouter accounts plus their personal ones.
The idea is this: on Select model, instead of single OpenRouter group:
OpenRouter Claude Haiku 3.5 Claude Haiku 4.5
It will be:
<Custom name 1> (OpenRouter) Claude Haiku 3.5 Claude Haiku 4.5
<Custom name 2> (OpenRouter) Claude Haiku 3.5 Claude Haiku 4.5
-- Meanwhile, on Connect provider, instead of asking for the key right away, a custom name will be asked optionally
The idea is there can be multiple instances of the same provider
This issue might be a duplicate of existing issues. Please check:
- #5391: [FEATURE]: multiple auth profiles per provider - Requests the ability to have multiple profiles per provider that can be switched between in the provider picker
- #5748: Proposal: Provider Auth v2 (encrypted credential vault + multi-account OAuth + same-request rotation) - Comprehensive proposal for multi-account support per provider with encrypted credential vault
- #1326: Support multiple API keys per provider with fallback logic - Requests multiple API keys per provider with automatic fallback
Feel free to ignore if none of these address your specific case.
+1 for this. From a billing standpoint, allowing multiple API keys would be a quality of life improvement. For people who mix work and personal on one computer (#7188) or want separate billing on a per project basis this would make that a lot easier.
Edit: I see you can configure per project API keys in the config section, which solves my problem :)
@spenceforce Do you have a link to the docs where this is possible?
I also have the feeling that this works for API-key based providers, but not the oauth ones (e.g. anthropic)
Edit: Nevermind, found it. For reference: https://opencode.ai/docs/config/#env-vars. But as said, looks like it only works for api key based auth
Digged a little in the source code. It looks like oauth credentials are stored globally in /Users/patriksimms/.local/share/opencode/auth.json with following schema:
{
"anthropic": {
"type": "oauth",
"refresh": "sk-ant-ort01-eA...",
"access": "sk-ant-oat01-5t...",
"expires": 1234
}
}
I only see references to API keys and not oauth credentials. I primarily work with API keys, so didn't even think about that use case when I made my comment. That would still be a pain point then.