GeezerVison is showing github.com — [FEATURE]: Claude Agent: configDir setting to use another Claude Code login · Issue #60793 · anomalyco/opencode
[FEATURE]: Claude Agent: configDir setting to use another Claude Code login #60793DescriptionFeature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Claude Agent always runs claude on the login from the shell's CLAUDE_CONFIG_DIR, or ~/.claude. You can't give one model a different login, so with more than one Claude login you have to restart OpenCode with another environment to switch.
Claude Code already supports this with CLAUDE_CONFIG_DIR ("Useful for running multiple accounts side by side", https://code.claude.com/docs/en/env-vars). You sign in to each directory with CLAUDE_CONFIG_DIR=/path claude auth login, so OpenCode still never sees a token.
Proposal: add settings.configDir to the Claude Agent connection settings, mapped to CLAUDE_CONFIG_DIR, next to baseURL and apiKey. Like those, it works on the provider or on one model, so a model alias can run on another login:
{
"providers": {
"claude-agent": {
"models": {
"opus-second": {
"modelID": "opus",
"settings": { "configDir": "/home/you/.claude-second" }
}
}
}
}
}
One limit: the Agent SDK's session functions read CLAUDE_CONFIG_DIR only from OpenCode's own environment, so on a custom configDir a chat rebuilds from history after the idle timeout or an edit instead of resuming. Filed upstream: anthropics/claude-agent-sdk-typescript#527
I have this implemented with tests and will open a PR that references this issue. Reacted by rimless-casualty and Thomas Mol Activityopencodejr commented on Oct 31, 2026 Thanks for the detailed proposal, @mr-karan!
To restate it: you'd like a settings.configDir option for the Claude Agent provider, set on the provider or on a single model and mapped to CLAUDE_CONFIG_DIR. That way different model aliases can use different Claude Code logins without restarting OpenCode under another environment. Today the connection settings map only baseURL, apiKey, authToken, headers and timeouts to claude's environment, so this would be a new option rather than a bug fix.
I couldn't find an existing request for this. Related but different:
Thanks for already noting the session-resume limit (anthropics/claude-agent-sdk-typescript#527). Maintainers will consider the request and review your PR when it's up.
garysassano commented on Nov 2, 2026 The multiple-account setup this needs is documented by Anthropic: Log in with multiple accounts says to give each account its own CLAUDE_CONFIG_DIR, and that each directory keeps its own settings, session history and login.
That is exactly the setup that breaks here. With two Claude accounts:
- Sign in to each directory:
claude auth login for ~/.claude, and CLAUDE_CONFIG_DIR=~/.claude-alt claude auth login for the second.
- Connect Claude Agent and send a message. The provider spawns
claude with the server environment, so it always uses ~/.claude. A shell alias like claude-alt never applies, because OpenCode does not go through the interactive shell.
- When the first account hits its weekly limit, there is no way to switch to the second from
/connect or /models. The only option is to restart the whole server with a different CLAUDE_CONFIG_DIR.
A settings.configDir on the provider or a model, mapped to CLAUDE_CONFIG_DIR, would fix this without a restart and would let one OpenCode instance use several Claude Code logins side by side, which is the documented Anthropic pattern.
Workarounds on 2.2.5:
opencode service stop, then CLAUDE_CONFIG_DIR=$HOME/.claude-alt opencode service start
- Or a private server for the other account:
CLAUDE_CONFIG_DIR=$HOME/.claude-alt opencode --standalone
opencode service set env CLAUDE_CONFIG_DIR ... did not apply for me: opencode service start starts with the caller's environment rather than the saved config, and running service set env inside an OpenCode session is cancelled when the service restarts before it saves.
Environment: opencode 2.2.5, WSL2, no plugins. thomasmol commented on Nov 18, 2026 Would very much want this!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|