diff --git a/README.md b/README.md index 630d1b9..4201052 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,8 @@ The gateway does not implement embeddings, file uploads, image generation, or Re Discovery combines upstream model lists with the OpenCode capability and price catalog at `https://models.opencode.ai/api.json`. It tracks native protocols per tier and exposes available context/token limits, prices, `native_protocol`, `supported_endpoints`, and reasoning metadata through `/v1/models`. Price/deprecation metadata refreshes every 24 hours; failed refreshes retain existing data. Prices are metadata, not a billing estimate or account balance. +Models explicitly marked `deprecated` by the capability catalog are excluded from capability discovery, and supplemental documentation cannot restore them on the same tier. Unknown model names return 404, known but no-longer-servable models return 410, and only explicitly unsupported SDK protocols return the 400 unsupported-protocol error. An explicit protocol override remains an operator routing choice. + With manual keys, eligible free models can first use the anonymous lane when explicitly enabled, then the available keyed tiers in `prefer` order. Without anonymous access they use configured keys. Free eligibility comes from a case-insensitive `free` in the model ID or non-deprecated metadata with zero input and output cost; eligibility does not guarantee acceptance upstream. Paid models require an appropriate authenticated route. `models.free_only` also filters members of rotation groups. Model aliases only change client-facing names. For example, `"models": {"strip_free_suffix": true, "aliases": {"beam-pro": "beam-free"}}` publishes `beam-pro` for `beam-free` and strips `-free` from other available models when safe. Explicit aliases take priority; if several aliases point to one model, discovery publishes the lexicographically first and accepts all of them. Requests using original upstream IDs remain supported and echo that original name. Chat, Responses, Anthropic and System One replies preserve the requested alias, including model fields nested in streaming events. Pricing, reasoning overrides, quota tracking and rotation members continue to use upstream IDs. @@ -239,6 +241,8 @@ Availability is learned from real traffic by default. Synthetic checks run only `warp.enabled` defaults to `false`. When enabled, free anonymous/manual-Zen traffic and their discovery/probe paths use an in-process Cloudflare WARP tunnel. Go traffic, paid traffic, and OAuth routes retain their configured proxy routing. WARP needs outbound UDP to Cloudflare port `2408`; no TUN device or routing-table change is required. Initialization failure rejects startup or the candidate configuration. +`warp.proxy_fallback` defaults to `false`. Explicitly enabling it allows anonymous inference to use the configured anonymous proxy/direct pool after WARP returns 429, an IP-abuse block, or explicit egress unavailability. This can expose the host's public IP when `direct` is configured. It never adds the key-only `keys_direct` transport, changes a key/OAuth binding, or applies to discovery, probes, or pinned diagnostics. Cancellation, an exhausted request deadline, deterministic request rejection, and ordinary upstream errors do not trigger this fallback; waiting for a WARP exit can still consume the request budget. WARP and proxy legs share one breaker admission, and only the fallback leg counts its failures, avoiding threshold-one/half-open short circuits. Startup remains fail-closed even with fallback enabled. + `warp.pool_size` is a concurrency-driven exit ceiling from 1 to 32, default 2. `warp.stack` accepts `ipv6` (default), `ipv4`, or `dual`. Replacing an exit does not guarantee a fresh upstream allowance. `warp.source_ipv6` is optional, requires the IPv6 stack and a prefix of `/64` or shorter, and on Windows the selected source addresses must already be assigned to an interface. It does not configure host networking. ## Management and OAuth diff --git a/README.zh-CN.md b/README.zh-CN.md index 4242f2f..d4ebc1a 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -175,6 +175,8 @@ Responses 历史中的 assistant reasoning、文本和函数调用会合并为 a OAuth 另有规则:请求选择 OAuth 路由后,只使用该 Tier 已确认的路由,不因失败改走匿名、手动 Key 或其他 Tier。Go OAuth 授权失败、额度耗尽或返回 429,均不会触发 PAYG 请求。两类通道都能服务同一模型时,明确选择 `prefer: "zen"` 允许使用已连接的 Zen PAYG 通道。 +能力目录明确标记 `deprecated` 的模型不再导入该 Tier 的协议与能力,补充文档也不能重新引入。未知模型名返回 404;已知但已无法提供的模型返回 410;只有明确不支持的 SDK 协议才返回 400 协议错误。显式协议覆盖仍属于操作者的路由选择。 + ### 超时、代理与会话亲和 | 配置项 | 默认值 | 含义 | @@ -239,6 +241,8 @@ OAuth 另有规则:请求选择 OAuth 路由后,只使用该 Tier 已确认 `warp.pool_size` 是随并发调整的出口上限,范围 1–32,默认 2。`warp.stack` 为 `ipv6`(默认)、`ipv4` 或 `dual`。替换出口不保证获得新的上游额度。可选 `warp.source_ipv6` 要求 IPv6 堆栈及 `/64` 或更短前缀;Windows 下实际选择的源地址必须已分配到网卡,程序不会配置主机网络。 +`warp.proxy_fallback` 默认 `false`。显式开启后,仅匿名推理在 WARP 返回 429、IP 滥用封锁或明确出口不可用时,才允许使用已配置的匿名代理/直连池。若池中含 `direct`,可能暴露主机公网 IP。不会引入 `keys_direct` 的内部密钥专用直连,也不改变 Key/OAuth 绑定,不适用于目录、主动探测或固定出口诊断。客户端取消、请求预算耗尽、确定性请求错误及普通上游错误均不触发回退;等待 WARP 出口仍可能耗尽预算。两阶段共用一次熔断准入,仅回退阶段计入其失败,避免阈值 1/半开状态提前阻断回退。启动初始化仍失败关闭。 + ## 管理与 OAuth WebUI 包含概览、诊断/Playground/日志、接入、API Key、模型与额度、轮转、配置、账号页面,提供简中、英语、越南语及意大利语。语言与主题选择保存在浏览器。完整操作与端点见[管理指南](docs/management.zh-CN.md)。 diff --git a/config.example.json b/config.example.json index c6d8801..05b58ac 100644 --- a/config.example.json +++ b/config.example.json @@ -8,6 +8,7 @@ "keys_direct": false, "warp": { "enabled": false, + "proxy_fallback": false, "pool_size": 2, "stack": "ipv6", "source_ipv6": "" diff --git a/docs/management.md b/docs/management.md index 97cc455..315995f 100644 --- a/docs/management.md +++ b/docs/management.md @@ -193,6 +193,8 @@ For bulk cleanup, only `unavailable` is a confirmed-unavailable filter for that WARP is disabled by default. When enabled, free anonymous/manual-Zen requests and their discovery/probe paths use an in-process tunnel. Go, paid, and OAuth routes retain proxy routing. It needs outbound Cloudflare UDP on port `2408`, without TUN or routing-table changes. `warp.pool_size` is a concurrency-driven exit ceiling of 1–32 (default 2). `warp.stack` defaults to `ipv6`, with `ipv4`/`dual` also available. Initialization failure rejects startup or the candidate configuration without silently falling back to proxies. +The configuration page can explicitly enable `warp.proxy_fallback` (default `false`) for anonymous inference only. Eligible failures are WARP 429, an IP-abuse block, or explicit egress unavailability, while the original client/request budget remains active. Configured direct routes may reveal the host's public IP. Key-only injected direct routes, OAuth/manual-key policy, catalog/probe paths, and pinned diagnostics are unaffected. This does not bypass WARP initialization failure or guarantee fallback when waiting for an exit exhausts the request budget. + Exit statuses 403/429 can trigger retirement and replacement, with retries still bounded by their budget. A new exit does not guarantee additional quota. IPv6 `/64` and IPv4 `/32` egress blocks are deduplicated/cooled. `warp.source_ipv6` requires the IPv6 stack and a prefix of `/64` or shorter. Linux uses `IPV6_FREEBIND`; Windows requires the selected source addresses to be assigned already. This setting does not configure host networking. `/healthz` reports WARP state/counts only; `resources.warp` in `/api/monitor` also contains exit information. ## SOTA / Sweet rotation diff --git a/docs/management.zh-CN.md b/docs/management.zh-CN.md index a6f7aaa..af6cdc3 100644 --- a/docs/management.zh-CN.md +++ b/docs/management.zh-CN.md @@ -192,6 +192,8 @@ Key、代理、上游、超时、模型、偏好、reasoning 和日志设置热 WARP 默认关闭。开启后免费匿名/手动 Zen 请求及对应目录/探测使用进程内隧道;Go、付费与 OAuth 保持代理路由。需要 Cloudflare UDP `2408`,不需要 TUN 或改路由表。`warp.pool_size` 为 1–32 的并发出口上限(默认 2),`warp.stack` 默认为 `ipv6`,也可 `ipv4`/`dual`。初始化失败拒绝启动或候选配置,不静默改走代理。 +配置页面可显式开启 `warp.proxy_fallback`(默认 `false`),仅在客户端/请求预算仍有效,且匿名推理遇到 WARP 429、IP 滥用封锁或明确出口不可用时回退。已配置直连可能暴露主机公网 IP。内部密钥专用直连、OAuth/手动 Key 策略、目录/探测与固定出口诊断不受影响;不绕过 WARP 初始化失败,也不保证等待出口耗尽预算后仍有回退机会。 + 出口 403/429 可触发退役与补充,重试仍受预算限制;更换出口不保证额外额度。IPv6 `/64`、IPv4 `/32` 出口按网段去重/冷却。`warp.source_ipv6` 要求 IPv6 堆栈、`/64` 或更短前缀;Linux 使用 `IPV6_FREEBIND`,Windows 必须已分配所选源地址。该设置不会配置主机网络。`/healthz` 只提供 WARP 状态/数量,`/api/monitor` 的 `resources.warp` 另含出口信息。 ## SOTA / Sweet 轮转 diff --git a/internal/admin/server.go b/internal/admin/server.go index 7803f37..47f372f 100644 --- a/internal/admin/server.go +++ b/internal/admin/server.go @@ -212,6 +212,11 @@ type LoggingUpdate struct { FilePath *string `json:"file_path,omitempty"` } +type WarpUpdate struct { + config.WarpConfig + ProxyFallback *bool `json:"proxy_fallback,omitempty"` +} + type RetryUpdate struct { config.RetryConfig StreamResumeEnabled *bool `json:"stream_resume_enabled,omitempty"` @@ -229,7 +234,7 @@ type ConfigUpdate struct { GoKeys []SecretInput `json:"go_keys"` Anonymous bool `json:"anonymous"` KeysDirect *bool `json:"keys_direct,omitempty"` - Warp config.WarpConfig `json:"warp"` + Warp WarpUpdate `json:"warp"` Proxies []SecretInput `json:"proxies"` ProxyFile string `json:"proxyfile"` ProxyBindings map[string]string `json:"proxy_bindings,omitempty"` @@ -295,7 +300,7 @@ func (a *Server) handlePutConfig(w http.ResponseWriter, r *http.Request) { Rotation: current.Rotation, GoOAuth: current.GoOAuth, ZenOAuth: current.ZenOAuth, - Listen: update.Listen, ServerKeys: serverKeys, ZenKeys: zenKeys, GoKeys: goKeys, Anonymous: update.Anonymous, Warp: update.Warp, Proxies: proxies, ProxyFile: update.ProxyFile, + Listen: update.Listen, ServerKeys: serverKeys, ZenKeys: zenKeys, GoKeys: goKeys, Anonymous: update.Anonymous, Warp: update.Warp.WarpConfig, Proxies: proxies, ProxyFile: update.ProxyFile, ProxyBindings: proxyBindings, KeysDirect: current.KeysDirect, Upstream: update.Upstream, Retry: update.Retry.RetryConfig, Models: update.Models.ModelsConfig, Performance: update.Performance, Logging: update.Logging.LoggingConfig, Prefer: update.Prefer, @@ -310,6 +315,10 @@ func (a *Server) handlePutConfig(w http.ResponseWriter, r *http.Request) { candidate.ZenOAuth = latest.ZenOAuth candidate.ServerKeyMetadata = latest.ServerKeyMetadata candidate.Rotation = latest.Rotation + candidate.Warp.ProxyFallback = latest.Warp.ProxyFallback + if update.Warp.ProxyFallback != nil { + candidate.Warp.ProxyFallback = *update.Warp.ProxyFallback + } candidate.Retry.StreamResumeEnabled = latest.Retry.StreamResumeEnabled if update.Retry.StreamResumeEnabled != nil { candidate.Retry.StreamResumeEnabled = *update.Retry.StreamResumeEnabled diff --git a/internal/config/config.go b/internal/config/config.go index 1e62401..cfe6f7c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -81,9 +81,10 @@ type ReasoningConfig struct { // is fail-closed: a configuration that enables WARP is rejected when no exit // can be established. type WarpConfig struct { - Enabled bool `json:"enabled"` - PoolSize int `json:"pool_size,omitempty"` - Stack string `json:"stack,omitempty"` + Enabled bool `json:"enabled"` + PoolSize int `json:"pool_size,omitempty"` + Stack string `json:"stack,omitempty"` + ProxyFallback bool `json:"proxy_fallback,omitempty"` // SourceIPv6 is an outer IPv6 prefix (usually a routed /64) each WARP exit // binds its WireGuard socket to. Rotating the source is what gives a // replacement exit a new public egress; without it, exits share one diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index e30701a..d946605 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -334,16 +334,10 @@ func (g *Gateway) handleInference(external wire.Protocol) http.HandlerFunc { } } if !oauthModel && !g.catalog.Supported(model) { - // A model the catalog has never heard of is a bad model NAME: 404 - // tells a client to pick a different model. A model the catalog - // knows but cannot serve is a capability or routing problem, and - // the old 400 phrasing ("the model uses an upstream protocol that - // opencode2api does not expose") is accurate for it. The old code - // returned that 400 for BOTH, so a request for a model the - // upstream retired (it answers 410 Gone) looked like a gateway - // capability bug and clients retried forever. - if g.catalog.Known(model) { + if g.catalog.HasUnsupportedProtocol(model) { wire.WriteError(w, external, http.StatusBadRequest, "the model uses an upstream protocol that opencode2api does not expose", "invalid_request_error", "model") + } else if g.catalog.Known(model) { + wire.WriteError(w, external, http.StatusGone, fmt.Sprintf("model %q is retired or unavailable in the upstream catalog", publicModel), "model_not_found", "model") } else { wire.WriteError(w, external, http.StatusNotFound, fmt.Sprintf("model %q was not found in the upstream model catalog", model), "model_not_found", "model") } @@ -645,11 +639,10 @@ func (g *Gateway) handleSystemOne(w http.ResponseWriter, r *http.Request) { } } if !g.catalog.Supported(model) { - // Same split as the chat path: a model the catalog has never heard of - // is a bad model NAME (404), a model it knows but cannot serve is a - // capability or routing problem (400). - if g.catalog.Known(model) { + if g.catalog.HasUnsupportedProtocol(model) { wire.WriteError(w, wire.SystemOne, http.StatusBadRequest, "the model uses an upstream protocol that opencode2api does not expose", "invalid_request_error", "model") + } else if g.catalog.Known(model) { + wire.WriteError(w, wire.SystemOne, http.StatusGone, fmt.Sprintf("model %q is retired or unavailable in the upstream catalog", publicModel), "model_not_found", "model") } else { wire.WriteError(w, wire.SystemOne, http.StatusNotFound, fmt.Sprintf("model %q was not found in the upstream model catalog", model), "model_not_found", "model") } diff --git a/internal/gateway/upstream.go b/internal/gateway/upstream.go index f9a5d5a..62542e7 100644 --- a/internal/gateway/upstream.go +++ b/internal/gateway/upstream.go @@ -445,15 +445,44 @@ func (g *Gateway) maxAnonymousExits() int { // tiers. It returns the last response (body still open), else the last error, // plus the number of attempts made. func (g *Gateway) doAnonymousUpstream(ctx context.Context, route models.Route, bodies map[config.Tier][]byte, ids identity.RequestIDs, attemptOffset int) (response *http.Response, resultErr error, resultAttempts int) { - if g.usesWARP(route.ID, config.TierZen, true) { - return g.doWarpAnonymousUpstream(ctx, route, bodies, ids, attemptOffset) - } - // The breaker holds the lane shut for an hour-scale window after repeated - // failures: poking a flagged upstream again would only extend the block. if !g.anonymous.AllowAttempt() { return nil, errAnonymousLanePaused, 0 } defer g.anonymous.ReleaseProbe() + if !g.usesWARP(route.ID, config.TierZen, true) { + return g.doAnonymousProxyUpstream(ctx, route, bodies, ids, attemptOffset) + } + fallback := g.cfg.Warp.ProxyFallback && g.anonymous.Len() > 0 && !isDiagnosticRequest(ctx) + if _, pinned := relayOverrideFrom(ctx); pinned { + fallback = false + } + warpResponse, warpErr, warpAttempts := g.doWarpAnonymousUpstream(ctx, route, bodies, ids, attemptOffset, fallback) + if !fallback || !shouldFallbackWARP(ctx, warpResponse, warpErr) { + return warpResponse, warpErr, warpAttempts + } + g.logger.Warn("WARP anonymous egress exhausted; trying explicitly enabled proxy fallback", "component", "upstream", "event", "warp_proxy_fallback", "request_id", ids.Request, "warp_attempts", warpAttempts, "warp_status", upstreamStatus(warpResponse)) + bufferRetryResponse(warpResponse) + proxyResponse, proxyErr, proxyAttempts := g.doAnonymousProxyUpstream(ctx, route, bodies, ids, attemptOffset+warpAttempts) + if proxyResponse != nil { + if warpResponse != nil && warpResponse != proxyResponse { + _ = warpResponse.Body.Close() + } + return proxyResponse, proxyErr, warpAttempts + proxyAttempts + } + if proxyErr != nil { + return warpResponse, proxyErr, warpAttempts + proxyAttempts + } + return warpResponse, warpErr, warpAttempts + proxyAttempts +} + +func shouldFallbackWARP(ctx context.Context, response *http.Response, err error) bool { + if ctx.Err() != nil || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || errors.Is(err, errDeterministicClientRejection) || errors.Is(err, errAnonymousLanePaused) { + return false + } + return response != nil && response.StatusCode == http.StatusTooManyRequests || errors.Is(err, errFreeTierIPBlocked) || errors.Is(err, errWARPUnavailable) +} + +func (g *Gateway) doAnonymousProxyUpstream(ctx context.Context, route models.Route, bodies map[config.Tier][]byte, ids identity.RequestIDs, attemptOffset int) (response *http.Response, resultErr error, resultAttempts int) { var lastResponse *http.Response defer func() { if lastResponse != nil && lastResponse != response { diff --git a/internal/gateway/warp.go b/internal/gateway/warp.go index 0df2bb9..b0c51f7 100644 --- a/internal/gateway/warp.go +++ b/internal/gateway/warp.go @@ -227,11 +227,15 @@ func warpProxy(label string) *proxyTransport { // proxy. The lane breaker still applies; per-proxy cooldowns and the block // cursor do not, because a block is a property of the WARP exit and rotation // replaces it. -func (g *Gateway) doWarpAnonymousUpstream(ctx context.Context, route models.Route, bodies map[config.Tier][]byte, ids identity.RequestIDs, attemptOffset int) (response *http.Response, resultErr error, resultAttempts int) { - if !g.anonymous.AllowAttempt() { - return nil, errAnonymousLanePaused, 0 - } - defer g.anonymous.ReleaseProbe() +func (g *Gateway) doWarpAnonymousUpstream(ctx context.Context, route models.Route, bodies map[config.Tier][]byte, ids identity.RequestIDs, attemptOffset int, proxyFallback bool) (response *http.Response, resultErr error, resultAttempts int) { + deferredFailure := false + defer func() { + if deferredFailure && ctx.Err() == nil && !shouldFallbackWARP(ctx, response, resultErr) && (response == nil || response.StatusCode/100 != 2) && !errors.Is(resultErr, errDeterministicClientRejection) { + if pause, tripped := g.anonymous.NoteFailure(); tripped { + g.logger.Warn("anonymous lane circuit breaker opened", "component", "upstream", "event", "anonymous_breaker_open", "paused_for", pause.String()) + } + } + }() rawBody := bodies[config.TierZen] if len(rawBody) == 0 { return nil, errors.New("no prepared Zen request body"), 0 @@ -348,6 +352,10 @@ func (g *Gateway) doWarpAnonymousUpstream(ctx context.Context, route models.Rout } } if !leaseBlocked && lastStatus != http.StatusTooManyRequests { + if proxyFallback { + deferredFailure = true + continue + } if pause, tripped := g.anonymous.NoteFailure(); tripped { g.logger.Warn("anonymous lane circuit breaker opened", "component", "upstream", "event", "anonymous_breaker_open", "status", lastStatus, "paused_for", pause.String()) break @@ -358,6 +366,7 @@ func (g *Gateway) doWarpAnonymousUpstream(ctx context.Context, route models.Rout return nil, ctx.Err(), attempts } if halted { + g.anonymous.NoteNeutral() return lastResponse, errDeterministicClientRejection, attempts } if isTitle { diff --git a/internal/models/catalog.go b/internal/models/catalog.go index 144e225..ed3b7b6 100644 --- a/internal/models/catalog.go +++ b/internal/models/catalog.go @@ -650,6 +650,22 @@ func (c *ModelCatalog) Known(model string) bool { return false } +func (c *ModelCatalog) HasUnsupportedProtocol(model string) bool { + c.mu.RLock() + defer c.mu.RUnlock() + if c.protocols[model] != "" { + return false + } + unsupported := false + for _, tier := range []config.Tier{config.TierZen, config.TierGo} { + if c.nativeProtocols[tier][model] != "" && !c.unsupported[tier][model] { + return false + } + unsupported = unsupported || c.unsupported[tier][model] + } + return unsupported +} + // MetadataForTier returns the rich per-model metadata (context window, // reasoning, tool call, modalities) captured from the OpenCode capability // catalog for the tier that will actually serve the request. Same-named models diff --git a/internal/models/discovery.go b/internal/models/discovery.go index 45ed934..d5b43cd 100644 --- a/internal/models/discovery.go +++ b/internal/models/discovery.go @@ -65,6 +65,7 @@ type capabilityProvider struct { type capabilityModel struct { ID string `json:"id"` + Status string `json:"status"` Provider *capabilityModelProvider `json:"provider"` Limit *capabilityModelLimit `json:"limit"` Reasoning bool `json:"reasoning"` @@ -168,6 +169,7 @@ func FetchCapabilities(ctx context.Context, client *http.Client, endpoint string Unsupported: map[config.Tier]map[string]bool{config.TierZen: {}, config.TierGo: {}}, Metadata: map[config.Tier]map[string]Metadata{config.TierZen: {}, config.TierGo: {}}, } + deprecated := map[config.Tier]map[string]bool{config.TierZen: {}, config.TierGo: {}} for providerID, provider := range providers { tier, ok := capabilityTier(providerID, provider.API) if !ok { @@ -177,6 +179,10 @@ func FetchCapabilities(ctx context.Context, client *http.Client, endpoint string if model.ID != "" { modelID = model.ID } + if strings.EqualFold(strings.TrimSpace(model.Status), "deprecated") { + deprecated[tier][modelID] = true + continue + } npm := provider.NPM if model.Provider != nil && model.Provider.NPM != "" { npm = model.Provider.NPM @@ -189,6 +195,13 @@ func FetchCapabilities(ctx context.Context, client *http.Client, endpoint string result.Metadata[tier][modelID] = model.metadata() } } + for tier, models := range deprecated { + for modelID := range models { + delete(result.Protocols[tier], modelID) + delete(result.Unsupported[tier], modelID) + delete(result.Metadata[tier], modelID) + } + } // The machine catalog is the primary source. The upstream endpoint tables // are a supplemental source for models whose provider inherits a default SDK // but whose published endpoint is more specific (for example a Messages @@ -207,11 +220,14 @@ func FetchCapabilities(ctx context.Context, client *http.Client, endpoint string continue } for modelID, protocol := range protocols { + if deprecated[doc.tier][modelID] { + continue + } result.Protocols[doc.tier][modelID] = protocol delete(result.Unsupported[doc.tier], modelID) } } - if len(result.Protocols[config.TierZen]) == 0 && len(result.Protocols[config.TierGo]) == 0 && len(result.Unsupported[config.TierZen]) == 0 && len(result.Unsupported[config.TierGo]) == 0 { + if len(result.Protocols[config.TierZen]) == 0 && len(result.Protocols[config.TierGo]) == 0 && len(result.Unsupported[config.TierZen]) == 0 && len(result.Unsupported[config.TierGo]) == 0 && len(deprecated[config.TierZen]) == 0 && len(deprecated[config.TierGo]) == 0 { return Capabilities{}, errors.New("OpenCode capability endpoint returned no Zen or Go models") } return result, nil diff --git a/webui/index.html b/webui/index.html index 9f07597..f0623b3 100644 --- a/webui/index.html +++ b/webui/index.html @@ -1021,6 +1021,12 @@ 仅在使用 IPv6 网络栈时生效。每个 WARP 出口从该前缀取一个源地址出网,换出口即换公网地址;留空则共用本机默认源地址。

