Add Z.ai provider and optional API key for openai-compatible endpoints - #2016
Open
moa234-SK wants to merge 3 commits into
Open
Add Z.ai provider and optional API key for openai-compatible endpoints#2016moa234-SK wants to merge 3 commits into
moa234-SK wants to merge 3 commits into
Conversation
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
This PR makes openai-compatible endpoints reach hosted services. It adds a dedicated Z.ai provider, optional API-key authentication, and version-aware model-listing paths.
What changed
1. Dedicated
zaiprovider (a93b45f)zaiprovider type. It targetshttps://api.z.ai/api/coding/paas/v4and serves the GLM models.ZaiThinkingdialect.OpenAiCompatibleEndpoint.FromBaseUrlnow detects a trailing version segment. A base like.../v4no longer gets another/v1appended.2. Optional API key for
openai-compatible(0d1e703)EndpointOrApiKeyAuthshape declares two methods:NoneandApiKey.Nonestays the default, so local endpoints behave as before.ApiKeypath adds an endpoint step and a required key step before the probe.ApiKeyentry without a stored key is blocked before persistence.AuthMethod: ApiKeybut secrets.json stores no key.ENC:). The netclaw-operations skill documents the new flow (version 2.57.0).3. Version-aware probe path (989084c)
OpenAiCompatibleDescriptor.ProbeAsyncresolves the listing path through the newOpenAiCompatibleEndpoint.RelativeModelsPath.<base>/models. An unversioned base probes<base>/v1/models.api.z.ai/api/coding/paas/v4andinference.hetzner.com/api.Why
Operators could not add hosted keyed OpenAI-compatible endpoints before. The generic type only served local no-auth endpoints. The dedicated Z.ai type covers its reasoning dialect; the generic type covers LiteLLM, Hetzner, and other gateways.
Testing
OpenAiCompatibleAuthTests(23 tests, with a headless typed-key end-to-end flow), 2 doctor tests,ZaiProviderTests(240 lines), and endpoint path tests.run-evals.sh(needs eval credentials) and native smoke (Linux-only harness).OpenSpec
openspec/changes/add-zai-provider/— artifacts included, complete.openspec/changes/add-openai-compatible-auth/— artifacts included, complete; sync and archive after merge.