feat(config): add [[providers]] in .forge.toml#2821
Merged
tusharmath merged 3 commits intomainfrom Apr 3, 2026
Merged
Conversation
[[providers]] in .forge.toml
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
Allow users to define custom or override built-in providers directly in
forge.toml, enabling teams to integrate proprietary or self-hosted LLM endpoints without code changes.Context
Previously, adding a new LLM provider or adjusting an existing provider's settings (URL, API key variable, protocol, headers) required modifying the built-in provider registry in Rust source code. This made it impossible for teams to use self-hosted models, enterprise proxies, or custom OpenAI-compatible endpoints through configuration alone.
This feature unlocks a configuration-first workflow: any provider reachable via a supported wire protocol (OpenAI, Anthropic, Google, Bedrock, OpenAIResponses) can now be registered or overridden entirely from
forge.toml.Changes
ProviderEntryandProviderUrlParamstructs toforge_configfor inline provider definitionsprovidersfield toForgeConfigthat accepts a list ofProviderEntryvaluesFrom<ProviderEntry>andFrom<ProviderUrlParam>conversions inforge_repoto transform config entries into internalProviderConfig/UrlParamVarConfigtypesforge.schema.jsonwith full JSON Schema definitions forProviderEntryandProviderUrlParam, enabling editor autocomplete and validationKey Implementation Details
Entries with an
idmatching a built-in provider override that provider's fields field-by-field; entries with a newidare appended to the provider list. URL templates support{{VAR}}placeholders substituted fromurl_param_varsat runtime. Custom HTTP headers can be injected per-provider viacustom_headers. Wire protocol is set viaresponse_type(accepts"OpenAI","Anthropic","Google","Bedrock","OpenAIResponses").Use Cases
Register a self-hosted OpenAI-compatible endpoint:
Override a built-in provider's base URL with template variables:
Add custom headers for an enterprise provider:
Testing