diff --git a/docs/docs/configuration/genai.md b/docs/docs/configuration/genai.md index 2ec9a6276..68ea054d1 100644 --- a/docs/docs/configuration/genai.md +++ b/docs/docs/configuration/genai.md @@ -112,6 +112,7 @@ genai: provider: openai api_key: "{FRIGATE_OPENAI_API_KEY}" model: gpt-4o + base_url: https://api.openai.com/v1 ``` ## Azure OpenAI diff --git a/frigate/genai/openai.py b/frigate/genai/openai.py index 4568905a3..0d3ecaf65 100644 --- a/frigate/genai/openai.py +++ b/frigate/genai/openai.py @@ -21,7 +21,13 @@ class OpenAIClient(GenAIClient): def _init_provider(self): """Initialize the client.""" - return OpenAI(api_key=self.genai_config.api_key) + + if self.genai_config.base_url is None or self.genai_config.base_url == "": + self.genai_config.base_url = "https://api.openai.com/v1" + + return OpenAI( + api_key=self.genai_config.api_key, base_url=self.genai_config.base_url + ) def _send(self, prompt: str, images: list[bytes]) -> Optional[str]: """Submit a request to OpenAI."""