feat: proper Z.AI implementation — dual OpenAI+Anthropic endpoints, plan separation (general + Coding Plan), regions (global/cn) - #49
Merged
Conversation
…OpenAI+Anthropic) - New internal/config/zai_setup.go and cmd/chat_config_zai.go (region picker global/cn, Needs/Set/Apply, modeled 1:1 on xiaomi) - Wire region flow, 'g' hotkey hints, Apply env, display labels, key paste pre-steps into chat_config_* (gateways, keys, panel, deployment) - catalog_api.go alias support for z-ai-coding - catalog_gateways_test.go: 19 gateways (z-ai + z-ai-coding) - chat_model.go: configZAIRegionSel field - Include the full implementation plan doc (docs/plans/z-ai-proper-implementation.md) - Pairs with eyrie commit (catalog/zai/, client/zai.go dual, registry two specs, deployment NewZAIClient for both, fetchers, config fields) Both endpoints (OpenAI primary + Anthropic fallback) + proper plan separation now fully wired in TUI and execution. Per AGENTS.md: feature branch, tests alongside, -race green on relevant pkgs. (Depends on eyrie submodule update from parallel commit in external/eyrie)
…OpenAI+Anthropic)
Patel230
added a commit
that referenced
this pull request
Jun 18, 2026
…lan separation (general + Coding Plan), regions (global/cn) (#49) * feat: hawk Z.AI gateway UI + config bridge for dual plans + regions (OpenAI+Anthropic) - New internal/config/zai_setup.go and cmd/chat_config_zai.go (region picker global/cn, Needs/Set/Apply, modeled 1:1 on xiaomi) - Wire region flow, 'g' hotkey hints, Apply env, display labels, key paste pre-steps into chat_config_* (gateways, keys, panel, deployment) - catalog_api.go alias support for z-ai-coding - catalog_gateways_test.go: 19 gateways (z-ai + z-ai-coding) - chat_model.go: configZAIRegionSel field - Include the full implementation plan doc (docs/plans/z-ai-proper-implementation.md) - Pairs with eyrie commit (catalog/zai/, client/zai.go dual, registry two specs, deployment NewZAIClient for both, fetchers, config fields) Both endpoints (OpenAI primary + Anthropic fallback) + proper plan separation now fully wired in TUI and execution. Per AGENTS.md: feature branch, tests alongside, -race green on relevant pkgs. (Depends on eyrie submodule update from parallel commit in external/eyrie) * feat: hawk Z.AI gateway UI + config bridge for dual plans + regions (OpenAI+Anthropic) * chore(submodules): align eyrie to f3abc3b (Z.AI plan separation) * docs(plans): replace hard tabs with spaces in z-ai-proper-implementation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full proper implementation for Z.AI following the plan in docs/plans/z-ai-proper-implementation.md and the Xiaomi precedent exactly.
z-ai(general pay-as-you-go) +z-ai-coding(GLM Coding Plan subscription). Distinct CredentialEnv (ZAI_API_KEYvsZAI_CODING_API_KEY), LiveFetcherKey, DeploymentID, base defaults.client/zai.go(OpenAI-compat paas/coding primary + Anthropic-compat/api/anthropicfallback on retriable errors, using ProtocolRouter). Same key works for both protocols.catalog/zai/with Plan/Region types + resolvers for global (api.z.ai) and cn (open.bigmodel.cn family) affecting both OpenAI and Anthropic bases. Hawk region picker (global/cn) for Z.AI rows, persisted in provider.json, env injection via ApplyZAIRegionEnv./models(coding path gets the subscription-appropriate list).chat_config_zai.go+zai_setup.go(picker, g hotkey, hints, pre-key region flow, display labels). Fully wired into gateways/keys/panel/deployment flows.Backward compat: Existing
z-ai+ keys + BASE_URL overrides continue to work (now also get the Anthropic fallback benefit). New coding gateway is additive.Verification
go test -race -count=1green for config, gateways, zai package, client, setup.Refs the official Z.AI docs (explicit coding/paas/v4 for Coding Plan + /anthropic compat for Claude Code etc.).
This makes Z.AI first-class and as robust/dynamic/reused as the rest of the 19 gateways.
(eyrie side committed in parallel in external/eyrie on its feature branch; root records the submodule advance.)