feat: add configurable API base URL (fixes #7, closes #9)#10
Open
shivamtiwari3 wants to merge 1 commit intosachaa:masterfrom
Open
feat: add configurable API base URL (fixes #7, closes #9)#10shivamtiwari3 wants to merge 1 commit intosachaa:masterfrom
shivamtiwari3 wants to merge 1 commit intosachaa:masterfrom
Conversation
Allow users to set a custom API endpoint in Settings. The configured URL is persisted in IndexedDB and forwarded to the agent worker, which uses it in place of the hardcoded Anthropic endpoint. Leaving the field blank continues to use https://api.anthropic.com/v1/messages unchanged. This enables pointing the app at any proxy or compatible endpoint, including OpenAI-format gateways that implement the Anthropic messages API surface.
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
Adds a new API Base URL field to the Settings page, letting users point the app at any proxy or compatible endpoint instead of the hardcoded Anthropic URL.
Problem
The API endpoint was hardcoded to
https://api.anthropic.com/v1/messagesinconfig.tsand used directly inagent-worker.ts. Users who run a local proxy, a corporate gateway, or want to experiment with OpenAI-compatible endpoints that mirror the Anthropic messages API had no way to override it.Solution
src/config.ts— addedBASE_URLkey toCONFIG_KEYS.src/types.ts— added optionalbaseUrl?: stringtoInvokePayloadandCompactPayload.src/orchestrator.ts— new privatebaseUrlfield loaded from IndexedDB oninit(); newgetBaseUrl()/setBaseUrl()methods; field forwarded in bothinvokeandcompactworker messages.src/agent-worker.ts—handleInvokeandhandleCompactresolveapiUrl = baseUrl || ANTHROPIC_API_URL, so the default is completely unchanged when the field is blank.src/components/settings/SettingsPage.tsx— new API Base URL card between the API Key and Model sections with a URL input, Save button, and confirmation feedback.Leaving the field empty keeps existing behaviour — no breaking change.
Testing
npm run typecheck— passes with zero errors.Checklist
npm run typecheck)