fix(workspace): project Anthropic adapter creds for BYOK MiniMax on claude-code (core#2709) #2711
Reference in New Issue
Block a user
Delete Branch "fix/2709-claude-code-minimax-auth-projection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes molecule-ai/molecule-core#2709.
After restart, a claude-code workspace using BYOK MiniMax only had
MINIMAX_API_KEYset. The claude-code adapter uses the Anthropic SDK, which readsANTHROPIC_AUTH_TOKENandANTHROPIC_BASE_URL, so it 401ed againstapi.minimax.io/anthropic.Root cause:
applyPlatformManagedLLMEnvreturned early on the BYOK branch without projecting Anthropic-shaped credentials for the claude-code Anthropic SDK adapter.Fix:
claude-codeand the resolved provider declares anAuthTokenEnv, copy the first available provider auth-env value intoAuthTokenEnvand project the provider'sBaseURLAnthropicasANTHROPIC_BASE_URL.AuthTokenEnvinstead of hardcodingANTHROPIC_API_KEY(platform proxy keepsANTHROPIC_API_KEY; MiniMax keepsANTHROPIC_AUTH_TOKEN).Test plan:
go test ./workspace-server/internal/handlers/ -run TestApplyPlatformManagedLLMEnv_ -vgo test ./workspace-server/internal/handlers/(green).Co-Authored-By: Claude noreply@anthropic.com
APPROVED on head
311b225bf6. The BYOK early-return path now projects claude-code's Anthropic adapter credentials before returning: for a BYOK MiniMax workspace withMINIMAX_API_KEY, the resolved MiniMax provider is read from the provider registry,ANTHROPIC_AUTH_TOKENis populated from the available provider auth env, andANTHROPIC_BASE_URLis set to the MiniMax Anthropic-compatible endpoint. The originalMINIMAX_API_KEYis preserved. Platform-managed claude-code projection also now uses the resolved provider'sauth_token_env, which keeps platform onANTHROPIC_API_KEYwhile allowing MiniMax-compatible providers to useANTHROPIC_AUTH_TOKEN. Test coverage directly exercises the BYOK MiniMax claude-code projection and verifies token, base URL, resolved BYOK mode, and preserved MiniMax key. CI/all-required and the relevant Go/E2E checks are green; PR is mergeable./sop-ack