Skip to content

feat: add a "Custom (OpenAI Compatible)" AI provider option#242

Open
wynn5a wants to merge 2 commits intoavihaymenahem:mainfrom
wynn5a:custom-provider
Open

feat: add a "Custom (OpenAI Compatible)" AI provider option#242
wynn5a wants to merge 2 commits intoavihaymenahem:mainfrom
wynn5a:custom-provider

Conversation

@wynn5a
Copy link
Copy Markdown

@wynn5a wynn5a commented Apr 2, 2026

Summary

Add a "Custom (OpenAI Compatible)" AI provider option that allows connecting to any OpenAI-compatible API endpoint (Azure OpenAI, Groq, Together AI, etc.). Also improves error reporting for AI connection tests across all providers — test failures now surface the actual error message instead of a generic "Connection failed".

Changes

  • New customProvider.ts — OpenAI-compatible provider supporting configurable base URL, API key, and model name
  • Extended AiProvider union type and providerManager to include "custom" provider with full lifecycle (create, cache, clear)
  • Added AiTestResult type ({ ok: boolean; error?: string }) replacing the previous boolean return from testConnection() across all 6 providers
  • Settings UI: new "Custom Provider" section with Base URL, API Key, and Model Name fields, plus Save and Test Connection buttons
  • Settings UI: "Test Connection" now auto-saves form values before testing (Ollama + cloud providers) and displays truncated error details on failure
  • Updated all existing provider tests (copilotProvider.test.ts, ollamaProvider.test.ts, aiService.test.ts, writingStyleService.test.ts) and shared mocks to match the new AiTestResult return shape

Type of Change

  • New feature
  • Bug fix
  • Enhancement (improving existing feature)
  • Refactor (no behavior change)
  • Documentation
  • CI/Build

Testing

  • Existing tests pass (npm run test)
  • New tests added (if applicable)
  • Manually tested

Screenshots

image

wynn5a added 2 commits April 1, 2026 18:11
Test connection for custom and all AI providers now propagates actual
error messages (auth failure, unreachable URL, invalid model) instead
of swallowing them. Auto-saves settings before testing so current form
values are always used.
@wynn5a wynn5a requested a review from avihaymenahem as a code owner April 2, 2026 05:10
@wynn5a wynn5a changed the title Add a "Custom (OpenAI Compatible)" AI provider option feat: add a "Custom (OpenAI Compatible)" AI provider option Apr 2, 2026
@wynn5a wynn5a mentioned this pull request Apr 2, 2026
@bilalbayasut
Copy link
Copy Markdown

please would you mind review this @avihaymenahem , can't wait :)

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.

2 participants