| 1 | package config |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestAdditionalProviderRoutes(t *testing.T) { |
| 6 | cases := []struct{ id, brand, kind, url string }{ |
| 7 | {"doubao-chat", "doubao", "openai", "https://ark.cn-beijing.volces.com/api/v3"}, |
| 8 | {"doubao-responses", "doubao", "responses", "https://ark.cn-beijing.volces.com/api/v3"}, |
| 9 | {"baidu-cloud", "baidu", "openai", "https://qianfan.baidubce.com/v2"}, |
| 10 | {"ppio", "ppio", "openai", "https://api.ppio.com/openai"}, |
| 11 | {"qiniu", "qiniu", "openai", "https://api.qnaigc.com/v1"}, |
| 12 | {"xai-chat", "xai", "openai", "https://api.x.ai/v1"}, |
| 13 | {"xai-responses", "xai", "responses", "https://api.x.ai/v1"}, |
| 14 | {"cerebras", "cerebras", "openai", "https://api.cerebras.ai/v1"}, |
| 15 | {"together", "together", "openai", "https://api.together.ai/v1"}, |
| 16 | {"fireworks-chat", "fireworks", "openai", "https://api.fireworks.ai/inference/v1"}, |
| 17 | {"fireworks-anthropic", "fireworks", "anthropic", "https://api.fireworks.ai/inference"}, |
| 18 | {"fireworks-responses", "fireworks", "responses", "https://api.fireworks.ai/inference/v1"}, |
| 19 | } |
| 20 | for _, tc := range cases { |
| 21 | t.Run(tc.id, func(t *testing.T) { |
| 22 | p, ok := CuratedProviderPreset(tc.id) |
| 23 | if !ok || len(p.Entries) != 1 { |
| 24 | t.Fatal("missing preset") |
| 25 | } |
| 26 | e := p.Entries[0] |
| 27 | if e.Kind != tc.kind || e.BaseURL != tc.url || len(e.Models) == 0 || e.Default != e.Models[0] { |
| 28 | t.Fatal("invalid route") |
| 29 | } |
| 30 | if CatalogForProviderPreset(p).BrandID != tc.brand { |
| 31 | t.Fatal("brand split") |
| 32 | } |
| 33 | if e.WebSearch == nil || *e.WebSearch { |
| 34 | t.Fatal("search must not be enabled implicitly") |
| 35 | } |
| 36 | }) |
| 37 | } |
| 38 | } |
| 39 |