Claude and Gemini backends replaced by a local OpenAI-compatible provider

andrsschultz deleted both LLM provider files and replaced them with a single `local.ts` that routes all calls to a `LOCAL_LLM_BASE_URL` endpoint. The streaming implementation handles reasoning models and multi-round tool use, and is the one part of this commit worth cherry-picking.

infrastructuresecurity

backend/src/lib/llm/claude.ts and gemini.ts are gone. The new local.ts (265 lines) targets any OpenAI-compatible endpoint - LOCAL_LLM_BASE_URL defaults to http://127.0.0.1:11434/v1, which is Ollama's default. LOCAL_LLM_MODEL, LOCAL_LLM_API_KEY, and LOCAL_LLM_MAX_TOKENS=16384 configure it. @anthropic-ai/sdk and @google/genai are removed from the backend package.

The streaming code handles content deltas, reasoning_content/reasoning fields for models that emit them, and tool-call chunks - accumulating function.name and function.arguments by index through applyToolCallDelta. Tool-use loops up to maxIterations (default 10). That logic is solid and would port cleanly as an additional provider route.

On the frontend, the BYOK key-management UI is stripped: ApiKeyMissingModal.tsx is deleted, account/models/page.tsx goes from ~215 lines to a stub, and the apiKeys parameter is removed from chat, tabular, and settings call chains. The user_profiles schema drops the claude_api_key and gemini_api_key columns.

Do not pull the deletions or the schema migration. Add local.ts as a third option in index.ts alongside the existing Claude and Gemini routes. Keep the BYOK UI and the model catalog.

So what The `local.ts` provider is worth pulling as an addition if you want Ollama or any OpenAI-compatible local model as a backend option. The reasoning-stream handling is correct. Everything else in this commit - the provider deletions, BYOK removal, schema migration - should be skipped.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from andrsschultz/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
5b79b283 Route LLM calls to local provider asschultz 2026-04-30 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-82.md from inside the repo you want the changes in.

⬇ Download capture-thread-82.md