feat: Add setting to use Claude subscription when API key is detected #1229
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.
Summary
This PR adds a new optional
use_claude_subscriptionsetting to the ClaudeCode executor configuration. When enabled, this setting removes theANTHROPIC_API_KEYenvironment variable before spawning the Claude Code agent, ensuring that users with Claude Pro/Team subscriptions can opt to use their subscription instead of being charged API fees.Problem
Users who have both a Claude subscription AND an
ANTHROPIC_API_KEYset in their environment variables are inadvertently charged API usage fees when running Claude Code agents through VibeKanban. This happens because:Solution
This PR introduces a new checkbox setting in the Agents settings page that allows users to explicitly opt into using their Claude subscription when an API key is detected.
Changes
Backend (Rust)
crates/executors/src/executors/claude.rs:use_claude_subscriptionoptional field to theClaudeCodestructspawn_internal()to conditionally removeANTHROPIC_API_KEYfrom the environment when the setting is enabledFrontend (Auto-generated)
#[derive(TS)]macroImplementation Details
Option<bool>and defaults tofalsewhen not set, maintaining backward compatibility#[serde(skip_serializing_if = "Option::is_none")]to keep JSON configuration cleanCommand::env_remove()to remove the environment variableBenefits
Testing
The implementation follows the existing patterns in the codebase:
Screenshots
Setting in Agents Settings Page:
The new checkbox will appear automatically in the ClaudeCode executor configuration form alongside other settings like
plan,approvals, andmodel.Related
Questions for Reviewers
Should this setting be global or per-configuration?Implementation: Per-configuration (follows existing pattern for executor-specific settings)Checklist