feat(agent): support custom baseURL for Claude Code workspaces#543
feat(agent): support custom baseURL for Claude Code workspaces#543MarsKubeX wants to merge 2 commits into
Conversation
When a model ID includes a base URL (provider::model::baseURL), write ANTHROPIC_BASE_URL into .claude/settings.json so Claude Code routes requests to the custom endpoint. This enables local inference engines (e.g. llama-server) and API proxies. Part of openkaiden/kaiden#1855 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesClaude Agent Container Host URL Configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/agent/claude.go`:
- Around line 238-247: When baseURL is empty we must clear a stale
ANTHROPIC_BASE_URL in the model config so a previous custom endpoint doesn't
persist; in the function containing this block (e.g., SetModel / the code using
config and env variables in pkg/agent/claude.go) detect the case where baseURL
== "" and remove the ANTHROPIC_BASE_URL key from the env map (obtained from
config["env"]) if it exists, then write the env map back into config["env"];
keep the existing behavior when baseURL != "" that sets
env["ANTHROPIC_BASE_URL"] to the resolvedURL.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6982bde0-2f86-4324-aea5-6baa8a12186c
📒 Files selected for processing (2)
pkg/agent/claude.gopkg/agent/claude_test.go
If a pre-existing .claude/settings.json contains ANTHROPIC_BASE_URL from a previous configuration, remove it when the new model ID does not include a custom base URL to prevent unintended routing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
|
@coderabbitai resolve |
✅ Actions performedComments resolved. Approval is disabled; enable |
When a model ID includes a base URL (provider::model::baseURL), write ANTHROPIC_BASE_URL into .claude/settings.json so Claude Code routes requests to the custom endpoint. This enables local inference engines (e.g. llama-server) and API proxies.
Part of openkaiden/kaiden#1855