Files
Luminary/internal/handler/admin/helpers.go
T
renjue 76ba500417
CI / docker (push) Successful in 2m4s
Initial commit: Luminary AI Gateway
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress,
ingress key governance, monitoring, and security controls.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 21:46:16 +08:00

30 lines
835 B
Go

package admin
import (
"fmt"
"strconv"
"github.com/rose_cat707/luminary/internal/model"
"github.com/rose_cat707/luminary/internal/provider"
"github.com/rose_cat707/luminary/internal/provider/anthropic"
"github.com/rose_cat707/luminary/internal/provider/custom"
"github.com/rose_cat707/luminary/internal/provider/openai"
)
func parseUint(s string) uint {
v, _ := strconv.ParseUint(s, 10, 64)
return uint(v)
}
func (h *Handler) gatewayClient(t model.ProviderType) (provider.Client, error) {
switch t {
case model.ProviderOpenAI, model.ProviderAzureOpenAI, model.ProviderOpenRouter, model.ProviderOllama:
return openai.New(), nil
case model.ProviderAnthropic:
return anthropic.New(), nil
case model.ProviderCustom:
return custom.New(), nil
default:
return nil, fmt.Errorf("unsupported provider type: %s", t)
}
}