+
+ +
diff --git a/webui/js/i18n.js b/webui/js/i18n.js index 2b65baf..750f29e 100644 --- a/webui/js/i18n.js +++ b/webui/js/i18n.js @@ -269,6 +269,7 @@ const DICTIONARY = { "config.secrets.reveal": "Reveal after re-verification", "config.secrets.anonymous": "Enable the Zen anonymous channel", "config.secrets.keysDirect": "Pin manual upstream keys to direct egress (explicit proxy bindings take priority)", + "config.warp.fallback": "Allow anonymous WARP fallback to configured proxies/direct on rate limits, IP blocks or explicit unavailability", "config.secrets.anonymousWarning": "Anonymous access is disabled by default and may be heavily blocked upstream. Prefer a Zen API key. Enabling anonymous access does not guarantee availability or automatically change your current settings.", "config.secrets.add": "One key per line", "config.proxy.title": "Proxy nodes", @@ -955,6 +956,7 @@ const DICTIONARY = { "config.secrets.reveal": "Xem sau khi xác minh lại", "config.secrets.anonymous": "Bật kênh ẩn danh Zen", "config.secrets.keysDirect": "Ghim khóa thượng nguồn thủ công vào kết nối trực tiếp (ưu tiên liên kết proxy rõ ràng)", + "config.warp.fallback": "Cho phép WARP ẩn danh chuyển sang proxy/kết nối trực tiếp đã cấu hình khi bị giới hạn, chặn IP hoặc không khả dụng", "config.secrets.add": "Mỗi dòng thêm một key", "config.proxy.title": "Nút Proxy", "config.proxy.caption": @@ -1552,6 +1554,7 @@ const DICTIONARY = { "config.secrets.reveal": "Mostra dopo nuova verifica", "config.secrets.anonymous": "Abilita il canale anonimo Zen", "config.secrets.keysDirect": "Vincola le chiavi upstream manuali alla connessione diretta (i vincoli proxy espliciti hanno priorità)", + "config.warp.fallback": "Consenti il ripiego WARP anonimo sui proxy/connessioni dirette configurati in caso di limiti, blocchi IP o indisponibilità esplicita", "config.secrets.add": "Una chiave per riga", "config.proxy.title": "Nodi proxy", "config.proxy.caption": diff --git a/webui/js/pages/config.js b/webui/js/pages/config.js index 7b504ad..2ed1722 100644 --- a/webui/js/pages/config.js +++ b/webui/js/pages/config.js @@ -95,6 +95,7 @@ function fillConfig(value) { $("#c-keys-direct").checked = !!value.keys_direct; const warp = value.warp || {}; $("#c-warp-enabled").checked = !!warp.enabled; + $("#c-warp-fallback").checked = !!warp.proxy_fallback; $("#c-warp-pool").value = warp.pool_size || 2; $("#c-warp-stack").value = warp.stack || "ipv6"; $("#c-warp-source").value = warp.source_ipv6 || ""; @@ -165,6 +166,7 @@ async function save(event) { keys_direct: $("#c-keys-direct").checked, warp: { enabled: $("#c-warp-enabled").checked, + proxy_fallback: $("#c-warp-fallback").checked, pool_size: numberValue("#c-warp-pool"), stack: $("#c-warp-stack").value, source_ipv6: $("#c-warp-source").value.trim(),