From 659ee8ca69e2909cf4ce9865e5ecae08e6555ed1 Mon Sep 17 00:00:00 2001 From: Chenyme <118253778+chenyme@users.noreply.github.com> Date: Thu, 15 Oct 2026 13:44:11 +0800 Subject: [PATCH] refactor: enhance request retry configuration and auto-disable logic; update documentation and tests for clarity --- README.md | 2 +- README.zh-CN.md | 2 +- backend/internal/app/application.go | 5 +- backend/internal/app/quality_retry_test.go | 77 +++++++++++++++++++ .../application/gateway/quality_retry.go | 5 ++ .../application/gateway/quality_retry_test.go | 9 +++ .../application/gateway/service_test.go | 24 +++++- backend/internal/infra/config/config.go | 18 +++-- backend/internal/infra/config/config_test.go | 28 +++++++ config.example.yaml | 10 ++- frontend/src/shared/i18n/index.ts | 4 +- 11 files changed, 165 insertions(+), 19 deletions(-) create mode 100644 backend/internal/app/quality_retry_test.go diff --git a/README.md b/README.md index 0d1cfbca..fe174a9f 100644 --- a/README.md +++ b/README.md @@ -413,7 +413,7 @@ qualityGuard: idleAccountCooldown: 15m ``` -`requestRetry` runs on the gateway request path and is independent of the sidecar. The example enables it. When enabled, a thinking-model stream with enough visible output and no streamed reasoning is **not delivered**; another account is tried. `autoDisable: true` disables an account on the first confirmed missing-thinking or degraded output-speed hit (soft-TPS, hard-TPS, or buffered-burst). If every attempt still has no reasoning, `onExhausted` either returns `503 quality_degraded` or delivers the last body. Image, video, stored-response, and ForcedEgress probe requests are unchanged. Grok TUI tool turns stay held so 0-thinking dumps cannot skip the gate. +`requestRetry` runs on the gateway request path and is independent of the sidecar. The example above explicitly enables it; built-in defaults and `config.example.yaml` leave both `enabled` and `autoDisable` off. Either switch enables request-path quality checks and retries. A thinking-model stream with enough visible output and no streamed reasoning is **not delivered**; another account is tried. `autoDisable: true` disables an account on the first confirmed missing-thinking or degraded output-speed hit (soft-TPS, hard-TPS, or buffered-burst). The Account Maintenance switch controls `autoDisable`; turning it off restores the YAML `requestRetry.enabled` policy. If every attempt still has no reasoning, `onExhausted` either returns `503 quality_degraded` or delivers the last body. Context compaction is exempt from both missing-thinking and output-speed account penalties. Image, video, stored-response, and ForcedEgress probe requests are unchanged. Grok TUI tool turns stay held so 0-thinking dumps cannot skip the gate. ```bash docker compose --profile quality-guard up -d --build diff --git a/README.zh-CN.md b/README.zh-CN.md index 86752ac1..05ab9133 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -379,7 +379,7 @@ qualityGuard: idleAccountCooldown: 15m ``` -`requestRetry` 在网关请求路径上生效,与 sidecar 探测/隔离相互独立。示例配置默认开启。开启后,可见输出达到 `minOutputTokens` 且全程无流式 reasoning 时**不发给用户**,排除该账号再试;`autoDisable: true` 会在首次确认缺 thinking 或吞吐降智(soft/hard/burst)时直接禁用账号。全部仍无推理则按 `onExhausted` 返回 `503 quality_degraded` 或放出最后一枪。不处理图/视频、stored response 钉账号和 ForcedEgress 探针。Grok TUI 带 tools 的回合仍会 hold,避免 0-thinking 降智流跳过闸门。 +`requestRetry` 在网关请求路径上生效,与 sidecar 探测/隔离相互独立。上面的示例显式开启;内置默认值和 `config.example.yaml` 均将 `enabled`、`autoDisable` 设为关闭。任一开关开启后都会启用请求内质量检测与重试。可见输出达到 `minOutputTokens` 且全程无流式 reasoning 时**不发给用户**,排除该账号再试;`autoDisable: true` 会在首次确认缺 thinking 或吞吐降智(soft/hard/burst)时直接禁用账号。管理页面的“自动停用降智账号”控制 `autoDisable`,关闭后恢复 YAML 中 `requestRetry.enabled` 的原有策略。全部仍无推理则按 `onExhausted` 返回 `503 quality_degraded` 或放出最后一枪。上下文压缩同时豁免缺 thinking 和输出速度的账号惩罚。不处理图/视频、stored response 钉账号和 ForcedEgress 探针。Grok TUI 带 tools 的回合仍会 hold,避免 0-thinking 降智流跳过闸门。 ```bash docker compose --profile quality-guard up -d --build diff --git a/backend/internal/app/application.go b/backend/internal/app/application.go index ad9b77f3..52dcb8e4 100644 --- a/backend/internal/app/application.go +++ b/backend/internal/app/application.go @@ -493,7 +493,10 @@ func accountAutoCleanConfig(value config.AccountsConfig) accountapp.AutoCleanCon func qualityRetryRuntime(value config.QualityGuardConfig) gateway.QualityRetryRuntime { retry := value.RequestRetry return gateway.QualityRetryRuntime{ - Enabled: retry.Enabled, + // Auto-disable needs request-path detection even when the YAML retry + // switch is off. Derive this at runtime so turning auto-disable off + // restores the original policy without persisting a second switch. + Enabled: retry.Enabled || retry.AutoDisable, MaxAttempts: retry.MaxAttempts, HoldTimeout: retry.HoldTimeout.Value(), MinOutputTokens: int64(retry.MinOutputTokens), diff --git a/backend/internal/app/quality_retry_test.go b/backend/internal/app/quality_retry_test.go new file mode 100644 index 00000000..b5c7417f --- /dev/null +++ b/backend/internal/app/quality_retry_test.go @@ -0,0 +1,77 @@ +package app + +import ( + "context" + "fmt" + "os" + "path/filepath" + "testing" + "time" + + "github.com/chenyme/grok2api/backend/internal/application/gateway" + settingsapp "github.com/chenyme/grok2api/backend/internal/application/settings" + "github.com/chenyme/grok2api/backend/internal/infra/config" + "github.com/chenyme/grok2api/backend/internal/infra/persistence/relational" + "github.com/chenyme/grok2api/backend/internal/infra/security" +) + +func TestDegradedAccountSwitchAppliesAndRestoresRequestRetryPolicy(t *testing.T) { + for _, retryEnabled := range []bool{false, true} { + t.Run(fmt.Sprintf("yaml_retry_%t", retryEnabled), func(t *testing.T) { + ctx := context.Background() + path := filepath.Join(t.TempDir(), "config.yaml") + if err := os.WriteFile(path, []byte(`secrets: + jwtSecret: "12345678901234567890123456789012" + credentialEncryptionKey: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" +`), 0o600); err != nil { + t.Fatal(err) + } + cfg, err := config.Load(path) + if err != nil { + t.Fatal(err) + } + cfg.QualityGuard.RequestRetry.Enabled = retryEnabled + db, err := relational.OpenSQLite(ctx, filepath.Join(t.TempDir(), "settings.db")) + if err != nil { + t.Fatal(err) + } + defer db.Close() + if err := db.InitializeSchema(ctx); err != nil { + t.Fatal(err) + } + cipher, err := security.NewCipher(cfg.Secrets.CredentialEncryptionKey) + if err != nil { + t.Fatal(err) + } + repo := relational.NewRuntimeSettingsRepository(db, cipher) + var applied gateway.QualityRetryRuntime + service := settingsapp.NewService(cfg, time.Time{}, 0, repo, nil, func(next config.Config) { + applied = qualityRetryRuntime(next.QualityGuard) + if next.QualityGuard.RequestRetry.Enabled != retryEnabled { + t.Fatal("management switch changed the YAML retry policy") + } + }) + for _, autoDisable := range []bool{true, false} { + snapshot := service.Get() + input := snapshot.Config + input.Accounts.AutoDisableDegradedAccounts = autoDisable + input.Accounts.AutoDisableDegradedAccountsProvided = true + if _, err := service.Update(ctx, snapshot.Revision, input); err != nil { + t.Fatal(err) + } + wantEnabled := retryEnabled || autoDisable + if applied.Enabled != wantEnabled || applied.AutoDisable != autoDisable { + t.Fatalf("hot reload: autoDisable=%t runtime=%#v", autoDisable, applied) + } + reloaded, _, _, err := settingsapp.LoadPersisted(ctx, cfg, repo) + if err != nil { + t.Fatal(err) + } + runtime := qualityRetryRuntime(reloaded.QualityGuard) + if runtime.Enabled != wantEnabled || runtime.AutoDisable != autoDisable || reloaded.QualityGuard.RequestRetry.Enabled != retryEnabled { + t.Fatalf("restart: autoDisable=%t runtime=%#v", autoDisable, runtime) + } + } + }) + } +} diff --git a/backend/internal/application/gateway/quality_retry.go b/backend/internal/application/gateway/quality_retry.go index 4b9872fc..9eadd316 100644 --- a/backend/internal/application/gateway/quality_retry.go +++ b/backend/internal/application/gateway/quality_retry.go @@ -596,6 +596,11 @@ func (s *Service) applyMissingThinkingPenalty(ctx context.Context, requestID str } func (s *Service) applyOutputSpeedPenalty(ctx context.Context, record audit.Record, credential accountdomain.Credential, cfg QualityRetryRuntime, forcedEgress bool) error { + // Both explicit and TUI compaction are classified in the audit record. + // System summaries stay exempt from account quality penalties. + if record.Operation == audit.OperationCompaction { + return nil + } if !cfg.Enabled || !cfg.AutoDisable || forcedEgress || credential.Provider != accountdomain.ProviderBuild || !record.Streaming || record.FirstTokenMS == nil || record.OutputTokens < cfg.MinOutputTokens || !auditRequestSucceeded(record.StatusCode, record.ErrorCode) { return nil } diff --git a/backend/internal/application/gateway/quality_retry_test.go b/backend/internal/application/gateway/quality_retry_test.go index 593a1233..611b7f10 100644 --- a/backend/internal/application/gateway/quality_retry_test.go +++ b/backend/internal/application/gateway/quality_retry_test.go @@ -255,6 +255,15 @@ func TestAutoDisableFirstOutputSpeedHit(t *testing.T) { t.Fatalf("below-threshold hit must remain scheduled: %#v, err=%v", healthy, err) } record.DurationMS = 1_200 + record.Operation = audit.OperationCompaction + if err := service.applyOutputSpeedPenalty(ctx, record, credential, cfg, false); err != nil { + t.Fatal(err) + } + compacted, err := accounts.Get(ctx, credential.ID) + if err != nil || !compacted.Enabled { + t.Fatalf("compaction must remain exempt from speed penalties: %#v, err=%v", compacted, err) + } + record.Operation = audit.OperationResponses if err := service.applyOutputSpeedPenalty(ctx, record, credential, cfg, false); err != nil { t.Fatal(err) } diff --git a/backend/internal/application/gateway/service_test.go b/backend/internal/application/gateway/service_test.go index 0fd0e8c9..28c4044f 100644 --- a/backend/internal/application/gateway/service_test.go +++ b/backend/internal/application/gateway/service_test.go @@ -253,6 +253,9 @@ func TestGatewayFailsOverBeforeReturningBody(t *testing.T) { t.Fatalf("ownership = %#v, err = %v", ownership, err) } + service.UpdateQualityRetry(QualityRetryRuntime{ + Enabled: true, AutoDisable: true, MinOutputTokens: 32, SoftTPS: 1, HardTPS: 2, + }) compacted, err := service.CreateResponse(ctx, Input{ RequestID: "req-compact", ClientKey: clientKey, PublicModel: "grok-test", PromptCacheSeed: "claude-session", Body: []byte(`{"model":"grok-test","stream":true,"input":[{"role":"user","content":"continue"},{"type":"compaction_trigger"}]}`), Streaming: true, @@ -265,12 +268,25 @@ func TestGatewayFailsOverBeforeReturningBody(t *testing.T) { t.Fatal("first token marker is nil") } compacted.MarkFirstToken() - compacted.Finalize(Usage{}, "resp-compact", "") + time.Sleep(2 * time.Millisecond) + compacted.Finalize(Usage{Reported: true, OutputTokens: 120}, "resp-compact", "") _ = compacted.Body.Close() logs, total, err = auditRepo.List(ctx, 0, 10) if err != nil || total != 2 || logs[0].Operation != audit.OperationCompaction || !logs[0].Streaming || logs[0].FirstTokenMS == nil { t.Fatalf("compaction audit = %#v, total=%d, err=%v", logs, total, err) } + assertCompactionSpeedExempt := func(record audit.Record) { + t.Helper() + class, _, _ := audit.ClassifyOutputSpeed(record.OutputTokens, record.ReasoningTokens, *record.FirstTokenMS, record.DurationMS, 1, 2, 1000, false) + if class == "" { + t.Fatal("compaction fixture must exceed the speed threshold") + } + credential, err := accountRepo.Get(ctx, second.ID) + if err != nil || !credential.Enabled { + t.Fatalf("compaction must not disable its account: %#v, err=%v", credential, err) + } + } + assertCompactionSpeedExempt(logs[0]) if _, err := responseRepo.Get(ctx, "resp-compact", clientKey.ID, time.Now().UTC()); !errors.Is(err, repository.ErrNotFound) { t.Fatalf("compaction response ownership err = %v", err) } @@ -279,7 +295,7 @@ func TestGatewayFailsOverBeforeReturningBody(t *testing.T) { // the quality hold and is labeled compaction only in the audit record, so // Provider routing and stored-response ownership must remain intact. service.UpdateQualityRetry(QualityRetryRuntime{ - Enabled: true, MaxAttempts: 2, MinOutputTokens: 32, + Enabled: true, AutoDisable: true, MaxAttempts: 2, MinOutputTokens: 32, SoftTPS: 1, HardTPS: 2, OnExhausted: qualityRetryFailClosed, HoldTimeout: time.Second, }) adapter.resetAttempts() @@ -298,7 +314,8 @@ func TestGatewayFailsOverBeforeReturningBody(t *testing.T) { t.Fatalf("TUI compaction body = %q", tuiBody) } tuiCompacted.MarkFirstToken() - tuiCompacted.Finalize(Usage{}, "resp-tui-compact", "") + time.Sleep(2 * time.Millisecond) + tuiCompacted.Finalize(Usage{Reported: true, OutputTokens: 120}, "resp-tui-compact", "") _ = tuiCompacted.Body.Close() if len(adapter.attempts) != 1 || adapter.lastOperation != string(audit.OperationResponses) { t.Fatalf("TUI compaction attempts = %#v, Provider operation = %q", adapter.attempts, adapter.lastOperation) @@ -307,6 +324,7 @@ func TestGatewayFailsOverBeforeReturningBody(t *testing.T) { if err != nil || total != 3 || logs[0].Operation != audit.OperationCompaction { t.Fatalf("TUI compaction audit = %#v, total=%d, err=%v", logs, total, err) } + assertCompactionSpeedExempt(logs[0]) if ownership, err := responseRepo.Get(ctx, "resp-tui-compact", clientKey.ID, time.Now().UTC()); err != nil || ownership.AccountID != second.ID { t.Fatalf("TUI compaction ownership = %#v, err=%v", ownership, err) } diff --git a/backend/internal/infra/config/config.go b/backend/internal/infra/config/config.go index eeea5d42..d8212bcf 100644 --- a/backend/internal/infra/config/config.go +++ b/backend/internal/infra/config/config.go @@ -295,6 +295,7 @@ type QualityGuardRequestRetryConfig struct { HoldTimeout Duration `yaml:"holdTimeout"` MinOutputTokens int `yaml:"minOutputTokens"` OnExhausted string `yaml:"onExhausted"` + // AutoDisable also enables request-path detection without changing Enabled. AutoDisable bool `yaml:"autoDisable"` AccountCooldown Duration `yaml:"accountCooldown"` // IdleAccountCooldown cools an account after a truly empty upstream @@ -741,6 +742,15 @@ func validateQualityGuardConfig(value QualityGuardConfig) error { if err := validateQualityGuardRequestRetry(value.RequestRetry); err != nil { return err } + // Automatic account disabling uses these thresholds without the sidecar. + if value.Enabled || value.RequestRetry.AutoDisable { + if value.SoftTPS < 1 || value.HardTPS <= value.SoftTPS || value.HardTPS > 10000 { + return errors.New("qualityGuard TPS 阈值无效") + } + if value.MinimumGenerationWindow.Value() < time.Millisecond || value.MinimumGenerationWindow.Value() > 2*time.Minute { + return errors.New("qualityGuard.minimumGenerationWindow 必须在 1 毫秒到 2 分钟之间") + } + } if !value.Enabled { return nil } @@ -759,9 +769,6 @@ func validateQualityGuardConfig(value QualityGuardConfig) error { if value.PassivePollInterval.Value() < time.Second || value.PassivePollInterval.Value() > 5*time.Minute { return errors.New("qualityGuard.passivePollInterval 必须在 1 秒到 5 分钟之间") } - if value.SoftTPS < 1 || value.HardTPS <= value.SoftTPS || value.HardTPS > 10000 { - return errors.New("qualityGuard TPS 阈值无效") - } if value.ConsecutiveSoft < 1 || value.ConsecutiveSoft > 20 || value.ConsecutiveErrors < 1 || value.ConsecutiveErrors > 20 { return errors.New("qualityGuard 连续异常次数必须在 1 到 20 之间") } @@ -774,9 +781,6 @@ func validateQualityGuardConfig(value QualityGuardConfig) error { if value.MaxOutputTokens < 32 || value.MaxOutputTokens > 4096 { return errors.New("qualityGuard.maxOutputTokens 必须在 32 到 4096 之间") } - if value.MinimumGenerationWindow.Value() < time.Millisecond || value.MinimumGenerationWindow.Value() > 2*time.Minute { - return errors.New("qualityGuard.minimumGenerationWindow 必须在 1 毫秒到 2 分钟之间") - } if value.RotationTimeout.Value() < 5*time.Second || value.RotationTimeout.Value() > 5*time.Minute { return errors.New("qualityGuard.rotationTimeout 必须在 5 秒到 5 分钟之间") } @@ -793,7 +797,7 @@ func validateQualityGuardConfig(value QualityGuardConfig) error { } func validateQualityGuardRequestRetry(value QualityGuardRequestRetryConfig) error { - if !value.Enabled { + if !value.Enabled && !value.AutoDisable { return nil } if value.MaxAttempts != 0 && (value.MaxAttempts < 1 || value.MaxAttempts > 6) { diff --git a/backend/internal/infra/config/config_test.go b/backend/internal/infra/config/config_test.go index 78c6dc13..a14b9b99 100644 --- a/backend/internal/infra/config/config_test.go +++ b/backend/internal/infra/config/config_test.go @@ -231,6 +231,34 @@ func TestDefaultQualityGuardRequestRetryContract(t *testing.T) { } } +func TestAutoDisableValidatesRequestPolicyWithoutSidecar(t *testing.T) { + t.Parallel() + base := defaultConfig().QualityGuard + base.RequestRetry.AutoDisable = true + if err := validateQualityGuardConfig(base); err != nil { + t.Fatalf("auto-disable with default policy: %v", err) + } + for _, test := range []struct { + name string + change func(*QualityGuardConfig) + }{ + {"retry limit", func(c *QualityGuardConfig) { c.RequestRetry.MaxAttempts = 7 }}, + {"hold timeout", func(c *QualityGuardConfig) { c.RequestRetry.HoldTimeout = Duration(time.Minute) }}, + {"output floor", func(c *QualityGuardConfig) { c.RequestRetry.MinOutputTokens = 1 }}, + {"soft TPS", func(c *QualityGuardConfig) { c.SoftTPS = 0 }}, + {"hard TPS", func(c *QualityGuardConfig) { c.HardTPS = c.SoftTPS }}, + {"generation window", func(c *QualityGuardConfig) { c.MinimumGenerationWindow = 0 }}, + } { + t.Run(test.name, func(t *testing.T) { + cfg := base + test.change(&cfg) + if err := validateQualityGuardConfig(cfg); err == nil { + t.Fatal("invalid active request-path policy must be rejected even when the sidecar is disabled") + } + }) + } +} + func TestQualityGuardRequestRetryAccountCooldownBounds(t *testing.T) { t.Parallel() for _, test := range []struct { diff --git a/config.example.yaml b/config.example.yaml index e46d1177..72c2afd5 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -150,8 +150,8 @@ qualityGuard: nodeIDs: [] rotatableNodeIDs: [] # Optional request-path withhold/retry for thinking models. - # Recommended lab values are filled in; enabled stays false so stock - # installs do not intercept. Set enabled: true to turn the hold on. + # Recommended lab values are filled in; enabled and autoDisable stay false + # so stock installs do not intercept. Either switch enables detection. # Observe up to 30s for real reasoning evidence. A reasoning-item stub plus # enough visible output at the deadline is withheld (TUI dump after 30s), # not released as late ciphertext. Empty stub-only streams keep waiting. @@ -172,8 +172,10 @@ qualityGuard: onExhausted: fail_closed # fail_open | fail_closed # Immediately disable an account on its first confirmed missing-thinking # or degraded output-speed hit (soft-TPS, hard-TPS, or buffered-burst). - # When false, missing-thinking keeps the historical cooldown/second-hit policy. - autoDisable: true + # Also enables request-path detection independently of enabled above. + # When false, enabled controls the historical cooldown/second-hit policy. + # Context compaction and forced egress probes remain exempt. + autoDisable: false accountCooldown: 12h # Empty SSE / idle-timeout penalty. Independent of accountCooldown. # Single-account pools should set this lower; toggling enabled does not diff --git a/frontend/src/shared/i18n/index.ts b/frontend/src/shared/i18n/index.ts index d14b6cfe..c7e87276 100644 --- a/frontend/src/shared/i18n/index.ts +++ b/frontend/src/shared/i18n/index.ts @@ -1045,7 +1045,7 @@ const resources = { title: "账号维护", degradedAccountTitle: "降智账号处理", autoDisableDegradedAccounts: "自动停用降智账号", - autoDisableDegradedAccountsHelp: "开启后,首次确认缺少 thinking 或吞吐降智时立即停用账号;关闭后不因吞吐降智停用,缺少 thinking 则恢复为首次冷却、再次确认后停用。", + autoDisableDegradedAccountsHelp: "开启后启用请求内质量检测与重试,首次确认缺少 thinking 或吞吐降智时立即停用账号;关闭后不因吞吐降智停用,缺少 thinking 的拦截与冷却按原有配置执行。", invalidationTitle: "自动拦截判定", botRiskSchedulingTitle: "风控调度", excludeBuildBotFlaggedFromScheduling: "风控 Build 号移出调度", @@ -1818,7 +1818,7 @@ const resources = { errorFrameCount_one: "{{count}} error frame", errorFrameCount_other: "{{count}} error frames", }, - settings: { title: "Runtime settings", description: "Manage hot-reloadable gateway runtime parameters.", saved: "Settings saved and applied", restartRequired: "Restart required", invalidValue: "Enter a valid value", durationUnit: "Duration unit", groups: { providers: "Providers", delivery: "Media & network", policies: "Runtime policies", audit: "Audit & Logs", accounts: "Account maintenance", about: "About" }, server: { title: "Service capacity", maxConcurrentRequests: "API request concurrency limit", maxConcurrentRequestsHelp: "Maximum simultaneous /v1 requests per instance. Lowering the limit does not interrupt active requests." }, provider: { title: "Grok Build provider", baseURL: "Upstream URL", baseURLHelp: "Primary upstream endpoint used for Grok Build requests.", fallbackBaseURL: "XAI fallback URL", fallbackBaseURLHelp: "Endpoint used when routing to XAI or falling back from Grok Build.", clientVersion: "Client version", clientVersionHelp: "Version sent with Build requests. Use a version that has passed compatibility validation.", clientIdentifier: "Client identifier", clientIdentifierHelp: "Client identity sent with requests; keep it aligned with the upstream protocol.", tokenAuth: "Token auth", tokenAuthHelp: "Client protocol identifier sent with Grok Build requests; normally keep xai-grok-cli.", userAgent: "User-Agent", userAgentHelp: "Used by Grok Build inference requests and their egress nodes. Direct XAI media requests derive the official xai-grok-build User-Agent from the client version.", recommendedVersion: "Recommended {{version}}", syncRecommendedVersion: "Sync latest version", recommendedVersionApplied: "Recommended version active", syncRecommendedVersionDescription: "Fill the form with the validated version and User-Agent; save to apply." }, web: { title: "Grok Web", baseURL: "Upstream URL", baseURLHelp: "Base endpoint used for Grok Web API calls and account operations.", statsigMode: "x-statsig source", statsigModeHelp: "Use a fixed value or retrieve request identity dynamically from a signer service.", statsigManual: "Manual", statsigURL: "Fetch from URL", statsigValue: "x-statsig-id", statsigValueHelp: "Fixed x-statsig-id attached to Grok Web requests.", statsigConfigured: "Configured", statsigKeepConfigured: "Leave blank to keep the current value", statsigValuePlaceholder: "Paste x-statsig-id", statsigSignerURL: "Signer URL", statsigSignerURLHelp: "Internal signer endpoint used to retrieve x-statsig-id per request.", quotaTimeout: "Quota timeout", quotaTimeoutHelp: "Maximum time to wait for upstream quota and account-status queries.", chatTimeout: "Chat timeout", chatTimeoutHelp: "Maximum time to wait for a Grok Web chat request to complete.", streamIdleTimeout: "Stream idle timeout", streamIdleTimeoutHelp: "Maximum period without upstream data for raw text-chat streams; image, video, and other media requests are unaffected.", imageTimeout: "Image timeout", imageTimeoutHelp: "Maximum time to wait for image generation or editing to complete.", videoTimeout: "Video timeout", videoTimeoutHelp: "Maximum time to wait for a Grok Web video generation request to complete.", freeVideoDurationCap: "Free-account video duration cap", freeVideoDurationCapHelp: "Caps duration sent to Grok Web for free-tier accounts so requests over the upstream limit do not 429 and rotate accounts uselessly. Default 6 seconds, range 1–15.", mediaConcurrency: "Media job concurrency", mediaConcurrencyHelp: "Image and video jobs one instance may run concurrently. Changes require a restart.", recoveryBackoffBase: "Quota recovery backoff", recoveryBackoffBaseHelp: "Initial retry interval after consecutive quota-recovery check failures.", recoveryBackoffMax: "Maximum recovery backoff", recoveryBackoffMaxHelp: "Maximum interval reached by exponential backoff for quota-recovery checks.", allowNSFW: "Allow NSFW images", allowNSFWHelp: "Allow Grok Web image requests to enable the adult-content preference.", clearanceMode: "Clearance management", clearanceModeHelp: "Maintain Cloudflare credentials manually or let FlareSolverr acquire and refresh them on the actual egress.", clearanceManual: "Manual", clearanceFlareSolverr: "FlareSolverr", flareSolverrURL: "FlareSolverr URL", flareSolverrURLHelp: "Internal FlareSolverr endpoint used to solve Cloudflare Clearance.", clearanceTimeout: "Solve timeout", clearanceTimeoutHelp: "Maximum time allowed for one FlareSolverr solve.", clearanceRefresh: "Refresh interval", clearanceRefreshHelp: "Periodic refresh interval for fixed egress; account-bound proxies are maintained independently during requests." }, console: { baseURLHelp: "Base endpoint used for Grok Console requests and account operations.", chatTimeoutHelp: "Maximum time to wait for a Grok Console chat request to complete.", streamIdleTimeout: "Stream idle timeout", streamIdleTimeoutHelp: "Maximum period without upstream data for text SSE only; media and non-streaming requests are unaffected." }, batch: { title: "Batch tasks", importConcurrency: "Import sync concurrency", importConcurrencyHelp: "Accounts initialized and synchronized concurrently after a batch import.", conversionConcurrency: "Account conversion concurrency", conversionConcurrencyHelp: "Cross-provider account conversions that may run concurrently.", syncConcurrency: "Data sync concurrency", syncConcurrencyHelp: "Quota, status, and capability synchronizations that may run concurrently.", refreshConcurrency: "Credential refresh concurrency", refreshConcurrencyHelp: "Account credential refreshes that may run concurrently.", randomDelay: "Maximum random delay (ms)", randomDelayHelp: "Maximum randomized delay before batch work starts to smooth upstream request bursts." }, media: { title: "Media storage", maxImageSize: "Maximum image size", maxImageSizeHelp: "Largest individual image that may be written to local media storage.", maxTotalSize: "Media storage limit", maxTotalSizeHelp: "Total local storage available to image and video files.", cleanupThresholdPercent: "Automatic cleanup threshold", cleanupThresholdPercentHelp: "Storage utilization that triggers removal of older media files.", cleanupInterval: "Capacity check interval", cleanupIntervalHelp: "Interval between background storage checks and cleanup evaluation.", sizeUnit: "Storage unit", publicApiBaseURL: "Public API base URL", publicApiBaseURLHelp: "Used for public image URLs and docs examples. Leave empty to use the service startup value, which defaults to http://127.0.0.1:8000." }, egress: { title: "Egress proxies", description: "Nodes manage proxy and health independently for Grok Build, Grok Web, Grok Console, or Web assets. Build inherits the Provider User-Agent; Web and Console nodes manage their own browser User-Agent and cookies. Proxy URLs and Cloudflare cookies are write-only.", add: "Add node", saved: "Proxy node saved", deleted: "Proxy node deleted", name: "Name", scope: "Scope", proxy: "Proxy", clearance: "Clearance", health: "Health", directFallback: "Direct connection is used when no node is configured", scopeBuild: "Grok Build", scopeWeb: "Grok Web", scopeWebAsset: "Grok Web (assets only)", configured: "Configured", direct: "Direct", none: "None", editTitle: "Edit proxy node", addTitle: "Add proxy node", dialogDescription: "Build nodes only configure the proxy and inherit the Provider User-Agent; Web and Console nodes use their own browser User-Agent and Cloudflare cookies.", enabled: "Enabled", proxyURL: "Proxy URL", proxyProtocols: "Supports HTTP, HTTPS, SOCKS4, SOCKS4A, SOCKS5, and SOCKS5H.\nResin users can put {account} in the username to bind one lease per account.", proxyPool: "Proxy pool mode", proxyPoolHelp: "A request-level connection failure does not cool the entire shared node. Proxies containing {account} use this policy automatically.", userAgent: "User-Agent", cloudflareCookie: "Cloudflare Cookie", keepConfigured: "Configured; leave blank to keep unchanged", operationFailed: "Operation failed", refreshClearance: "Refresh Clearance", clearanceRefreshed: "Clearance refreshed", clearanceManaged: "Cloudflare cookies and User-Agent are managed by FlareSolverr; account-bound proxies are isolated per account." }, routing: { title: "Routing policy", stickyTTL: "Sticky session TTL", stickyTTLHelp: "How long a session prefers its selected account before returning to normal scheduling.", cooldownBase: "Base cooldown", cooldownBaseHelp: "Initial cooldown applied after a recoverable account failure.", cooldownMax: "Maximum cooldown", cooldownMaxHelp: "Longest cooldown allowed when repeated failures trigger exponential backoff.", capacityWait: "Saturated account wait", capacityWaitHelp: "How long to wait for capacity before switching accounts or failing when all candidates are saturated.", maxAttempts: "Maximum attempts", maxAttemptsHelp: "Maximum account switches and retries allowed for one request, from 1 to 200.", videoMaxAttempts: "Video maximum attempts", videoMaxAttemptsHelp: "Create-phase account failover for video jobs only. Set a number or enable unlimited. Polling after create stays on the same account.", preferFreeBuild: "Prefer Grok Build Free accounts", preferFreeBuildHelp: "Prefer confirmed usable Free accounts without changing other routing eligibility rules.", accountIsolatedConnections: "Isolate upstream connections by account", accountIsolatedConnectionsHelp: "When enabled, each account uses its own upstream TCP/HTTP connection pool so external L4 or connection-hash load balancers can spread traffic; the same account still reuses connections. Applies to Build, Web, Console, and Web-to-Build traffic. This increases connections, TLS handshakes, memory, and file-descriptor usage, so enable it only when connection-level balancing is required." }, audit: { title: "Request Audit & Logs", tabTitle: "Audit & Logs", retentionTitle: "Log Retention Policy", retentionDays: "Log retention days", retentionDaysHelp: "Automatically purges request audits and failure attempts older than the specified days. Set to 0 for indefinite retention, default is 7 days.", performanceTitle: "Buffer & Performance", bufferSize: "Queue capacity", bufferSizeHelp: "Maximum audit records held in memory before persistence.", batchSize: "Batch size", batchSizeHelp: "Maximum audit records written in one database transaction.", flushInterval: "Flush interval", flushIntervalHelp: "Maximum time pending audit records wait before they are committed.", commitDelay: "Commit aggregation delay (ms)", commitDelayHelp: "Maximum time acknowledged writes wait to join an atomic batch before commit." }, clientKeys: { title: "Client key defaults", rpmLimit: "Default RPM", rpmLimitHelp: "Requests per minute assigned to newly created client keys.", maxConcurrent: "Default concurrency", maxConcurrentHelp: "Concurrent requests assigned to newly created client keys." }, accounts: { title: "Account maintenance", degradedAccountTitle: "Degraded-account handling", autoDisableDegradedAccounts: "Automatically disable degraded accounts", autoDisableDegradedAccountsHelp: "When enabled, the first confirmed missing-thinking or degraded-throughput hit disables the account immediately. When disabled, throughput hits do not disable accounts, while missing-thinking falls back to cooling the first hit and disabling after a later confirmation.", invalidationTitle: "Automatic interception", botRiskSchedulingTitle: "Bot-risk scheduling", excludeBuildBotFlaggedFromScheduling: "Exclude bot-risk Build accounts from scheduling", excludeBuildBotFlaggedFromSchedulingHelp: "When enabled, Grok Build accounts whose JWT bot_flag_source/bfs is 1 or 2 are removed from Build scheduling only. Linked Web/Console accounts keep their normal scheduling. Accounts remain in the pool for viewing and manual actions.", cleanupTitle: "Account cleanup", autoCleanReauthEnabled: "Automatic invalid-account cleanup", autoCleanReauthEnabledHelp: "Permanently deletes invalid accounts after the configured retention period. Accounts with active requests or video jobs are skipped.", autoCleanReauthInterval: "Cleanup interval", autoCleanReauthIntervalHelp: "How often to check for eligible accounts, from 1 minute to 1 hour.", autoCleanReauthMinAge: "Minimum retention", autoCleanReauthMinAgeHelp: "How long to retain an account after it is marked for reauthorization.", autoCleanIncludeDisabled: "Include disabled accounts", autoCleanIncludeDisabledHelp: "Includes disabled accounts that require reauthorization in automatic cleanup.", autoCleanEnableTitle: "Enable automatic cleanup?", autoCleanEnableDescription: "Eligible accounts will be permanently deleted and cannot be recovered. The first run starts after one full cleanup interval.", autoCleanIncludeDisabledTitle: "Include disabled accounts?", autoCleanIncludeDisabledDescription: "Disabled accounts that require reauthorization will also be permanently deleted. This action cannot be undone.", autoCleanConfirm: "Enable" }, units: { seconds: "Seconds", minutes: "Minutes", hours: "Hours", days: "Days" } }, + settings: { title: "Runtime settings", description: "Manage hot-reloadable gateway runtime parameters.", saved: "Settings saved and applied", restartRequired: "Restart required", invalidValue: "Enter a valid value", durationUnit: "Duration unit", groups: { providers: "Providers", delivery: "Media & network", policies: "Runtime policies", audit: "Audit & Logs", accounts: "Account maintenance", about: "About" }, server: { title: "Service capacity", maxConcurrentRequests: "API request concurrency limit", maxConcurrentRequestsHelp: "Maximum simultaneous /v1 requests per instance. Lowering the limit does not interrupt active requests." }, provider: { title: "Grok Build provider", baseURL: "Upstream URL", baseURLHelp: "Primary upstream endpoint used for Grok Build requests.", fallbackBaseURL: "XAI fallback URL", fallbackBaseURLHelp: "Endpoint used when routing to XAI or falling back from Grok Build.", clientVersion: "Client version", clientVersionHelp: "Version sent with Build requests. Use a version that has passed compatibility validation.", clientIdentifier: "Client identifier", clientIdentifierHelp: "Client identity sent with requests; keep it aligned with the upstream protocol.", tokenAuth: "Token auth", tokenAuthHelp: "Client protocol identifier sent with Grok Build requests; normally keep xai-grok-cli.", userAgent: "User-Agent", userAgentHelp: "Used by Grok Build inference requests and their egress nodes. Direct XAI media requests derive the official xai-grok-build User-Agent from the client version.", recommendedVersion: "Recommended {{version}}", syncRecommendedVersion: "Sync latest version", recommendedVersionApplied: "Recommended version active", syncRecommendedVersionDescription: "Fill the form with the validated version and User-Agent; save to apply." }, web: { title: "Grok Web", baseURL: "Upstream URL", baseURLHelp: "Base endpoint used for Grok Web API calls and account operations.", statsigMode: "x-statsig source", statsigModeHelp: "Use a fixed value or retrieve request identity dynamically from a signer service.", statsigManual: "Manual", statsigURL: "Fetch from URL", statsigValue: "x-statsig-id", statsigValueHelp: "Fixed x-statsig-id attached to Grok Web requests.", statsigConfigured: "Configured", statsigKeepConfigured: "Leave blank to keep the current value", statsigValuePlaceholder: "Paste x-statsig-id", statsigSignerURL: "Signer URL", statsigSignerURLHelp: "Internal signer endpoint used to retrieve x-statsig-id per request.", quotaTimeout: "Quota timeout", quotaTimeoutHelp: "Maximum time to wait for upstream quota and account-status queries.", chatTimeout: "Chat timeout", chatTimeoutHelp: "Maximum time to wait for a Grok Web chat request to complete.", streamIdleTimeout: "Stream idle timeout", streamIdleTimeoutHelp: "Maximum period without upstream data for raw text-chat streams; image, video, and other media requests are unaffected.", imageTimeout: "Image timeout", imageTimeoutHelp: "Maximum time to wait for image generation or editing to complete.", videoTimeout: "Video timeout", videoTimeoutHelp: "Maximum time to wait for a Grok Web video generation request to complete.", freeVideoDurationCap: "Free-account video duration cap", freeVideoDurationCapHelp: "Caps duration sent to Grok Web for free-tier accounts so requests over the upstream limit do not 429 and rotate accounts uselessly. Default 6 seconds, range 1–15.", mediaConcurrency: "Media job concurrency", mediaConcurrencyHelp: "Image and video jobs one instance may run concurrently. Changes require a restart.", recoveryBackoffBase: "Quota recovery backoff", recoveryBackoffBaseHelp: "Initial retry interval after consecutive quota-recovery check failures.", recoveryBackoffMax: "Maximum recovery backoff", recoveryBackoffMaxHelp: "Maximum interval reached by exponential backoff for quota-recovery checks.", allowNSFW: "Allow NSFW images", allowNSFWHelp: "Allow Grok Web image requests to enable the adult-content preference.", clearanceMode: "Clearance management", clearanceModeHelp: "Maintain Cloudflare credentials manually or let FlareSolverr acquire and refresh them on the actual egress.", clearanceManual: "Manual", clearanceFlareSolverr: "FlareSolverr", flareSolverrURL: "FlareSolverr URL", flareSolverrURLHelp: "Internal FlareSolverr endpoint used to solve Cloudflare Clearance.", clearanceTimeout: "Solve timeout", clearanceTimeoutHelp: "Maximum time allowed for one FlareSolverr solve.", clearanceRefresh: "Refresh interval", clearanceRefreshHelp: "Periodic refresh interval for fixed egress; account-bound proxies are maintained independently during requests." }, console: { baseURLHelp: "Base endpoint used for Grok Console requests and account operations.", chatTimeoutHelp: "Maximum time to wait for a Grok Console chat request to complete.", streamIdleTimeout: "Stream idle timeout", streamIdleTimeoutHelp: "Maximum period without upstream data for text SSE only; media and non-streaming requests are unaffected." }, batch: { title: "Batch tasks", importConcurrency: "Import sync concurrency", importConcurrencyHelp: "Accounts initialized and synchronized concurrently after a batch import.", conversionConcurrency: "Account conversion concurrency", conversionConcurrencyHelp: "Cross-provider account conversions that may run concurrently.", syncConcurrency: "Data sync concurrency", syncConcurrencyHelp: "Quota, status, and capability synchronizations that may run concurrently.", refreshConcurrency: "Credential refresh concurrency", refreshConcurrencyHelp: "Account credential refreshes that may run concurrently.", randomDelay: "Maximum random delay (ms)", randomDelayHelp: "Maximum randomized delay before batch work starts to smooth upstream request bursts." }, media: { title: "Media storage", maxImageSize: "Maximum image size", maxImageSizeHelp: "Largest individual image that may be written to local media storage.", maxTotalSize: "Media storage limit", maxTotalSizeHelp: "Total local storage available to image and video files.", cleanupThresholdPercent: "Automatic cleanup threshold", cleanupThresholdPercentHelp: "Storage utilization that triggers removal of older media files.", cleanupInterval: "Capacity check interval", cleanupIntervalHelp: "Interval between background storage checks and cleanup evaluation.", sizeUnit: "Storage unit", publicApiBaseURL: "Public API base URL", publicApiBaseURLHelp: "Used for public image URLs and docs examples. Leave empty to use the service startup value, which defaults to http://127.0.0.1:8000." }, egress: { title: "Egress proxies", description: "Nodes manage proxy and health independently for Grok Build, Grok Web, Grok Console, or Web assets. Build inherits the Provider User-Agent; Web and Console nodes manage their own browser User-Agent and cookies. Proxy URLs and Cloudflare cookies are write-only.", add: "Add node", saved: "Proxy node saved", deleted: "Proxy node deleted", name: "Name", scope: "Scope", proxy: "Proxy", clearance: "Clearance", health: "Health", directFallback: "Direct connection is used when no node is configured", scopeBuild: "Grok Build", scopeWeb: "Grok Web", scopeWebAsset: "Grok Web (assets only)", configured: "Configured", direct: "Direct", none: "None", editTitle: "Edit proxy node", addTitle: "Add proxy node", dialogDescription: "Build nodes only configure the proxy and inherit the Provider User-Agent; Web and Console nodes use their own browser User-Agent and Cloudflare cookies.", enabled: "Enabled", proxyURL: "Proxy URL", proxyProtocols: "Supports HTTP, HTTPS, SOCKS4, SOCKS4A, SOCKS5, and SOCKS5H.\nResin users can put {account} in the username to bind one lease per account.", proxyPool: "Proxy pool mode", proxyPoolHelp: "A request-level connection failure does not cool the entire shared node. Proxies containing {account} use this policy automatically.", userAgent: "User-Agent", cloudflareCookie: "Cloudflare Cookie", keepConfigured: "Configured; leave blank to keep unchanged", operationFailed: "Operation failed", refreshClearance: "Refresh Clearance", clearanceRefreshed: "Clearance refreshed", clearanceManaged: "Cloudflare cookies and User-Agent are managed by FlareSolverr; account-bound proxies are isolated per account." }, routing: { title: "Routing policy", stickyTTL: "Sticky session TTL", stickyTTLHelp: "How long a session prefers its selected account before returning to normal scheduling.", cooldownBase: "Base cooldown", cooldownBaseHelp: "Initial cooldown applied after a recoverable account failure.", cooldownMax: "Maximum cooldown", cooldownMaxHelp: "Longest cooldown allowed when repeated failures trigger exponential backoff.", capacityWait: "Saturated account wait", capacityWaitHelp: "How long to wait for capacity before switching accounts or failing when all candidates are saturated.", maxAttempts: "Maximum attempts", maxAttemptsHelp: "Maximum account switches and retries allowed for one request, from 1 to 200.", videoMaxAttempts: "Video maximum attempts", videoMaxAttemptsHelp: "Create-phase account failover for video jobs only. Set a number or enable unlimited. Polling after create stays on the same account.", preferFreeBuild: "Prefer Grok Build Free accounts", preferFreeBuildHelp: "Prefer confirmed usable Free accounts without changing other routing eligibility rules.", accountIsolatedConnections: "Isolate upstream connections by account", accountIsolatedConnectionsHelp: "When enabled, each account uses its own upstream TCP/HTTP connection pool so external L4 or connection-hash load balancers can spread traffic; the same account still reuses connections. Applies to Build, Web, Console, and Web-to-Build traffic. This increases connections, TLS handshakes, memory, and file-descriptor usage, so enable it only when connection-level balancing is required." }, audit: { title: "Request Audit & Logs", tabTitle: "Audit & Logs", retentionTitle: "Log Retention Policy", retentionDays: "Log retention days", retentionDaysHelp: "Automatically purges request audits and failure attempts older than the specified days. Set to 0 for indefinite retention, default is 7 days.", performanceTitle: "Buffer & Performance", bufferSize: "Queue capacity", bufferSizeHelp: "Maximum audit records held in memory before persistence.", batchSize: "Batch size", batchSizeHelp: "Maximum audit records written in one database transaction.", flushInterval: "Flush interval", flushIntervalHelp: "Maximum time pending audit records wait before they are committed.", commitDelay: "Commit aggregation delay (ms)", commitDelayHelp: "Maximum time acknowledged writes wait to join an atomic batch before commit." }, clientKeys: { title: "Client key defaults", rpmLimit: "Default RPM", rpmLimitHelp: "Requests per minute assigned to newly created client keys.", maxConcurrent: "Default concurrency", maxConcurrentHelp: "Concurrent requests assigned to newly created client keys." }, accounts: { title: "Account maintenance", degradedAccountTitle: "Degraded-account handling", autoDisableDegradedAccounts: "Automatically disable degraded accounts", autoDisableDegradedAccountsHelp: "Enables request-path quality checks and retries; the first confirmed missing-thinking or degraded-throughput hit disables the account immediately. When disabled, throughput hits do not disable accounts, and missing-thinking checks and cooldowns follow the existing configuration.", invalidationTitle: "Automatic interception", botRiskSchedulingTitle: "Bot-risk scheduling", excludeBuildBotFlaggedFromScheduling: "Exclude bot-risk Build accounts from scheduling", excludeBuildBotFlaggedFromSchedulingHelp: "When enabled, Grok Build accounts whose JWT bot_flag_source/bfs is 1 or 2 are removed from Build scheduling only. Linked Web/Console accounts keep their normal scheduling. Accounts remain in the pool for viewing and manual actions.", cleanupTitle: "Account cleanup", autoCleanReauthEnabled: "Automatic invalid-account cleanup", autoCleanReauthEnabledHelp: "Permanently deletes invalid accounts after the configured retention period. Accounts with active requests or video jobs are skipped.", autoCleanReauthInterval: "Cleanup interval", autoCleanReauthIntervalHelp: "How often to check for eligible accounts, from 1 minute to 1 hour.", autoCleanReauthMinAge: "Minimum retention", autoCleanReauthMinAgeHelp: "How long to retain an account after it is marked for reauthorization.", autoCleanIncludeDisabled: "Include disabled accounts", autoCleanIncludeDisabledHelp: "Includes disabled accounts that require reauthorization in automatic cleanup.", autoCleanEnableTitle: "Enable automatic cleanup?", autoCleanEnableDescription: "Eligible accounts will be permanently deleted and cannot be recovered. The first run starts after one full cleanup interval.", autoCleanIncludeDisabledTitle: "Include disabled accounts?", autoCleanIncludeDisabledDescription: "Disabled accounts that require reauthorization will also be permanently deleted. This action cannot be undone.", autoCleanConfirm: "Enable" }, units: { seconds: "Seconds", minutes: "Minutes", hours: "Hours", days: "Days" } }, egressProxyProfiles: { title: "Proxy address library", libraryTitle: "Proxy address library", libraryDescription: "Manage reusable proxy addresses in one place. Changes sync to every node using the address.", description: "Save proxy addresses that need to be reused across nodes.", add: "Add proxy address", addTitle: "Add proxy address", editTitle: "Edit proxy address", dialogDescription: "Changing the proxy address updates every bound node. Capacity and operational state remain isolated per node.", name: "Address name", endpoint: "Proxy address", nodes: "Used by", search: "Search address names", empty: "No proxy addresses", emptyLibrary: "The library is empty. Add an address to reuse it across nodes.", noMatches: "No matching proxy addresses", loadingSelection: "Loading selected address…", selectionUnavailable: "Proxy address #{{id}} is unavailable", saved: "Proxy address saved", deleted: "Proxy address deleted", deleteTitle: "Delete proxy address?", deleteDescription: "This deletes {{name}}. Addresses currently used by nodes cannot be deleted.", deleteBlocked: "Used by {{count}} nodes", assignment: "Proxy address source", assignmentHelp: "Select an address from the library to reuse it across Provider nodes. Health, capacity, User-Agent, and Clearance remain isolated per node.", independent: "Configure this node separately", managedByProfile: "Managed by the proxy address library", nodeCount: "{{count}} nodes", backToLibrary: "Back to address library", createFromPicker: "Add and use a proxy address", refreshNodes: "Refresh proxy nodes", reveal: "Reveal full proxy URL", hide: "Hide full proxy URL", revealUnavailable: "Only a saved proxy address can reveal its URL" }, settingsBuildTransport: { responseHeaderTimeout: "Response header timeout", responseHeaderTimeoutHelp: "Maximum time to wait for the first Grok Build response headers after the request body is sent.", streamIdleTimeout: "Stream idle timeout", streamIdleTimeoutHelp: "Maximum wait for useful generated content or tool progress. Keepalives and private control events do not extend the deadline." },