Add glm-5.2 and deepseek-v4-flash to chat - #4
Conversation
The docs catalog gained two open-weight text-generation models
(docs PR #19): Z.ai's glm-5.2 and DeepSeek's deepseek-v4-flash, both
753B / 284B MoE with a 1,048,576-token context, and both served only
on Chat Completions.
CHAT_MODELS is the allowlist, the endpoint router, the --help text and
the unknown-model error all at once, so both models needed one entry
each there; the Chat Completions branch already existed for
qwen3-30b-a3b-fp8 and needed no changes.
Both models are also added to ZGPU_PRICING. That matters more than
usual for glm-5.2: at $1.10 / $3.50 per 1M it is roughly 22x the input
and 12x the output rate of the edge models, so pricing it off the
fallback would have understated its cost substantially.
That same gap made ZGPU_FALLBACK wrong. It was {0.05, 0.30} and
documented as "the priciest published rate, so an unlisted model never
overstates savings" - true when qwen3 was the ceiling, false once
glm-5.2 published. It now tracks glm-5.2, and a new test asserts the
invariant directly rather than restating one model's numbers, so the
next model to top the price list fails a test instead of silently
inflating reported savings.
Verified against the live API: glm-5.2 answers correctly. deepseek-v4-flash
returns 404 model_not_found - it is documented but not yet served, so
this entry is ready for when the platform enables it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded ChangesChat model support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/chat.ts`:
- Around line 23-29: Delay exposure of deepseek-v4-flash until the ZeroGPU Chat
Completions endpoint supports it: remove or availability-gate that entry in
CHAT_MODELS, and update README.md (141-142, 157-160), docs/DOCUMENTATION.md (8,
212-215, 685), and docs/ADDING_COMMANDS.md (10) to remove the model or clearly
mark it unavailable/gated.
In `@tests/savings.test.ts`:
- Around line 87-102: Update the test around computeCallSavings to iterate over
every model identifier in ZGPU_PRICING, or the shared exported model list,
instead of the hard-coded five-model array. Preserve the existing unknown-model
savings comparison and ensure newly added priced models are included
automatically.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cd508d6a-609b-458d-99eb-418e173da21f
📒 Files selected for processing (6)
README.mddocs/ADDING_COMMANDS.mddocs/DOCUMENTATION.mdsrc/commands/chat.tssrc/lib/savings.tstests/savings.test.ts
| const CHAT_MODELS: Record<string, "responses" | "chat-completions"> = { | ||
| "LFM2.5-1.2B-Instruct": "responses", | ||
| "LFM2.5-1.2B-Thinking": "responses", | ||
| "gpt-oss-120b": "responses", | ||
| "qwen3-30b-a3b-fp8": "chat-completions", | ||
| "glm-5.2": "chat-completions", | ||
| "deepseek-v4-flash": "chat-completions", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files of interest =="
git ls-files | rg '(^src/commands/chat\.ts$|^README\.md$|^docs/(DOCUMENTATION|ADDING_COMMANDS)\.md$)' || true
echo
echo "== src/commands/chat.ts context =="
if [ -f src/commands/chat.ts ]; then
sed -n '1,80p' src/commands/chat.ts | cat -n
fi
echo
echo "== occurrences of deepseek-v4-flash =="
rg -n "deepseek-v4-flash|qwen3-30b-a3b-fp8|glm-5\.2|chat-completions|responses" README.md docs src/commands/chat.ts 2>/dev/null || true
echo
echo "== local references to ZEROGPU/_CHAT_MODELS =="
rg -n "CHAT_MODELS|model.*chat|chatCompletions|toResponsesUsage" src README.md docs 2>/dev/null || trueRepository: zerogpu/cli
Length of output: 10132
🌐 Web query:
ZeroGPU chat Completions model deepseek-v4-flash API model_not_found
💡 Result:
The error model_not_found when using deepseek-v4-flash is likely occurring because the legacy API aliases deepseek-chat and deepseek-reasoner were officially retired on July 24, 2026 [1][2][3]. If your application or SDK is still configured to use the retired aliases, or if it is attempting to access a model ID that is not supported by your specific provider, you will receive this error [2][4]. To resolve this: 1. Update your code: Ensure you are explicitly using the model ID deepseek-v4-flash (or deepseek-v4-pro) in your API request, rather than any older identifiers [5][6][7]. 2. Verify your provider: If you are using a third-party API provider (e.g., OpenRouter, Together AI, etc.) instead of the official DeepSeek API, check their documentation for the correct model slug [4][8]. Third-party providers often require their own naming conventions, such as deepseek/deepseek-v4-flash or deepseek-ai/DeepSeek-V4-Flash [4][8]. 3. Check Base URL: Ensure your base_url is set correctly for your provider [7][4]. ZeroGPU (an infrastructure company) is distinct from the official DeepSeek API platform [9][10][7]. If you are using services via ZeroGPU or a similar third-party platform, verify that they currently support the DeepSeek V4 model family, as model availability can vary between providers [4].
Citations:
- 1: https://www.scriptbyai.com/deepseek-timeline-release-dates/
- 2: https://dev.to/lu1tr0n/deepseek-v4-pro-y-flash-api-compatible-con-openai-y-anthropic-3j24
- 3: https://api-docs.deepseek.com/news/news260424/
- 4: https://codepick.dev/en/guides/deepseek-v4-api-platforms/
- 5: https://deepseek-espanol.chat/guide/deepseek-v4-vs-v3-2-migracion/
- 6: https://wavespeed.ai/blog/es/posts/blog-deepseek-v4-model-name-migration/
- 7: https://api-docs.deepseek.com/
- 8: https://openrouter.ai/deepseek/deepseek-v4-flash
- 9: https://zerogpu.ai/careers
- 10: https://medium.com/@ZeroGPU-AI
🌐 Web query:
"api.zerogpu.ai/v1/chat/completions" "deepseek-v4-flash"
💡 Result:
The endpoint api.zerogpu.ai/v1/chat/completions is a valid REST API endpoint provided by the ZeroGPU platform for model inference [1][2]. Regarding your query for deepseek-v4-flash: 1. ZeroGPU provides a generic API structure for chat completions [2]. You can access various models through this endpoint by specifying the model name in your request body [1][3]. 2. DeepSeek-V4-Flash is a real, high-performance Mixture-of-Experts (MoE) language model released by DeepSeek-AI in April 2026 [4][5][6]. It features 284 billion total parameters (13 billion activated) and supports a 1 million token context window [4][5][6]. 3. While DeepSeek-V4-Flash is available through multiple inference providers [7], you should verify if it is currently listed in the specific ZeroGPU model catalog via their documentation or dashboard [1][3]. If supported, you would typically integrate it by setting the model parameter to "deepseek-v4-flash" (or the provider-specific canonical ID) within the JSON payload of a POST request to the aforementioned endpoint, while ensuring the required x-api-key and x-project-id headers are included [3][8][9]. For exact usage, refer to the official ZeroGPU API documentation at https://docs.zerogpu.ai [1][3].
Citations:
- 1: https://docs.zerogpu.ai/api-reference/introduction
- 2: https://docs.zerogpu.ai/api-reference/chat-completions
- 3: https://docs.zerogpu.ai/
- 4: https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash
- 5: https://www.alphaxiv.org/abs/2604.deepseek-v4
- 6: https://ai-tldr.dev/models/deepseek-v4-flash/
- 7: https://vercel.com/ai-gateway/models/deepseek-v4-flash
- 8: https://docs.zerogpu.ai/platform/authentication
- 9: https://docs.zerogpu.ai/docs/platform
🌐 Web query:
"model_not_found" "deepseek-v4-flash" ZeroGPU
💡 Result:
The error model_not_found related to deepseek-v4-flash and ZeroGPU typically arises from two distinct issues: the recent retirement of legacy DeepSeek model aliases or incorrect model identifier formatting in your API request [1][2][3]. 1. Legacy Model Retirement: As of July 24, 2026, the legacy model aliases deepseek-chat and deepseek-reasoner have been fully retired [4][2][5]. If your application was using these identifiers, it will now return a model_not_found error [1][4][2]. You must update your configuration to use the explicit model IDs: deepseek-v4-flash (for non-thinking/standard workflows) or deepseek-v4-pro (for advanced reasoning/agentic tasks) [4][2][5]. 2. API Formatting and Provider Routing: If you are using an API aggregator (such as OpenRouter) or a specific integration library (like openclaw or similar), the model_not_found error often occurs due to incorrect prefixing or double-encoding of the model ID [6]. For example, if your code incorrectly sends a request formatted as openrouter/openrouter/deepseek-v4-flash, the gateway may fail to resolve the model name [6]. Ensure you are using the canonical model ID format required by your specific provider [6][7]. 3. ZeroGPU Specific Context: If you are encountering this within a Hugging Face Space using ZeroGPU, be aware that the error might be a generic wrapper response [8][9]. ZeroGPU environments often use custom decorators (like @spaces.GPU) that can swallow detailed error messages [9]. If the model is correctly referenced but fails to load, ensure you are not hitting environmental constraints (e.g., storage limits or transient worker failures) and verify the model ID is explicitly supported by the API client you are using inside the GPU-decorated function [8][3][10]. To resolve: - Update all references from deepseek-chat or deepseek-reasoner to deepseek-v4-flash [1][4][2]. - Audit your API call configuration to ensure no redundant provider prefixes (e.g., openrouter/openrouter/) are being added [6]. - If using ZeroGPU, check your application logs specifically for storage or initialization errors that might be masked by the generic model_not_found message [8][10].
Citations:
- 1: https://deepseekai.guide/tutorials/deepseek-with-llamaindex/
- 2: https://deepseekai.guide/tutorials/deepseek-python-integration/
- 3: https://docs.zerogpu.ai/docs/batch/errors
- 4: https://docs.avalai.ir/en/deprecations?id=important-note-on-model-naming
- 5: https://api-docs.deepseek.com/news/news260424/
- 6: Bug: OpenRouter model prefix duplicated when using short model IDs (openrouter/deepseek-v4-flash → openrouter/openrouter/deepseek-v4-flash) openclaw/openclaw#95198
- 7: https://openrouter.ai/deepseek/deepseek-v4-flash
- 8: https://huggingface.co/spaces/pliny-the-prompter/obliteratus/commit/d169612c0d9c4296351bd97cfae46bf80861745f
- 9: TribeModel.from_pretrained fails with FileNotFoundError on HuggingFace ZeroGPU Spaces facebookresearch/tribev2#24
- 10: https://huggingface.co/datasets/John6666/knowledge_base_md_for_rag_1/blob/main/hf_spaces_debug_zerogpu_20251203.md
🌐 Web query:
site:docs.zerogpu.ai "deepseek-v4-flash"
💡 Result:
As of July 29, 2026, deepseek-v4-flash is a model available through the official DeepSeek API [1][2]. It is listed alongside deepseek-v4-pro in the DeepSeek API documentation, which utilizes an API format compatible with OpenAI and Anthropic standards [1][2]. Users can access this model by configuring their requests to point to the DeepSeek API base URL [1][2].
Citations:
Delay exposing deepseek-v4-flash until the ZeroGPU Chat Completions endpoint supports it. The CLI allowlist makes model --model deepseek-v4-flash selectable, but the current ZeroGPU Chat Completions request returns 404 model_not_found, while all docs present it as live.
src/commands/chat.ts#L23-L29: remove the model or gate it behind availability.README.md#L142,README.md#L158-L160,docs/DOCUMENTATION.md#L8,docs/DOCUMENTATION.md#L212-L215,docs/DOCUMENTATION.md#L685, anddocs/ADDING_COMMANDS.md#L10: remove or clearly mark these unavailable or gated references.
📍 Affects 4 files
src/commands/chat.ts#L23-L29(this comment)README.md#L141-L142README.md#L157-L160docs/DOCUMENTATION.md#L8-L8docs/DOCUMENTATION.md#L212-L215docs/DOCUMENTATION.md#L685-L685docs/ADDING_COMMANDS.md#L10-L10
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/commands/chat.ts` around lines 23 - 29, Delay exposure of
deepseek-v4-flash until the ZeroGPU Chat Completions endpoint supports it:
remove or availability-gate that entry in CHAT_MODELS, and update README.md
(141-142, 157-160), docs/DOCUMENTATION.md (8, 212-215, 685), and
docs/ADDING_COMMANDS.md (10) to remove the model or clearly mark it
unavailable/gated.
| it("never overstates savings for an unknown model", () => { | ||
| // The fallback must be at least as dear as every listed model, so an | ||
| // unlisted id can only ever under-report what was saved. | ||
| const unknown = computeCallSavings(740, 280, "claude-opus-4-8", "some-new-zgpu-model").savingsUsd; | ||
| for (const model of [ | ||
| "gpt-oss-120b", | ||
| "qwen3-30b-a3b-fp8", | ||
| "glm-5.2", | ||
| "deepseek-v4-flash", | ||
| "LFM2.5-1.2B-Instruct", | ||
| ]) { | ||
| expect(unknown).toBeLessThanOrEqual( | ||
| computeCallSavings(740, 280, "claude-opus-4-8", model).savingsUsd, | ||
| ); | ||
| } | ||
| }); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Check every priced model, not a hand-picked subset.
The test claims the fallback never overstates savings for every listed model, but it only enumerates five IDs. Iterate over all ZGPU_PRICING keys, or a shared exported model list, so newly added or omitted high-priced models cannot bypass this invariant.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/savings.test.ts` around lines 87 - 102, Update the test around
computeCallSavings to iterate over every model identifier in ZGPU_PRICING, or
the shared exported model list, instead of the hard-coded five-model array.
Preserve the existing unknown-model savings comparison and ensure newly added
priced models are included automatically.
Summary
The docs catalog gained two open-weight text-generation models in docs#19 — Z.ai's
glm-5.2and DeepSeek'sdeepseek-v4-flash. Neither was reachable from the CLI:CHAT_MODELSis a closed allowlist, so-m glm-5.2exited 1 before any network call.Both are Chat-Completions-only, exactly like
qwen3-30b-a3b-fp8, so the existing routing branch handles them and no new plumbing was needed.glm-5.2deepseek-v4-flashChanges
src/commands/chat.ts— both models added toCHAT_MODELSas"chat-completions". That one map is also the--helptext and the unknown-model error, so those update for free.src/lib/savings.ts— both added toZGPU_PRICING. Load-bearing forglm-5.2: at ~22x the input and ~12x the output rate of the edge models, pricing it off the fallback would have understated its cost badly.src/lib/savings.ts— fixed a stale invariant.ZGPU_FALLBACKwas{0.05, 0.30}, documented as "the priciest published rate, so an unlisted model never overstates savings". That was true when qwen3 was the ceiling and false the momentglm-5.2published. It now tracksglm-5.2.tests/savings.test.ts— the fallback test restated qwen3's numbers as its premise. It now asserts the invariant itself (fallback ≥ every listed model), so the next model to top the price list fails a test rather than silently inflating reported savings.README.md,docs/DOCUMENTATION.md,docs/ADDING_COMMANDS.md— six places said qwen3 was the only Chat-Completions model.1. This needs a release to reach anyone.
package.jsonis still3.2.0, but the already-merged #3 (which addedchat --modelitself) is also unreleased. Worse,zerogpu-router's shipped claude 2.0.0 / openclaw 4.0.0 changelogs already tell users they requirezerogpu-cli >= 3.3.0— a version that does not exist on npm. That release is already overdue; these two models ride along in it.npm run release:minor(3.2.0 → 3.3.0).2.
deepseek-v4-flashis documented but not yet served. Verified against the live API:glm-5.2→ answers correctly ✅deepseek-v4-flash→ consistent404 {"code":"model_not_found"}across repeated attempts ❌The entry here is correct per the published catalog and will work the moment the platform enables the model, but it will fail for users until then. Worth confirming with whoever owns the model rollout whether the docs page landed ahead of the deployment.
Checklist
npm run lintpassesnpm testpasses (38 tests)npm run buildsucceedsVerified from the build:
--helplists both models,-m nopestill exits 1, and-m qwen3-30b-a3b-fp8/-m gpt-oss-120bstill work as controls.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
glm-5.2anddeepseek-v4-flashin chat mode.Documentation
Tests