Skip to content

fix(zai): add provider and current model catalog - #37433

Open
ExDevilLee wants to merge 2 commits into
BerriAI:litellm_internal_stagingfrom
ExDevilLee:litellm_fix_zai_provider_dropdown
Open

fix(zai): add provider and current model catalog#37433
ExDevilLee wants to merge 2 commits into
BerriAI:litellm_internal_stagingfrom
ExDevilLee:litellm_fix_zai_provider_dropdown

Conversation

@ExDevilLee

@ExDevilLee ExDevilLee commented Aug 19, 2026

Copy link
Copy Markdown

TLDR

Fixes the Z.AI dashboard onboarding path and brings the bundled Z.AI catalog up to the current documented models.

  • Adds Z.AI to the Add Model provider catalog.
  • Lets provider search match the LiteLLM slug zai as well as the display name.
  • Adds the six current Z.AI models missing from the model cost map: glm-5.3, glm-5.2, glm-5-turbo, glm-5v-turbo, glm-4.7-flashx, and glm-4.6v.
  • Keeps model_prices_and_context_window.json and the bundled backup map in sync.

The Z.AI provider uses the OpenAI-compatible base URL https://api.z.ai/api/paas/v4.

User Flow

Before:

  1. A proxy admin opens Add Model and searches for zai or z.ai.
  2. The provider dropdown returns no result, so no Z.AI credentials or model choices can be configured.

After:

  1. The same admin searches for zai or z.ai and selects Z.AI.
  2. The form shows the API key field and default Z.AI API base.
  3. The model selector includes the current Z.AI models, including GLM-5.3, GLM-5.2, GLM-5-Turbo, GLM-5V-Turbo, GLM-4.7-FlashX, and GLM-4.6V.

Root Cause

LiteLLM supported the zai provider in the SDK and had existing Z.AI metadata, but the dashboard provider-creation catalog omitted it. The catalog also lagged the current Z.AI model list.

Relevant Issues

Fixes #25482

Supersedes the stale unmerged implementation in #25485.

The existing provider-name mapping from #26419 is retained.

Validation

  • python3 -m json.tool model_prices_and_context_window.json
  • Verified the canonical and bundled backup maps are byte-identical.
  • Added tests/test_litellm/test_zai_model_metadata.py, which asserts the documented 15-model Z.AI subset and exact metadata for the six newly catalogued models.
  • npm run test -- --run src/components/add_model/AddModelForm.test.tsx passes: 13 tests.
  • In a local Admin UI running against the proposed bundled catalog, GET /public/litellm_model_cost_map exposes all six new model IDs and the Add Model selector shows all six, including search results for zai/glm-4.7-flashx and zai/glm-4.6v.

CI Note

The earlier misc failure in run 32214763016 is unrelated to this PR's original changes. It failed tests/test_litellm/batches/test_batch_utils.py::test_handle_completed_vertex_batch_computes_cost_usage_and_models, where a Vertex batch cost expectation was double the observed value. This PR did not change batch code, Vertex code, or the model cost map in that run. The new push should receive a fresh CI result.

Pre-Submission Checklist

  • I have added meaningful tests.
  • My PR passes all CI/CD checks.
  • My PR's scope is isolated to Z.AI dashboard onboarding and catalog metadata.
  • I have received a Greptile Confidence Score of at least 4/5 before requesting maintainer review.

Type

Bug Fix

Caveats

  • The focused Python test requires the full LiteLLM Python dependency set, which is unavailable in this local worktree. The JSON, bundled-map consistency, runtime API, and UI flows were verified locally; GitHub CI will run the Python test.
  • A full local Docker image build requires the Docker buildx plugin.

Final Attestation

  • The tests check the right things, including edge cases and real-world customer regressions.

@CLAassistant

CLAassistant commented Aug 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing ExDevilLee:litellm_fix_zai_provider_dropdown (d4f2c64) with litellm_internal_staging (47a7e17)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (5290150) during the generation of this report, so 47a7e17 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ExDevilLee ExDevilLee changed the title fix(ui): add Z.AI provider to Add Model fix(zai): add provider and current model catalog Aug 19, 2026
@ExDevilLee
ExDevilLee force-pushed the litellm_fix_zai_provider_dropdown branch from 8734ea5 to 4c617b6 Compare August 19, 2026 07:37
@ExDevilLee
ExDevilLee marked this pull request as ready for review August 19, 2026 08:22
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Z.AI to the dashboard provider catalog and makes provider search match LiteLLM slugs. Updates both bundled model maps with six Z.AI models and adds focused catalog, endpoint, and UI regression coverage

Confidence Score: 5/5

The PR appears safe to merge, with the catalog, provider identity normalization, and search behavior remaining consistent across the changed paths

The new provider record validates against the existing endpoint contract, both save and connection-test paths normalize ZAI to the runtime slug, and the model catalogs remain synchronized

Important Files Changed

Filename Overview
litellm/proxy/public_endpoints/provider_create_fields.json Adds a schema-compatible Z.AI provider record whose identifiers, API base, and model placeholder align with existing runtime configuration
ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx Extends provider search labels with the required LiteLLM provider slug without changing selection or displayed-label behavior
model_prices_and_context_window.json Adds six internally consistent Z.AI pricing and capability records to the canonical model catalog
litellm/model_prices_and_context_window_backup.json Mirrors the six canonical Z.AI model records in the bundled backup catalog
tests/test_litellm/test_zai_model_metadata.py Verifies the expected Z.AI model subset, new metadata, and parity between canonical and backup catalogs
tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py Verifies that the public provider-fields endpoint exposes the expected Z.AI configuration
ui/litellm-dashboard/src/components/add_model/AddModelForm.test.tsx Adds regression coverage proving that searching by the lowercase zai slug finds the Z.AI provider

Reviews (1): Last reviewed commit: "fix(ui): search providers by LiteLLM slu..." | Re-trigger Greptile

@ExDevilLee
ExDevilLee force-pushed the litellm_fix_zai_provider_dropdown branch from d0dcb31 to 0217285 Compare August 20, 2026 01:25
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.

Bug: Z.AI (zai) provider missing from UI dropdown despite being in /public/providers API

2 participants