Skip to content

Conversation

@benzntech
Copy link
Contributor

@benzntech benzntech commented Jan 7, 2026

Summary

This PR enhances the OpenAI Compatible provider settings with:

1. Auto-fill Model Capabilities

  • Auto-detection from Model ID: Automatically detects capabilities based on model name patterns:
    • gemini, vision, vl, omni, gpt-4o → enables Images support
    • reasoner, thinking, r1, o1, o3 → enables Reasoning support
    • computer → enables Computer Use support
  • OpenRouter Fallback: If model not found locally, looks up from OpenRouter API with fuzzy matching
  • Force Refresh: "Auto-fill" button now includes forceRefresh flag to bypass cache

2. Suppress Unconfigured Provider Errors

  • Conditional Model Fetching: Gemini/Ollama models only fetched when their provider is actually selected
    • Gemini: requires apiProvider === 'gemini' AND geminiApiKey
    • Ollama: requires apiProvider === 'ollama' AND ollamaBaseUrl
  • Cleaner Console: No more "API key not valid" or "Failed connecting to Ollama" errors on startup if providers aren't configured

3. Fix JSON Serialization Bug

  • Infinity → Number.MAX_SAFE_INTEGER: Model tiers with contextWindow: Infinity are now sanitized before JSON serialization
  • Prevents Validation Errors: Fixes "Expected number, received null" Zod validation errors when saving config

Files Changed

  • src/api/providers/openai.ts: Added tier sanitization in getOpenAiModelInfo()
  • src/core/webview/webviewMessageHandler.ts: Conditional Gemini/Ollama fetching, forceRefresh support, auto-detection heuristics
  • webview-ui/src/components/settings/providers/OpenAICompatible.tsx: Added forceRefresh flag to Auto-fill button
  • src/package.json: Version bump to 4.143.21

Testing

  1. Select "OpenAI Compatible" provider
  2. Enter a model ID like gemini-3-pro-preview or deepseek-r1
  3. Verify capabilities auto-detect correctly
  4. Click "Auto-fill" button to refresh model info
  5. Confirm no Gemini/Ollama errors appear in console if not configured

Related PRs

Fixes #3271

@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

🦋 Changeset detected

Latest commit: 89ee6c1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Related to Kilo-Org#4506 and #7370

## Summary
This PR addresses the pain points around configuring reasoning and tool capabilities for custom OpenAI-compatible models (like DeepSeek R1).

## Changes
- **UI**: Added checkboxes for 'Supports Reasoning', 'Supports Function Calling', and 'Supports Computer Use' to the OpenAI Compatible settings.
- **UI**: Compacted the capability checkboxes into a 2-column grid layout with tooltip-only descriptions.
- **Backend**: Updated OpenAiHandler to inject the 'thinking' parameter when reasoning is enabled and the model supports it.
- **Backend**: Gated tool inclusion based on the 'supportsNativeTools' flag.
- **i18n**: Added translation strings for the new settings.

## Findings
The backend logic in base-openai-compatible-provider.ts has support for reasoning (via <think> tags) and tools, but these features were gated by flags that were unreachable from the UI for custom models.
@benzntech benzntech force-pushed the feat/openai-compatible-settings-improvements branch from 82cbecb to 8a902d2 Compare January 8, 2026 04:04
- Disable Auto-fill button when no model selected in OpenAI Compatible settings
- Provide feedback (undefined) when model info not found to clear UI state
- Fix Gemini provider to pass baseUrl to GoogleGenAI constructor for proxy support
- Bump version to 4.143.3-dev
…ation

- Gemini/Ollama models only fetched when provider is actually selected
- Add forceRefresh flag to Auto-fill button for cache bypass
- Fix Infinity → null JSON serialization bug in model tiers
- Replace Infinity with Number.MAX_SAFE_INTEGER for valid JSON
- Bump version to 4.143.21
…e-settings-improvements

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
benzntech and others added 4 commits January 11, 2026 21:54
- OpenRouter is now the primary source for model info
- Static model maps merged for capabilities (computer use, images, etc.)
- Added fuzzy matching to handle model ID variations
- Normalizes provider prefixes and date suffixes for matching
@kevinvandijk
Copy link
Collaborator

Thanks! We'll review and test this soon!

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.

[BUG] The list of models doesn't load in the panel below on the OpenAI Compatible provider

2 participants