Skip to content

Conversation

@kaofelix
Copy link
Contributor

Opening this as a draft here just to discuss a few points.

@assagman I will pull your doc changes in here too and adapt them to whatever becomes the final idea here.

Basically what I find annoying is that z.ai API keys work for both API and Coding Plan. The only difference is the endpoint itself. The way it currently is, whenever someone has ZAI_API_KEY defined, they will have both providers available, which is a bit noisy for what I assume to be the most cases of people only using one option.

The ideas that occurred to me were:

  1. Introduce a different environment var e.g. ZAI_CODING_API_KEY so that you know which provider you are configuring. The only caveat is that every other tool I encountered uses ZAI_API_KEY for the config
  2. Replace the zai provider entirely with zai-coding-plan

I personally prefer 2 as it keeps things simpler while making it more aligned with models.dev and being explicit that we are supporting the Coding Plan specifically and not the regular API. So far, pi only worked with the coding plan anyways, since it always used coding plan endpoints. I can add examples to the docs on how to setup the regular API by hand.

From the fact that it has always been Coding Plan and no one complained, I assume there are not many API users out there. API users tend to prefer other providers and even avoid zai, from what I've seen.

kaofelix and others added 2 commits January 22, 2026 09:36
Add documentation for the new Z.AI GLM Coding Plan provider,
including auth configuration, environment variables, and model
details (GLM-4.7, GLM-4.6, GLM-4.5 and vision variants).

Signed-off-by: assagman <ahmetsercansagman@gmail.com>
@assagman
Copy link

Hey @kaofelix , thank you!

I also find it a bit confusing that z-ai team's decided that one api key can be used for both. Anyways, +1 for option (2) here. It's fine as soon as it's aligned with models.dev

@badlogic
Copy link
Owner

I'm OK with 2 as well! Which means we entirely rip out the zai provider. Can you amend the PR accordingly? Also needs a breaking changes changelog entry in that case.

@kaofelix kaofelix marked this pull request as ready for review January 22, 2026 19:57
@kaofelix
Copy link
Contributor Author

kaofelix commented Jan 22, 2026

@badlogic cool, made all the changes! Did a quick test with GLM flash here with thinking on and off to make sure the thinking param still works: https://buildwithpi.ai/session/#2cc3a9696a480de2262751a35e692215

Oops, actually forgot about the breaking change changelog, will do that now

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.

3 participants