feat: configurable tool pricing, Sub2API channel, and alpha search billing

Add admin-configurable tool-call prices with cross-provider surcharge
settlement, Sub2API channel support, /v1/alpha/search relay, and usage-log
surcharge UI.
This commit is contained in:
CaIon
2026-07-26 20:05:15 +08:00
parent 3e1e728279
commit 2d23cdf291
65 changed files with 3210 additions and 431 deletions
+4
View File
@@ -52,6 +52,8 @@ const (
RelayModeGemini
RelayModeResponsesCompact
RelayModeAlphaSearch
)
func Path2RelayMode(path string) int {
@@ -76,6 +78,8 @@ func Path2RelayMode(path string) int {
relayMode = RelayModeResponsesCompact
} else if strings.HasPrefix(path, "/v1/responses") {
relayMode = RelayModeResponses
} else if strings.HasPrefix(path, "/v1/alpha/search") {
relayMode = RelayModeAlphaSearch
} else if strings.HasPrefix(path, "/v1/audio/speech") {
relayMode = RelayModeAudioSpeech
} else if strings.HasPrefix(path, "/v1/audio/transcriptions") {
+22
View File
@@ -0,0 +1,22 @@
package constant
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPath2RelayMode(t *testing.T) {
tests := []struct {
path string
want int
}{
{path: "/v1/alpha/search", want: RelayModeAlphaSearch},
{path: "/v1/alpha/search?foo=1", want: RelayModeAlphaSearch},
}
for _, tt := range tests {
t.Run(tt.path, func(t *testing.T) {
assert.Equal(t, tt.want, Path2RelayMode(tt.path))
})
}
}