Repository navigation
feat: first-class local providers (Ollama, LM Studio) with model discovery and keyless custom endpoints - #12
Open
brainsparker wants to merge 1 commit into
Open
brainsparker wants to merge 1 commit into
brainsparker wants to merge 1 commit into
Conversation
…overy and keyless custom endpoints Adds Ollama (local) and LM Studio (local) as providers that need no API key, probe /v1/models for a vision-first model picker and connection status, and keep keyless local users out of the trial-expired state. Custom endpoints no longer require a key. Clearer errors for a server that is not running or a model that is not installed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What this does
SuperPaste can now run fully on the Mac with zero typing: pick Ollama (local) or LM Studio (local) in Settings and the screenshot never leaves the machine.
ollamaandlmstudio, that need no API key and no account. They default to the servers' standard ports (localhost:11434,localhost:1234) and accept an override for a moved server. Any form works in the address field:localhost:11434,http://host:port/v1, or a full/v1/chat/completionsURL.GET /v1/modelson the endpoint (debounced while typing, plus a refresh button) and shows "Connected, N models" or a specific failure ("Ollama isn't running at localhost:11434", "Connected, no models yet. Run: ollama pull qwen3-vl"). The model field becomes a picker of installed models, vision-capable ones first and labeled, with an Auto choice that uses the first vision model on the server. Picking a text-only model shows a warning, since the app sends a screenshot.Bearerheader when present. Same model discovery applies to custom endpoints that expose/v1/models.usingOwnAPIKeymeant "some key exists in the Keychain", so a keyless local user would have landed in the trial-expired screen after seven days even though no hosted request was ever made.LLMProviderConfig.isOwnProviderReadyreplaces that check; the menu bar status and Diagnostics follow the same source of truth (Diagnostics gains endpoint host and model rows, never the key).How to use: install Ollama or LM Studio, pull a vision model (
ollama pull qwen3-vl), open Settings, choose the local provider, press Option+V.Why this, why today
Market signal, with sources:
/v1/chat/completionswith base64image_urlparts, and/v1/modelsfor listing. Neither validates a key on localhost (Ollama's docs call the key "required but ignored"; LM Studio only checks one when "Require Authentication" is on). Ollama OpenAI compatibility: https://docs.ollama.com/openai and https://github.com/ollama/ollama/blob/main/docs/openai.md. LM Studio OpenAI endpoints: https://lmstudio.ai/docs/app/api/endpoints/openai."ollama"key (Issues with the Ollama documentation pydantic/pydantic-ai#891); openclaw users were confused by an API key gate on an Ollama provider that needs none (Ollama provider fails auth check despite not requiring API key openclaw/openclaw#3740); oMLX shipped a "skip API key for localhost" toggle plus auto model discovery in response to an issue asking for exactly that (API Key Handling and Model Name Standards jundot/omlx#92). SuperPaste had the same gate: the custom provider's Save button was disabled on an empty key and the service threwproviderNotConfigured, while the README and the landing page both advertise Ollama / LM Studio support./v1/modelsdiscovery, which users complain about (https://blog.thibmaek.com/setting-up-ollama-cloud-with-raycasts-new-byom/).finetune/kit) and this PR is the bridge users can use today while that work lands.Runner-up candidates considered and passed on today: a PAM v1.0 (Portable AI Memory) export target for you.md, and aligning youagent's pending MCP server mode with the stateless 2026-07-28 MCP revision. Both are real but would join long unreviewed queues.
Implementation notes
LLMProviderIDgainsollamaandlmstudioplusisLocal,requiresAPIKey,supportsCustomEndpoint,supportsModelDiscovery,endpointPlaceholder,modelHint,signupLabel.LLMProviderConfiggainsresolvedEndpointandisOwnProviderReady; the stored shape is unchanged, so 1.1.0 configs decode as before (covered by a test).Services/LocalModelServer.swift:LocalEndpoint(URL normalization,/v1/modelsderivation, host display, loopback detection),ModelCapabilityHint(vision heuristics by model id, picker ordering),LocalModelServer(model list fetch and parsing for OpenAI, Ollama native, and bare array shapes; default model choice).LLMService: the three endpoint-configured providers share one path;apiKeyis optional on the OpenAI-compatible call; empty model resolves against the server with a vision-first preference; 404 and connection-refused get their ownLLMErrorcases, mapped inPasteFailure.SettingsPage: endpoint field, discovery-backed model picker with vision labels, connection status, optional-key disclosure. Discovery runs via.task(id:)keyed on provider and endpoint with a 400 ms debounce.Test status
LocalModelServerTests.swiftandLLMProviderTests.swift: endpoint normalization for every accepted input form,/v1/modelsderivation, loopback detection, vision heuristics (including thevlword-boundary case), picker ordering and dedupe, model-list parsing for three response shapes, default model choice, config JSON round trip and legacy decode, keyless-readiness logic, and a live connection-refused check against127.0.0.1:9.swift teston the macOS CI job is the first full compile, so please read the CI result before reviewing by hand; if anything fails to type-check, it will be inSettingsPage.swiftand is small to fix.qwen3-vlpulled, Settings should show "Connected, 1 model", Auto should pick it, and Option+V should paste. Quit Ollama and the HUD should say "Nothing is running at localhost:11434".🤖 Generated with Claude Code