1- import { getApiProtocol , providerIdentifiers , type ProviderName } from "../index.js"
1+ import { getApiProtocol , providerIdentifiers } from "../index.js"
22
33describe ( "getApiProtocol" , ( ) => {
44 describe ( "Anthropic-style providers" , ( ) => {
@@ -15,21 +15,8 @@ describe("getApiProtocol", () => {
1515 } )
1616
1717 describe ( "Vertex provider with Claude models" , ( ) => {
18- it ( "uses the canonical Vertex identifier for Claude protocol selection" , ( ) => {
19- const identifiers = providerIdentifiers as Record < string , string >
20- const originalIdentifier = identifiers . vertex !
21-
22- try {
23- identifiers . vertex = "canonical-vertex"
24-
25- expect ( getApiProtocol ( identifiers . vertex as ProviderName , "claude-3-opus" ) ) . toBe ( "anthropic" )
26- } finally {
27- identifiers . vertex = originalIdentifier
28- }
29- } )
30-
3118 it ( "should return 'anthropic' for vertex provider with claude models" , ( ) => {
32- expect ( getApiProtocol ( " vertex" , "claude-3-opus" ) ) . toBe ( "anthropic" )
19+ expect ( getApiProtocol ( providerIdentifiers . vertex , "claude-3-opus" ) ) . toBe ( "anthropic" )
3320 expect ( getApiProtocol ( "vertex" , "Claude-3-Sonnet" ) ) . toBe ( "anthropic" )
3421 expect ( getApiProtocol ( "vertex" , "CLAUDE-instant" ) ) . toBe ( "anthropic" )
3522 expect ( getApiProtocol ( "vertex" , "anthropic/claude-3-haiku" ) ) . toBe ( "anthropic" )
@@ -48,24 +35,8 @@ describe("getApiProtocol", () => {
4835
4936 describe ( "Vercel AI Gateway provider" , ( ) => {
5037 it ( "uses canonical gateway identifiers for Anthropic model protocol selection" , ( ) => {
51- const identifiers = providerIdentifiers as Record < string , string >
52- const originalVercelIdentifier = identifiers . vercelAiGateway !
53- const originalZooIdentifier = identifiers . zooGateway !
54-
55- try {
56- identifiers . vercelAiGateway = "canonical-vercel-ai-gateway"
57- identifiers . zooGateway = "canonical-zoo-gateway"
58-
59- expect ( getApiProtocol ( identifiers . vercelAiGateway as ProviderName , "anthropic/claude-3-opus" ) ) . toBe (
60- "anthropic" ,
61- )
62- expect ( getApiProtocol ( identifiers . zooGateway as ProviderName , "anthropic/claude-3-opus" ) ) . toBe (
63- "anthropic" ,
64- )
65- } finally {
66- identifiers . vercelAiGateway = originalVercelIdentifier
67- identifiers . zooGateway = originalZooIdentifier
68- }
38+ expect ( getApiProtocol ( providerIdentifiers . vercelAiGateway , "anthropic/claude-3-opus" ) ) . toBe ( "anthropic" )
39+ expect ( getApiProtocol ( providerIdentifiers . zooGateway , "anthropic/claude-3-opus" ) ) . toBe ( "anthropic" )
6940 } )
7041
7142 it ( "should return 'anthropic' for vercel-ai-gateway provider with anthropic models" , ( ) => {
@@ -88,21 +59,8 @@ describe("getApiProtocol", () => {
8859 } )
8960
9061 describe ( "Opencode Go provider" , ( ) => {
91- it ( "uses the canonical OpenCode Go identifier for model-specific protocol selection" , ( ) => {
92- const identifiers = providerIdentifiers as Record < string , string >
93- const originalIdentifier = identifiers . opencodeGo !
94-
95- try {
96- identifiers . opencodeGo = "canonical-opencode-go"
97-
98- expect ( getApiProtocol ( identifiers . opencodeGo as ProviderName , "qwen3.7-max" ) ) . toBe ( "anthropic" )
99- } finally {
100- identifiers . opencodeGo = originalIdentifier
101- }
102- } )
103-
10462 it ( "should return 'anthropic' for opencode-go Anthropic-format models (Qwen/MiniMax)" , ( ) => {
105- expect ( getApiProtocol ( "opencode-go" , "qwen3.7-max" ) ) . toBe ( "anthropic" )
63+ expect ( getApiProtocol ( providerIdentifiers . opencodeGo , "qwen3.7-max" ) ) . toBe ( "anthropic" )
10664 expect ( getApiProtocol ( "opencode-go" , "qwen3.7-plus" ) ) . toBe ( "anthropic" )
10765 expect ( getApiProtocol ( "opencode-go" , "qwen3.6-plus" ) ) . toBe ( "anthropic" )
10866 expect ( getApiProtocol ( "opencode-go" , "minimax-m3" ) ) . toBe ( "anthropic" )
0 commit comments