feat: Add support for custom Anthropic API endpoints#5
Open
denkhaus wants to merge 1 commit intosteveyegge:mainfrom
Open
feat: Add support for custom Anthropic API endpoints#5denkhaus wants to merge 1 commit intosteveyegge:mainfrom
denkhaus wants to merge 1 commit intosteveyegge:mainfrom
Conversation
- Add NewAnthropicClient utility function in internal/ai/utils.go - Support ANTHROPIC_BASE_URL environment variable for custom endpoints - Replace direct client instantiation across all AI packages - Reduce code duplication and improve maintainability This enables VC to work with alternative Anthropic-compatible endpoints by setting the ANTHROPIC_BASE_URL environment variable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
reifying
pushed a commit
to reifying/vc
that referenced
this pull request
Dec 22, 2025
- Added comprehensive tests for buildIterationContext() (both refiners) - Added tests for serialization edge cases - Added tests for deserializeAnalysis() error path - Added tests for prompt construction (convergence and refinement) - Added tests for truncateForPrompt() utility - Added nil artifact error path tests for Refine() methods - All tests are fixture-based and run without ANTHROPIC_API_KEY Coverage improvements: - analysis_refiner.go: 85.3% (buildIterationContext 0%->100%, truncateForPrompt 66.7%->100%, serializeAnalysis 72.5%->95%, deserializeAnalysis 0%->100%) - assessment_refiner.go: 73.1% (buildConvergencePrompt 0%->100%, buildRefinementPrompt 0%->100%) - Overall refiner coverage: 79.96% (exceeds 60% target) Addresses vc-ckef acceptance criteria #1, steveyegge#4, steveyegge#5, steveyegge#6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 introduces support for custom Anthropic API endpoints by adding a centralized client creation utility that respects the
ANTHROPIC_BASE_URLenvironment variable. This enables VC to work with Anthropic-compatible APIs, custom deployments, or alternative endpoints while maintaining backward compatibility.Key Changes
New Utility Function
NewAnthropicClient()ininternal/ai/utils.gothat:ANTHROPIC_BASE_URLenvironment variable for custom endpointsRefactored Client Instantiation
Replaced direct
anthropic.NewClient()calls with the new utility in:internal/ai/supervisor.go- AI supervision functionalityinternal/discovery/sdk/ai.go- AI discovery SDKinternal/executor/agent.go- Agent loop detectioninternal/executor/executor.go- Auto-commit message generationinternal/repl/conversation_state.go- REPL conversation handlinginternal/health/model_*_test.go- Test files for model cost/qualityBenefits
Usage
To use with a custom endpoint:
If
ANTHROPIC_BASE_URLis not set, the client will use the default Anthropic API endpoint.Testing
This enhancement makes VC more adaptable to different deployment scenarios and enables integration with custom AI infrastructure while maintaining simplicity for standard use cases.