Skip to content

feat(zhipu): support native Responses in adaptive Coding Plan accounts - #7383

Open
tianhao98 wants to merge 2 commits into
Wei-Shaw:mainfrom
tianhao98:feat/zhipu-native-responses
Open

tianhao98 wants to merge 2 commits into
Wei-Shaw:mainfrom
tianhao98:feat/zhipu-native-responses

Conversation

@tianhao98

@tianhao98 tianhao98 commented Sep 19, 2026

Copy link
Copy Markdown

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 explicit api_protocol=responses is 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.responses use 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 store and previous_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 except internal/repository passed, including the full internal/service suite. The only new run failure was the existing timing-sensitive TestServerTimingConnectorRecordsDriverCallsWithoutRowLifetime; it passed on isolated rerun. The skipped channel-monitor validation subtest was previously reproduced failing on unchanged upstream 1a9d49e16 because of local private-address resolution.

  • Frontend account/preset tests: 111 passed; make test-frontend with 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 streaming response.completed; a forced function call followed by a client-supplied function_call_output completed 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.

@github-actions

github-actions Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@tianhao98
tianhao98 force-pushed the feat/zhipu-native-responses branch from cda81f9 to aff108c Compare September 19, 2026 15:42
@tianhao98

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Sep 19, 2026
@tianhao98 tianhao98 changed the title feat(zhipu): add opt-in native Responses for Coding Plan feat(zhipu): support native Responses in adaptive Coding Plan accounts Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant