Add API_BASE_URL Option for OpenAI Integration to Support Multiple Endpoints

I think it would be super useful if we could add an option to set a custom API_BASE_URL for the OpenAI integration in Home Assistant. This way, we could easily use different endpoints like Groq, Azure, and OpenRouter that follow the OpenAI API format without having to set up separate integrations for each one. This essentially makes the OpenAI integration one for all of OpenAI’s API format, not just OpenAI’s implementation of it.

  1. Flexibility and Convenience: Many of us use multiple services that are compatible with the OpenAI API. Being able to setup new ones them by just changing a URL would save a lot of hassle. For example, Azure OpenAI might have specific benefits that make it preferable in some cases, vs Groq or OpenRouter, etc

  2. Advanced Settings Already Exist: We already have advanced settings for things like Temperature in the OpenAI integration. Adding a base URL option would fit right in with these settings, giving us more control without making things too complicated. Changing it might break some things regarding Assist control as not all models support functions required, but that’s to be expected with advanced settings?

By having this ability we are not limited to just OpenAI, but can use any service that uses their API format:

It seems there was a PR that was already rejected with this change, but I disagree and think it would be useful as many different sources support the openAI endpoint. I think change would be more useful now.

I agree this would be great to have, I want to use Azure OpenAI, and currently have no way to do so.