Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat(openai): Add Config Option to Overwrite OpenAI's API Base#3066

Merged
mrubens merged 2 commits into
RooCodeInc:mainfrom
GOODBOY008:feature/openai-baseurl
May 1, 2025
Merged

feat(openai): Add Config Option to Overwrite OpenAI's API Base#3066
mrubens merged 2 commits into
RooCodeInc:mainfrom
GOODBOY008:feature/openai-baseurl

Conversation

@GOODBOY008
Copy link
Copy Markdown
Contributor

@GOODBOY008 GOODBOY008 commented Apr 30, 2025

Context

Add Config Option to Overwrite OpenAI's API Base #3052

Description:

It would be beneficial to add a configuration option that allows users to overwrite the OpenAI API base.

Use Case:

Users facing issues with OpenAI's regional restrictions, where the default API base may not be accessible due to geo-blocking or other limitations.

Screenshots

before after
891711a4-2bd3-45e6-a877-eafbf88fe2b2 ea607bf2-6103-4d4a-869d-62223996023c

|

How to Test

Get in Touch


Important

Adds openAiNativeBaseUrl configuration option to overwrite OpenAI's API base URL, updating relevant schemas, models, and UI components.

  • Behavior:
    • Adds openAiNativeBaseUrl to providerSettingsSchema in roo-code.ts and schemas/index.ts.
    • Updates OpenAiNativeHandler in openai-native.ts to use openAiNativeBaseUrl for API client initialization.
    • Updates ApiOptions in ApiOptions.tsx to include a text field for openAiNativeBaseUrl when openai-native is selected.
  • Models:
    • Adds openAiNativeBaseUrl to ProviderSettings in roo-code.d.ts and types.ts.
  • Misc:
    • Updates providerSettingsRecord in roo-code.ts and schemas/index.ts to include openAiNativeBaseUrl.

This description was created by Ellipsis for b3c7be7. You can customize this summary. It will automatically update as commits are pushed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2025

⚠️ No Changeset found

Latest commit: 94ead25

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Enhancement New feature or request labels Apr 30, 2025
onInput={handleInputChange("openAiNativeBaseUrl")}
placeholder={t("settings:placeholders.baseUrl")}
className="w-full">
<label className="block font-medium mb-1">{t("settings:providers.openAiBaseUrl")}</label>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the openai-native provider, the text field uses the translation key settings:providers.openAiBaseUrl which is also used by the regular OpenAI provider. Consider using a more specific key (e.g., settings:providers.openAiNativeBaseUrl) to clearly differentiate the native API base URL from the standard one.

Suggested change
<label className="block font-medium mb-1">{t("settings:providers.openAiBaseUrl")}</label>
<label className="block font-medium mb-1">{t("settings:providers.openAiNativeBaseUrl")}</label>

This comment was generated because it violated a code review rule: mrule_JLtLS6tLppVEv8iV.


{selectedProvider === "openai-native" && (
<>
<VSCodeTextField
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this behind a checkbox like we do for Anthropic, OpenRouter, etc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I believe it will be more user-friendly.

@jerilseb
Copy link
Copy Markdown

There is an API Provider name 'OpenAI Compatible' which allows custom base URL. Doesn't that solve this use case?

@mrubens
Copy link
Copy Markdown
Collaborator

mrubens commented Apr 30, 2025

There is an API Provider name 'OpenAI Compatible' which allows custom base URL. Doesn't that solve this use case?

I don't want to speak for @GOODBOY008, but in some cases it's hard to support different native OpenAI models like o1, o3, and o4-mini with the checkboxes that are provided in the OpenAI-compatible provider.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Apr 30, 2025
@GOODBOY008 GOODBOY008 requested a review from mrubens April 30, 2025 16:20
Copy link
Copy Markdown
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 1, 2025
@mrubens mrubens merged commit 8c428b5 into RooCodeInc:main May 1, 2025
14 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in Roo Code Roadmap May 1, 2025
mehmetsunkur pushed a commit to mehmetsunkur/Roo-Code that referenced this pull request May 16, 2025
…deInc#3066)

* feat(openai): Add Config Option to Overwrite OpenAI's API Base

* feat(openai): Add option to use custom base URL for OpenAI native API
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants