Files
ez-api/internal/dto/provider.go
zenfun 174735f152 feat(api): add provider creation endpoints and weight support
- Add `POST /admin/providers/preset` for streamlined creation of official providers (OpenAI, Anthropic, Gemini)
- Add `POST /admin/providers/custom` for generic OpenAI-compatible providers
- Add `weight` field to provider model and DTOs to enable weighted routing
- Update sync service to propagate provider weights
- Add unit tests for new creation handlers
2025-12-17 21:40:54 +08:00

24 lines
925 B
Go

package dto
import "time"
// ProviderDTO defines inbound payload for provider creation/update.
type ProviderDTO struct {
Name string `json:"name"`
Type string `json:"type"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
GoogleProject string `json:"google_project,omitempty"`
GoogleLocation string `json:"google_location,omitempty"`
Group string `json:"group"`
Models []string `json:"models"` // List of supported model names
Status string `json:"status"`
Weight int `json:"weight,omitempty"`
AutoBan *bool `json:"auto_ban,omitempty"`
BanReason string `json:"ban_reason,omitempty"`
BanUntil time.Time `json:"ban_until,omitempty"`
// Optional control params
SkipRouting bool `json:"skip_routing,omitempty"` // if true, do not add to routing tables (e.g., disabled)
}