From 7ae8f81d742c1eee3faed5b2d4558e32a77fea1b Mon Sep 17 00:00:00 2001 From: Umesh Yadav <23421535+imumesh18@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:27:16 +0530 Subject: [PATCH] language_models: Clear cached credentials when OpenAI and OpenAI Compatible provider `api_url` change (#37610) Closes #37093 Also check this: #37099. So currently in zed for both OpenAI and OpenAI Compatible provider when the url is changed from settings the api_key stored in the provider state is not cleared and it is still used. But if you restart zed the api_key is cleared. Currently zed uses the api_url to store and fetch the api key from credential provider. The behaviour is not changed overall, it's just that we have made it consistent it with the zed restart logic where it re-authenticates and fetches the api_key again. I have attached the video below to show case before and after of this. So all in all the problem was we were not re-authenticating the in case api_url change while zed is still running. Now we trigger a re-authentication and clear the state in case authentication fails. OpenAI Compatible Provider: | Before | After | |--------|--------| |