@@ -277,6 +277,70 @@ func TestConvertRequestClaudeAdaptiveThinkingPreservesEffort(t *testing.T) {
277277 }
278278}
279279
280+ func TestGeminiThinkingLevelCaseInsensitiveAcrossPaths (t * testing.T ) {
281+ newRequest := func (level string ) * dto.GeminiChatRequest {
282+ return & dto.GeminiChatRequest {
283+ Contents : []dto.GeminiChatContent {{Role : "user" , Parts : []dto.GeminiPart {{Text : "hello" }}}},
284+ GenerationConfig : dto.GeminiChatGenerationConfig {
285+ ThinkingConfig : & dto.GeminiThinkingConfig {ThinkingLevel : level },
286+ },
287+ }
288+ }
289+
290+ t .Run ("native passthrough records canonical effort without rewriting wire value" , func (t * testing.T ) {
291+ info := & convmeta.Values {OriginModelName : "gemini-3.7-flash" , UpstreamModelName : "gemini-3.7-flash" }
292+ req := newRequest (" MEDIUM " )
293+ require .NoError (t , ApplyGeminiThinkingConfigChecked (req , info ))
294+ assert .Equal (t , "medium" , info .GetReasoningEffort ())
295+ assert .Equal (t , " MEDIUM " , req .GenerationConfig .ThinkingConfig .ThinkingLevel )
296+ })
297+
298+ t .Run ("native passthrough keeps unknown level as sent" , func (t * testing.T ) {
299+ info := & convmeta.Values {OriginModelName : "gemini-3.7-flash" , UpstreamModelName : "gemini-3.7-flash" }
300+ req := newRequest ("ULTRA" )
301+ require .NoError (t , ApplyGeminiThinkingConfigChecked (req , info ))
302+ assert .Equal (t , "ULTRA" , info .GetReasoningEffort ())
303+ })
304+
305+ t .Run ("suffix state validates uppercase level against normalized effort" , func (t * testing.T ) {
306+ info := & convmeta.Values {
307+ OriginModelName : "gemini-3.7-flash-thinking-medium" ,
308+ UpstreamModelName : "gemini-3.7-flash" ,
309+ ChannelMetaAttached : true ,
310+ ReasoningConversion : & dto.ReasoningConversionState {Mode : "enabled" , Effort : "medium" },
311+ }
312+ req := newRequest ("MEDIUM" )
313+ require .NoError (t , ApplyGeminiThinkingConfigChecked (req , info ))
314+ assert .Equal (t , "medium" , info .GetReasoningEffort ())
315+ assert .Equal (t , "MEDIUM" , req .GenerationConfig .ThinkingConfig .ThinkingLevel )
316+ })
317+
318+ t .Run ("gemini to openai conversion accepts uppercase level" , func (t * testing.T ) {
319+ info := & convmeta.Values {
320+ OriginModelName : "gemini-3.7-flash" ,
321+ UpstreamModelName : "gemini-3.7-flash" ,
322+ ConversionChain : []types.RelayFormat {types .RelayFormatGemini },
323+ }
324+ result , err := ConvertRequest (nil , info , types .RelayFormatOpenAI , newRequest ("MEDIUM" ))
325+ require .NoError (t , err )
326+ openaiReq , ok := result .Value .(* dto.GeneralOpenAIRequest )
327+ require .True (t , ok )
328+ assert .Equal (t , "medium" , openaiReq .ReasoningEffort )
329+ assert .Equal (t , "medium" , info .GetReasoningEffort ())
330+ })
331+
332+ t .Run ("gemini to openai conversion still rejects unsupported level" , func (t * testing.T ) {
333+ info := & convmeta.Values {
334+ OriginModelName : "gemini-3-pro-preview" ,
335+ UpstreamModelName : "gemini-3-pro-preview" ,
336+ ConversionChain : []types.RelayFormat {types .RelayFormatGemini },
337+ }
338+ _ , err := ConvertRequest (nil , info , types .RelayFormatOpenAI , newRequest ("MINIMAL" ))
339+ require .Error (t , err )
340+ assert .Contains (t , err .Error (), "not supported by model" )
341+ })
342+ }
343+
280344func TestConvertRequestViaExecutesExplicitPath (t * testing.T ) {
281345 info := & convmeta.Values {
282346 ConversionChain : []types.RelayFormat {types .RelayFormatOpenAI },
0 commit comments