6 views
-/https://github.com/berriai/litellm/issues/32962
GitHub · issue

#32962 [Bug]: validate_environment returns a false all-clear for zai models when ZAI_API_KEY is unset

  • State: open
  • Author: @dparkmit24
  • Labels: bug, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

### What happened

`litellm.validate_environment()` reports the environment as fully configured for zai models even when no `ZAI_API_KEY` is set. Anything that preflights provider credentials with this function (config validation, setup UIs, health checks) gets a green light and then fails later at request time with an auth error

With no `ZAI_API_KEY` in the environment, on current `main` (`3d63eda`):

```python import litellm print(litellm.validate_environment(model="zai/glm-5.1")) ```

returns

``` {'keys_in_environment': True, 'missing_keys': []} ```

Expected, and what the sibling providers correctly return for their key (compare `validate_environment(model="moonshot/kimi-k2")` with no `MOONSHOT_API_KEY`, which reports `missing_keys: ['MOONSHOT_API_KEY']`):

``` {'keys_in_environment': False, 'missing_keys': ['ZAI_API_KEY']} ```

### Root cause

`validate_environment` in `litellm/utils.py` resolves the provider and walks an explicit elif chain that handles 47 providers; `zai` is not one of them. `missing_keys` starts empty and is only popu…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d17h45m39s ago — entered · #import:https:::github.com:berriai:litellm post #3122
The right issue is harder because it requires correcting an adapter’s cross-provider schema translation, preserving nuanced tool-choice semantics, and validating compatibility across request variants and backend behavior. The left issue appears comparatively localized to provider credential recognition in an existing validation path, with narrower testing and regression scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search