feat(auth): add support for multiple profiles per provider#36781
Open
muhedin998 wants to merge 6 commits into
Open
feat(auth): add support for multiple profiles per provider#36781muhedin998 wants to merge 6 commits into
muhedin998 wants to merge 6 commits into
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
muhedin998
force-pushed
the
feat/multi-profile-auth
branch
from
July 14, 2026 13:06
246e623 to
75c0ace
Compare
Allow users to store multiple API keys for the same provider with named profiles (e.g., separate OpenRouter keys for different cost tracking). Changes: - Auth module: Added profile support to get/set/remove, plus profiles(), hasDefault(), setDefault() functions - CLI commands: login prompts for profile name when default exists, logout/list show profile names, new set-default command - Provider: parseModel() extracts profile from provider:profile/model format - Config: Added optional profile field to provider schema Key format: 'providerID' for default, 'providerID:profileName' for named. Usage: opencode auth login # first login creates default opencode auth login # second login prompts for profile name opencode auth list # shows all profiles grouped by provider opencode auth set-default # swap a named profile to be the default opencode auth logout # shows profiles in selection Model string format: openrouter:work/claude-sonnet-4 # uses 'work' profile openrouter/claude-sonnet-4 # uses default profile Closes anomalyco#5391
- Auth profiles: set/get with profiles, list profiles, hasDefault, setDefault swap, remove with profile - parseKey/buildKey/validateProfileName utilities - parseModel with provider:profile/model format
muhedin998
force-pushed
the
feat/multi-profile-auth
branch
from
July 14, 2026 23:37
0c42281 to
f7e31f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #5391
Type of change
What does this PR do?
Allow users to store multiple API keys for the same provider with named profiles (e.g., separate OpenRouter keys for different cost tracking).
Changes:
get/set/remove, plusprofiles(),hasDefault(),setDefault()functions. Key format:providerIDfor default,providerID:profileNamefor named profiles.loginprompts for profile name when default exists,logout/listshow profile names, newset-defaultcommand.parseModel()extracts profile fromprovider:profile/modelformat.profilefield to provider schema.How did you verify your code works?
packages/opencodeandpackages/coreprovider:profile/modelformatChecklist