Add backend provider and cost configuration

This commit is contained in:
2026-11-22 18:11:10 +00:00
parent f2b0ed8d6c
commit 6056f93e55
9 changed files with 108 additions and 13 deletions

View File

@@ -26,6 +26,10 @@ type BackendConfig struct {
ID string
// Extends names a sibling backend to inherit through ConfigKit.
Extends *string
// Provider selects the backend's supported API conventions.
Provider *string
// ZeroCost enables a zero-cost fallback when no usable charge is reported.
ZeroCost *bool
// Endpoint is the required absolute HTTP(S) base URL after all layers merge.
Endpoint *string
// APIKeyEnv optionally names an environment variable, not a credential.
@@ -55,6 +59,12 @@ func BackendSource(label string, backends []BackendConfig) configkit.Source {
if config.Extends != nil {
fields["extends"] = map[string]any{"id": *config.Extends}
}
if config.Provider != nil {
fields["provider"] = *config.Provider
}
if config.ZeroCost != nil {
fields["zero_cost"] = *config.ZeroCost
}
if config.Endpoint != nil {
fields["endpoint"] = *config.Endpoint
}