feat: Add Claude Code CLI as an AI Provider Option
Feature Request: Add Claude Code CLI as an AI Provider Option
Summary
Add support for using Claude Code CLI as an AI provider, allowing users to leverage Claude's capabilities through their existing Claude Pro/Max/Team subscriptions without requiring API keys.
Problem
Currently, Task Master requires users to obtain and manage API keys for AI providers, which presents several challenges:
- Cost Management: API usage can be expensive and unpredictable
- Security Concerns: Storing API keys in configuration files poses security risks if not using environment variables
- Accessibility: Users with Claude Pro/Max subscriptions cannot leverage their existing access
Proposed Solution
Implement a new AI provider that interfaces with Claude Code CLI, which is already installed by many developers and handles authentication through the browser. This would:
- Eliminate API Keys: Use Claude Code's built-in authentication
- Leverage Existing Subscriptions: Claude Pro/Team users can use their existing access
- Maintain Full Compatibility: Work seamlessly with all Task Master features
- Improve Security: No credentials stored in project files
Implementation Details
Technical Approach
Create a new ClaudeCodeCLIProvider that:
- Extends the existing
BaseAIProviderclass - Uses Node.js child process APIs to interact with Claude CLI
- Handles authentication validation via
claude auth status - Uses
claude -p "prompt" --model opus --output-format jsonfor structured responses - Note: Temperature and other inference parameters are not available via CLI
Example Usage
# Configure Claude Code CLI as provider
task-master config --provider claude-code-cli
# Use Task Master normally - no API keys needed!
task-master parse-prd "Build a todo app"
Configuration Example
{
"models": {
"main": {
"model": "opus",
"provider": "claude-code-cli"
}
}
}
Benefits
- Zero Additional Cost for Claude Pro/Max users
- Enhanced Security - no API keys to manage or expose
- Easy Team Adoption - each member uses their own Claude account
- Familiar Tool - many developers already have Claude Code installed and Pro/Max subscriptions
Compatibility
- Would work alongside existing API providers
- Users could configure fallback providers if needed
- Full compatibility with MCP server mode
- No breaking changes to existing functionality
Prior Art
The project already has excellent patterns for this:
- Ollama provider works without API keys
- Well-structured provider abstraction layer
- Existing CLI integration patterns in the codebase
Implementation Effort
Based on the codebase analysis, this would be a moderate effort:
- Core provider implementation: ~200-300 lines
- Configuration updates: ~50 lines
- Tests and documentation: ~300-400 lines
Questions for Discussion
- Should streaming be supported in the initial implementation?
- What should be the default timeout for CLI operations?
- Should we auto-detect Claude Code CLI availability?
Additional Context
Claude Code CLI is now widely available and supports:
- Authentication via
claude auth login - JSON output format via API mode
- Model selection (opus, sonnet)
- Comprehensive error reporting
Many developers already use Claude Code for their daily work, making this integration a natural extension that would significantly improve Task Master's accessibility.
Willingness to Contribute
I'm willing to help contribute to the implementation where I can if this feature is accepted. I've created a draft PRD outlining possible implementation approach.
Related Documentation:
Looks like someone beat me to this idea... https://github.com/eyaltoledano/claude-task-master/pull/649 - I hope this makes it in!
There's a PR for this, and we're going to get to it as soon as possible. It's an exciting one and we plan to release it and see what happens. :)
I've taken a stab at an AI SDK that might be helpful, I envision this isn't the only project I want claude code option on.
https://github.com/ben-vargas/ai-sdk-provider-claude-code
I got here because I was just looking for this as a possibility :D. At first I was thinking of what about wrapping Claude Code in an MCP so that we could have Claude Code use Claude Code :D. Then I thought task master would be a good one to use!