Add backend provider and cost configuration
This commit is contained in:
10
backends.go
10
backends.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user