{{ message }}
feat(ai): add OpenAI-compatible provider support#5
Merged
shobhit99 merged 7 commits intoFeb 18, 2026
Merged
Conversation
Add support for custom OpenAI-compatible API providers like OpenRouter, Together AI, and self-hosted endpoints. Changes: - Add 'openai-compatible' provider type to AISettings - Add openaiCompatibleBaseUrl, openaiCompatibleApiKey, and openaiCompatibleModel fields - Implement streamOpenAICompatible() for streaming completions - Add UI section in AITab for configuring custom provider settings - Update model routing and availability checks Closes #2
Change provider selection grid from 4 columns to 2 columns to give cards more horizontal space and prevent text from being squashed, especially for the longer 'Custom (OpenAI-compatible)' label.
Fix URL construction to properly handle providers like Fireworks AI that include /v1 in the base URL. Previously we always appended /v1/chat/completions to the base URL, which caused double /v1 paths. Now we check if the base URL already ends with /v1 and only append /chat/completions in that case, otherwise we append /v1/chat/completions for backwards compatibility.
Add custom model option for openai-compatible provider in the Default Model dropdown. When the Model Name field is updated, it now automatically updates the defaultModel with the proper openai-compatible- prefix. This ensures the model ID is properly resolved when using the chat feature with custom OpenAI-compatible providers like Fireworks AI.
…compatible Fix empty string handling in resolveModel defaults - previously an empty string would fall through to the hardcoded default 'gpt-4o' instead of checking the user's configured model. Add debug logging to help diagnose routing issues with the openai-compatible provider. This will log the resolved provider, model ID, and config values to the console for troubleshooting.
The prefix matching was matching 'openai-' before 'openai-compatible-', causing 'openai-compatible-accounts/fireworks/...' to be incorrectly parsed as an OpenAI model with ID 'compatible-accounts/fireworks/...'. Reorder prefixes to check longer ones first: - 'openai-compatible-' before 'openai-' - 'anthropic-' and 'ollama-' in between
Remove debug console.log that was added for troubleshooting the openai-compatible provider routing issues.
Contributor
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR adds support for custom OpenAI-compatible API providers, allowing users to connect to services like OpenRouter, Together AI, or self-hosted endpoints that implement the OpenAI API format.
Changes
Core Implementation
openaiCompatibleBaseUrl: The API endpoint URL (e.g., https://api.openrouter.ai/v1)openaiCompatibleApiKey: Authentication key for the provideropenaiCompatibleModel: Custom model identifier (e.g., anthropic/claude-3.5-sonnet)Provider Logic
streamOpenAICompatible()streaming function that sends standard OpenAI-formatted requests to any compatible endpointopenai-compatible-prefixed model IDsUI Updates
Usage Examples
Users can now configure providers like:
https://api.openrouter.ai/v1with modelanthropic/claude-3.5-sonnethttps://api.together.xyz/v1with modelmeta-llama/llama-3.1-70bTesting
Closes #2