Claude Code module authentication with Claude Code Subscription
I've a Claude Code Max Subscription, I want to use that instead of Console API KEY, how can I do that cleanly, Now I'm doing it by mounting volumes.
6 Replies
<#1404654368745193492>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Hi @Riajul Islam
Can you explain your current workaround?
And what do you expect the module to improve to better support Claude Max users
Initially I've tried mounting ~/.claude.json and ~/.claude/.credentials.json to a temp location in container and then on startup script I've copied that mounted files to the expected folder inside the container, and it was working.
And then I found another challenge where these credential files from host machine is not long lived, they need to get synced every ~6 hours.
And then I noticed there was already a way to generate long lived oauth token using the
claude setup-token
command, which I used to generate a long lived token, which I injects into the container with environment variable named: CLAUDE_CODE_OAUTH_TOKEN
I was using the tasks-docker
template to test it out, and it would have been better beside having anthropic_api_key
variable for console API key injection, there was a variable for claude_code_oauth_token
.
In my case I've modified the main.tf to use the new variable, like this:
Note: both (API Key, Oauth Token) cannot exist at the same time.Good feedback if you like we welcome a PR to add this functionality to the module on registry so that others can benefit from it.
Glad to know the workaround
@Riajul Islam ^