mirror of
https://github.com/Rarebuffalo/securelens-backend.git
synced 2026-06-19 07:00:30 +00:00
add support for custom AI api base url and Agent Router integrations
This commit is contained in:
@@ -55,6 +55,9 @@ class Settings(BaseSettings):
|
||||
# Leave blank for Ollama (local, no key needed).
|
||||
ai_api_key: str | None = None
|
||||
|
||||
# AI_API_BASE: Custom API base URL (e.g. for Agent Router or custom OpenAI-compatible proxies)
|
||||
ai_api_base: str | None = None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Legacy Gemini key — kept for backward compatibility.
|
||||
# If AI_API_KEY is not set but GEMINI_API_KEY is, we use that automatically.
|
||||
|
||||
@@ -74,6 +74,9 @@ async def call_ai(
|
||||
"api_key": api_key,
|
||||
}
|
||||
|
||||
if settings.ai_api_base:
|
||||
kwargs["api_base"] = settings.ai_api_base
|
||||
|
||||
# JSON mode: supported natively by OpenAI and LiteLLM proxied Gemini.
|
||||
# For providers that don't support it, LiteLLM silently ignores the flag.
|
||||
if json_mode:
|
||||
|
||||
Reference in New Issue
Block a user