-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(zai): default to the Responses protocol and keep Chat as a per-model opt-in #4307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,7 +454,7 @@ routing or defaults changes. | |
| | Moonshot (Kimi API) · Kimi (coding) | `https://api.moonshot.ai/v1` · `https://api.kimi.com/coding/v1` | | ||
| | Hugging Face | `https://router.huggingface.co/v1` | | ||
| | NVIDIA NIM | `https://integrate.api.nvidia.com/v1` | | ||
| | Z.AI (GLM Coding) | `https://api.z.ai/api/coding/paas/v4` | | ||
| | Z.AI (GLM Coding) | `https://api.z.ai` — Responses at `/api/v1/responses` by default; Chat Completions at `/api/coding/paas/v4/chat/completions` per model through `modelAdapters` | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After this row changes Z.AI to Responses by default, the translated provider guides still advertise the legacy Chat-only URL (for example AGENTS.md reference: docs-site/AGENTS.md:L9-L10 Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 19517 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- English provider entry ---'
sed -n '448,464p' docs-site/src/content/docs/guides/providers.md
printf '%s\n' '--- Translated provider references ---'
files="$(fd -t f -i '\.md$' docs-site | rg '/(ja|ko|ru|zh-cn)/' || true)"
if [ -n "$files" ]; then
printf '%s\n' "$files" | xargs -r rg -n -i -C 2 'z\.ai|/api/coding/paas/v4|/api/v1/responses|modelAdapters'
else
printf '%s\n' 'No matching translated Markdown files found.'
fiRepository: lidge-jun/opencodex Length of output: 22431 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- English provider entry ---'
sed -n '448,464p' docs-site/src/content/docs/guides/providers.md
printf '%s\n' '--- Translated provider references ---'
files="$(fd -t f -i '\.md$' docs-site | rg '/(ja|ko|ru|zh-cn)/' || true)"
if [ -n "$files" ]; then
printf '%s\n' "$files" | xargs -r rg -n -i -C 2 'z\.ai|/api/coding/paas/v4|/api/v1/responses|modelAdapters'
else
printf '%s\n' 'No matching translated Markdown files found.'
fiRepository: lidge-jun/opencodex Length of output: 22431 Synchronize Z.AI routing and migration guidance across provider pages.
🤖 Prompt for AI AgentsSource: Path instructions |
||
| | Zhipu AI (BigModel) | `https://open.bigmodel.cn/api/paas/v4` | | ||
| | BigModel Coding Plan (Responses, static roster) | `https://open.bigmodel.cn/api/v1` | | ||
| | Qwen Cloud | Token plan (default): `https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1` · Pay as you go: `https://dashscope.aliyuncs.com/compatible-mode/v1` · or Custom | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -602,6 +602,7 @@ const providerConfigSchema = z.object({ | |
| mcpMaxResultBytes: z.number().int().positive().optional(), | ||
| apiKeyTransport: z.enum(["x-api-key", "bearer"]).optional(), | ||
| responsesPath: z.string().min(1).optional(), | ||
| chatCompletionsPath: z.string().min(1).optional(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a client creates a provider through Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This changes the configuration contract in AGENTS.md reference: src/AGENTS.md:L11-L11 Useful? React with 👍 / 👎. |
||
| statelessResponses: z.boolean().optional(), | ||
| requiresAdjacentResponsesToolResults: z.boolean().optional(), | ||
| annotateEmptyToolOutputs: z.boolean().optional(), | ||
|
|
@@ -674,14 +675,18 @@ export { | |
| upstreamHttpVersionConfigError, | ||
| } from "./config/provider-validation"; | ||
|
|
||
| function providerResponsesPathConfigError(responsesPath: string | undefined): string | null { | ||
| if (responsesPath === undefined) return null; | ||
| if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(responsesPath) || responsesPath.includes("://")) { | ||
| return "responsesPath must be a relative path without a URL scheme"; | ||
| /** | ||
| * Shared shape check for the two relative send-path overrides. `field` names the | ||
| * offending key so the message stays specific to what the user actually wrote. | ||
| */ | ||
| function providerRelativeSendPathConfigError(field: string, value: string | undefined): string | null { | ||
| if (value === undefined) return null; | ||
| if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(value) || value.includes("://")) { | ||
| return `${field} must be a relative path without a URL scheme`; | ||
| } | ||
| if (!responsesPath.startsWith("/")) return "responsesPath must start with /"; | ||
| if (responsesPath.includes("?") || responsesPath.includes("#")) { | ||
| return "responsesPath must not include query strings or fragments"; | ||
| if (!value.startsWith("/")) return `${field} must start with /`; | ||
| if (value.includes("?") || value.includes("#")) { | ||
| return `${field} must not include query strings or fragments`; | ||
| } | ||
| return null; | ||
| } | ||
|
|
@@ -1450,13 +1455,15 @@ const configSchema = z.object({ | |
| }); | ||
| } | ||
| } | ||
| const responsesPathError = providerResponsesPathConfigError(provider.responsesPath); | ||
| if (responsesPathError) { | ||
| ctx.addIssue({ | ||
| code: "custom", | ||
| path: ["providers", redactSecretString(name), "responsesPath"], | ||
| message: responsesPathError, | ||
| }); | ||
| for (const field of ["responsesPath", "chatCompletionsPath"] as const) { | ||
| const sendPathError = providerRelativeSendPathConfigError(field, provider[field]); | ||
| if (sendPathError) { | ||
| ctx.addIssue({ | ||
| code: "custom", | ||
| path: ["providers", redactSecretString(name), field], | ||
| message: sendPathError, | ||
| }); | ||
| } | ||
| } | ||
| const headersError = providerHeadersConfigError((provider as { headers?: unknown }).headers); | ||
| if (headersError) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the future-dated probe record.
Line 139 states that testing occurred on September 12, 2026. The current date is September 11, 2026. Use the actual probe date, or mark this as planned validation until the probe completes.
🤖 Prompt for AI Agents