feat: OpenAI-compatible /v1 client and provider routing#218
Merged
Conversation
This was referenced Jun 12, 2026
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
…port Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
…mirror Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
f8d5db6 to
a6eaf2d
Compare
This was referenced Jun 16, 2026
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.
Overview
This PR makes Thuki's bundled inference engine reachable and adds support for OpenAI-compatible servers: a generic OpenAI-compatible
/v1chat client, a newopenaiprovider kind, and routing of every LLM consumer (chat, search, title generation, warmup, capabilities) by the active provider's kind. Stacked on the engine-runner PR (#217). Fresh installs still default to Ollama at this point in the stack; the default flips in #219.What changed
openaiprovider kind:[[inference.providers]]entries withkind = "openai"(label, base_url, model, and a manualvisionflag). API keys are stored write-only in the macOS Keychain (keychain.rs), never inconfig.tomland never returned over IPC./v1SSE client (openai.rs): streaming chat with content parts, bounded SSE line buffering, cancellation, and typed error classification (EngineUnreachable,EngineStartFailed, model-not-found and auth variants).commands.rs):ask_modeldispatches builtin chat through the engine runner plus/v1, Ollama through native/api/chat, and openai through/v1against the provider's base_url. Search and title generation run through a provider-kindLlmTransport; warmup, eviction, the VRAM poller, and capability detection all branch by kind, with a/propsprobe gating vision for builtin models.How it works
The active provider is resolved from managed config per request; builtin requests first await
ensure_loadedon the engine runner, then stream from the local server like any other/v1endpoint. Capabilities are cached per(provider_id, model). All three kinds emit the sameStreamChunkchannel contract, so the frontend streaming path is provider-agnostic.Testing
Both gates exit 0 at the branch head. The
/v1client is covered against mock servers (SSE framing, oversized lines, missing done markers, cancellation, auth and 404 classification); routing, warmup, and capability branching are covered per kind in backend unit tests.