Conversation
Contributor
|
All contributors have signed the CLA. ✅ |
tianhao98
force-pushed
the
feat/zhipu-native-responses
branch
from
September 19, 2026 15:42
cda81f9 to
aff108c
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
GLM Coding Plan provides a native Responses endpoint at
https://open.bigmodel.cn/api/v1, but Sub2API excludes Zhipu from native Responses capabilities. Responses requests on adaptive accounts are therefore converted to Chat Completions, and explicitapi_protocol=responsesis not available for these accounts.This adds native Responses support for Zhipu Coding Plan in both Adaptive and Responses modes, using the existing JSON/SSE forwarding path. Adaptive accounts route Responses, Chat Completions, and Anthropic requests to their respective native endpoints. The create/edit forms show all three URLs, populate the dedicated Responses default, and preserve custom endpoints on save. No additional switch or protocol conversion is introduced for native Responses requests.
Existing Coding Plan adaptive accounts without
api_base_urls.responsesuse the official default automatically. This changes their Responses routing from the Chat bridge to the native endpoint without requiring a database migration. Selecting Chat Completions explicitly retains the conversion path. Pay-as-you-go accounts do not advertise native Responses.Native routing and account tests take precedence over stale negative probe metadata. Zhipu requests do not inherit the DeepSeek/Kimi-specific rewriting of
storeandprevious_response_id.Reference: Zhipu's official Codex / GLM Coding Plan guide. Configuration and compatibility notes are in
docs/ZHIPU_RESPONSES.md.Validation
golangci-lint v2.13.0 run --timeout=5m ./...: 0 issues.Targeted backend Zhipu/protocol/probe/adaptive regression tests passed.
Full backend unit run:
go test -tags=unit ./... -skip TestValidateCreateParams_CheckModeMatrix/probe_requires_api_key. All packages exceptinternal/repositorypassed, including the fullinternal/servicesuite. The only new run failure was the existing timing-sensitiveTestServerTimingConnectorRecordsDriverCallsWithoutRowLifetime; it passed on isolated rerun. The skipped channel-monitor validation subtest was previously reproduced failing on unchanged upstream1a9d49e16because of local private-address resolution.Frontend account/preset tests: 111 passed;
make test-frontendwith pnpm 9 passed lint, typecheck, and 227 critical tests.Frontend account/preset regression tests cover the adaptive Responses field, custom URLs, create/edit round trips, and Coding Plan/pay-as-you-go transitions.
Backend regression coverage includes adaptive and explicit native routing, legacy accounts with missing Responses URLs, custom URLs, JSON/SSE forwarding, tool-result history, token usage, stale probes, unchanged native Chat routing, and all three account-test endpoints.
Live upstream smoke checks with
glm-5.3: HTTP 200 streamingresponse.completed; a forced function call followed by a client-suppliedfunction_call_outputcompleted successfully. No real tool was executed. These validate the upstream contract separately from the mocked gateway tests.This PR does not establish support for every GLM model, WebSocket transport,
/responses/compact, hosted tools, or server-managed conversation storage. Docker-backed integration tests were not run locally because Docker is unavailable.