diff --git a/internal/api/server_grok_models_test.go b/internal/api/server_grok_models_test.go index 5a133e8a70d..1fc3a417b87 100644 --- a/internal/api/server_grok_models_test.go +++ b/internal/api/server_grok_models_test.go @@ -17,7 +17,7 @@ func TestModelsDispatchByGrokShellUserAgent(t *testing.T) { modelRegistry := registry.GetGlobalRegistry() clientID := "test-grok-shell-model-list" modelRegistry.RegisterClient(clientID, "openai", []*registry.ModelInfo{ - {ID: "grok-shell-openai-model", DisplayName: "Grok Shell Model", ContextLength: 256000, Thinking: ®istry.ThinkingSupport{Levels: []string{"high"}}}, + {ID: "grok-shell-openai-model", DisplayName: "Grok Shell Model", ContextLength: 256000, Thinking: ®istry.ThinkingSupport{Levels: []string{"high", "xhigh"}}}, }) modelRegistry.RegisterClient(clientID+"-claude", "claude", []*registry.ModelInfo{ {ID: "grok-shell-claude-model", DisplayName: "Claude Catalog Model", ContextLength: 200000}, @@ -53,6 +53,7 @@ func TestModelsDispatchByGrokShellUserAgent(t *testing.T) { SupportedInAPI bool `json:"supported_in_api"` ReasoningEfforts []struct { Value string `json:"value"` + Label string `json:"label"` } `json:"reasoning_efforts"` } `json:"data"` } @@ -73,9 +74,12 @@ func TestModelsDispatchByGrokShellUserAgent(t *testing.T) { if model.APIBackend != "responses" || !model.SupportedInAPI { t.Fatalf("OpenAI model routing fields = %#v", model) } - if len(model.ReasoningEfforts) != 1 || model.ReasoningEfforts[0].Value != "high" { + if len(model.ReasoningEfforts) != 2 || model.ReasoningEfforts[0].Value != "high" || model.ReasoningEfforts[1].Value != "xhigh" { t.Fatalf("OpenAI reasoning efforts = %#v", model.ReasoningEfforts) } + if got := model.ReasoningEfforts[1].Label; got != "Extra High" { + t.Fatalf("xhigh label = %q, want Extra High", got) + } case "grok-shell-claude-model": foundClaude = true if model.Model != model.ID || model.Name != "Claude Catalog Model" || model.ContextWindow != 200000 { diff --git a/internal/client/grokbuild/grokbuild.go b/internal/client/grokbuild/grokbuild.go index 2622c1771bc..248c80714e1 100644 --- a/internal/client/grokbuild/grokbuild.go +++ b/internal/client/grokbuild/grokbuild.go @@ -13,6 +13,7 @@ type ModelInfo struct { // ReasoningEffort represents reasoning effort level in Grok Shell model entries. type ReasoningEffort struct { Value string `json:"value"` + Label string `json:"label,omitempty"` } // ModelEntry represents a single model entry formatted for Grok Shell. @@ -49,10 +50,15 @@ func BuildResponse(models []ModelInfo) Response { var efforts []ReasoningEffort for _, level := range m.ReasoningLevels { - trimmed := strings.TrimSpace(level) - if trimmed != "" { - efforts = append(efforts, ReasoningEffort{Value: trimmed}) + value := strings.TrimSpace(level) + if value == "" { + continue } + effort := ReasoningEffort{Value: value} + if value == "xhigh" { + effort.Label = "Extra High" + } + efforts = append(efforts, effort) } entry := ModelEntry{