Skip to content

Add glm-5.2 and deepseek-v4-flash to chat - #4

Merged
amaan-ai20 merged 1 commit into
mainfrom
feat/new-models-glm-deepseek
Jul 29, 2026
Merged

Add glm-5.2 and deepseek-v4-flash to chat#4
amaan-ai20 merged 1 commit into
mainfrom
feat/new-models-glm-deepseek

Conversation

@amaan-ai20

@amaan-ai20 amaan-ai20 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

The docs catalog gained two open-weight text-generation models in docs#19 — Z.ai's glm-5.2 and DeepSeek's deepseek-v4-flash. Neither was reachable from the CLI: CHAT_MODELS is a closed allowlist, so -m glm-5.2 exited 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.

Model Params Context $/1M in $/1M out
glm-5.2 753B MoE 1,048,576 $1.10 $3.50
deepseek-v4-flash 284B MoE (13B active) 1,048,576 $0.07 $0.14

Changes

  • src/commands/chat.ts — both models added to CHAT_MODELS as "chat-completions". That one map is also the --help text and the unknown-model error, so those update for free.
  • src/lib/savings.ts — both added to ZGPU_PRICING. Load-bearing for glm-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.tsfixed a stale invariant. ZGPU_FALLBACK was {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 moment glm-5.2 published. It now tracks glm-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.
  • Docs: README.md, docs/DOCUMENTATION.md, docs/ADDING_COMMANDS.md — six places said qwen3 was the only Chat-Completions model.

⚠️ Two things to know before merging

1. This needs a release to reach anyone. package.json is still 3.2.0, but the already-merged #3 (which added chat --model itself) is also unreleased. Worse, zerogpu-router's shipped claude 2.0.0 / openclaw 4.0.0 changelogs already tell users they require zerogpu-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-flash is documented but not yet served. Verified against the live API:

  • glm-5.2 → answers correctly ✅
  • deepseek-v4-flash → consistent 404 {"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 lint passes
  • npm test passes (38 tests)
  • npm run build succeeds
  • Documentation updated

Verified from the build: --help lists both models, -m nope still exits 1, and -m qwen3-30b-a3b-fp8 / -m gpt-oss-120b still work as controls.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for glm-5.2 and deepseek-v4-flash in chat mode.
    • Added routing for these models through the Chat Completions API.
    • Added token pricing and savings calculations for the new models.
  • Documentation

    • Expanded model lists, usage examples, routing details, and API guidance.
  • Tests

    • Added coverage ensuring fallback savings estimates remain appropriately bounded.

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>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added glm-5.2 and deepseek-v4-flash as Chat Completions-only models, updated related documentation and examples, and added their ZeroGPU pricing. Unknown-model fallback pricing and savings tests were also updated.

Changes

Chat model support

Layer / File(s) Summary
Model routing and documentation
src/commands/chat.ts, README.md, docs/...
Adds Chat Completions routing for both models and updates model lists, endpoint notes, usage documentation, and examples.
Savings pricing and validation
src/lib/savings.ts, tests/savings.test.ts
Adds model-specific token rates, changes fallback rates, and verifies unknown-model savings against known models.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • zerogpu/cli#3: Updates the same chat routing and ZeroGPU savings areas.

Poem

A rabbit hops through models bright,
Chat Completions guide the flight.
New rates sparkle, fallbacks mend,
Savings tests now round the bend.
Two speedy models join the queue! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change by naming both models added to chat support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/new-models-glm-deepseek

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@amaan-ai20
amaan-ai20 merged commit 45d8e6f into main Jul 29, 2026
1 of 2 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ec02528 and abc632c.

📒 Files selected for processing (6)
  • README.md
  • docs/ADDING_COMMANDS.md
  • docs/DOCUMENTATION.md
  • src/commands/chat.ts
  • src/lib/savings.ts
  • tests/savings.test.ts

Comment thread src/commands/chat.ts
Comment on lines 23 to +29
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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 || true

Repository: 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:


🌐 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:


🌐 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:


🌐 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, and docs/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-L142
  • README.md#L157-L160
  • docs/DOCUMENTATION.md#L8-L8
  • docs/DOCUMENTATION.md#L212-L215
  • docs/DOCUMENTATION.md#L685-L685
  • docs/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.

Comment thread tests/savings.test.ts
Comment on lines +87 to +102
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,
);
}
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

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