Files
CLIProxyAPI/sdk/cliproxy/auth/conductor_speech_format_test.go
luohui1 6a853dce05 feat(xai): expose Grok TTS on /v1/audio/speech
Route OpenAI speech requests to the official xAI /tts endpoint and register grok-tts and grok-voice-tts-1.0.
2026-10-06 02:49:21 -07:00

37 lines
1.0 KiB
Go

package auth
import (
"testing"
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v8/sdk/cliproxy/executor"
sdktranslator "github.com/router-for-me/CLIProxyAPI/v8/sdk/translator"
)
func TestRequestToFormatKeepsMediaSources(t *testing.T) {
cases := []struct {
source string
want string
}{
{source: "openai-image", want: "openai-image"},
{source: "openai-video", want: "openai-video"},
{source: "openai-speech", want: "openai-speech"},
}
for _, tt := range cases {
t.Run(tt.source, func(t *testing.T) {
got := requestToFormat("xai", nil, cliproxyexecutor.Request{}, cliproxyexecutor.Options{
SourceFormat: sdktranslator.FromString(tt.source),
})
if got.String() != tt.want {
t.Fatalf("requestToFormat() = %q, want %q", got, tt.want)
}
})
}
got := requestToFormat("xai", nil, cliproxyexecutor.Request{}, cliproxyexecutor.Options{
SourceFormat: sdktranslator.FormatOpenAI,
})
if got != sdktranslator.FormatCodex {
t.Fatalf("chat requestToFormat() = %q, want codex", got)
}
}