| 1 | package config |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestOpenCodeGoVisionCatalogUsesTheEffectiveRequestURL(t *testing.T) { |
| 6 | r := NewTransientModelCapabilityResolver() |
| 7 | for _, kind := range []string{"openai", "anthropic", "responses"} { |
| 8 | endpoint := map[string]string{"openai": "chat/completions", "anthropic": "messages", "responses": "responses"}[kind] |
| 9 | e := ProviderEntry{Name: "opencode-go", Kind: kind, Model: "deepseek-v4-flash-vision-exp", BaseURL: "https://custom.example", RequestURL: "https://opencode.ai/zen/go/v1/" + endpoint} |
| 10 | if got := r.Resolve(&e); got.State != CapabilitySupported { |
| 11 | t.Fatalf("%s official full URL: %+v", kind, got) |
| 12 | } |
| 13 | e.BaseURL = "https://opencode.ai/zen/go/v1" |
| 14 | e.RequestURL = "https://custom.example/v1/" + endpoint |
| 15 | if got := r.Resolve(&e); got.State != CapabilityUnknown { |
| 16 | t.Fatalf("%s custom endpoint inherited official vision: %+v", kind, got) |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 |