Skip to content

Maintaining multiple auth profiles on the same provider #893

Closed

Description

@OneAbodFTW

I've two keys in use, for two separate projects both are from Open Router, but wants to keep costs seperate.

When I run

opencode auth login

Chose openrouter, add the API key. then run the auth flow again, and add another API.

After that I call:

opencode auth list

I only see the latest openrouter key added, and can not switch between different auth profiles per se.

If you can point me in the right direction with more details, might be able to implement this.

Activity

  1. thdxr commented on Jul 12, 2025

    @thdxr
    Member

    i'm not sure this is something we'll support because it's tricky to then have to specify which auth to use for a given provider, loses a lot of simplicity

    i recommend maybe using env vars for each project for the different keys? you can put an opencode.json in the folder of each and read from a different env var under apiKey: "{env:OPENROUTER_KEY_1}"

  2. thdxr commented on Jul 12, 2025

    @thdxr
    Member
  3. OneAbodFTW commented on Jul 14, 2025

    @OneAbodFTW
    Author

    Oh, thank you, did not know that I could override the key within the config file, that works for my use-case, perhaps this needs a section in the documentation? As it was not clear initially to me this was possible.

  4. jfpedroza commented on Aug 1, 2025

    @jfpedroza

    Related to this. I would like to use Claude Pro for personal projects and use an Anthropic API key for projects. Is that supported?

  5. added a commit that references this issue on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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