Skip to content

refactor: support multiple LLM providers in API availability check #64#79

Open
envsecure wants to merge 3 commits into
hexdocom:mainfrom
envsecure:refactor/multi-provider-test-connection
Open

refactor: support multiple LLM providers in API availability check #64#79
envsecure wants to merge 3 commits into
hexdocom:mainfrom
envsecure:refactor/multi-provider-test-connection

Conversation

@envsecure

Copy link
Copy Markdown

This PR refactors the "Test Connection" functionality to support multiple LLM providers beyond just OpenAI.

Changes:

  • Refactored check_llm_api_availability.js:
    • Added dynamic dispatch for different provider types: OpenAI, Azure, Google Gemini, Anthropic Claude, and OpenRouter.
    • Implemented provider-specific request body construction (e.g., Gemini's contents/parts vs OpenAI's messages).
    • Added proper header handling (e.g., x-api-key for Claude, api-key for Azure).
    • Integrated response validation for each provider's unique JSON structure.
    • Added a 10-second timeout to prevent hung requests.
  • Updated src/routers/platform/platform.js:
    • Enhanced the /api/platform/check_api_availability endpoint to accept provider_type and api_version.
    • Updated Swagger documentation to reflect the new parameters.

Why this is important:

Previously, the connection test was hardcoded to OpenAI's endpoint and format. This caused "Test Connection" to fail for Azure, Gemini, and other providers even if the credentials were correct. This fix ensures a unified and reliable validation experience across the entire ecosystem.

Tested with:

  • OpenAI compatible (local vLLM)
  • Azure OpenAI
  • Google Gemini (API Studio)

Fixes #64

envsecure added 3 commits May 2, 2026 13:21
- Added support for Azure, Gemini, Claude, and OpenRouter.
- Implemented provider-specific URL construction and response validation.
- Added timeout handling.
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.

[Enhancement] Refactor "Test Connection" to Support Multiple Provider Types (Azure, Gemini, etc.)

1 participant