Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

feat(llamacpp): point to a custom llama-server when the bundled engine misbehaves (#9179)

James Dam03c8ff2e0aac
diff --git a/docs/src/pages/docs/desktop/local-engine/llama-cpp.mdx b/docs/src/pages/docs/desktop/local-engine/llama-cpp.mdx
index 12f362a9c..80aa8bfa5 100644
--- a/docs/src/pages/docs/desktop/local-engine/llama-cpp.mdx
+++ b/docs/src/pages/docs/desktop/local-engine/llama-cpp.mdx
@@ -42,6 +42,10 @@ Originally created by Georgi Gerganov and now maintained by the [ggml-org/llama.
**Speed**: No internet required once models are downloaded
**Control**: Choose exactly which models to run and how they behave
+## Engine version
+
+The llama.cpp engine is built into Jan and updates together with the app, so there is no separate backend to download or pick. **Settings** > **Llama.cpp** shows the version, build and commit; quote them when you report a model that fails to load. To run a model on a different llama.cpp version, run your own `llama-server` and connect it as a [custom endpoint](/docs/desktop/remote-models/custom-endpoint#use-a-different-llamacpp-version).
+
## Accessing Engine Settings
Find llama.cpp settings at **Settings** (<Settings width={16} height={16} style={{display:"inline"}}/>) > **Llama.cpp** under Model Providers:
diff --git a/docs/src/pages/docs/desktop/remote-models/custom-endpoint.mdx b/docs/src/pages/docs/desktop/remote-models/custom-endpoint.mdx
index bf3df51d5..5cf474df2 100644
--- a/docs/src/pages/docs/desktop/remote-models/custom-endpoint.mdx
+++ b/docs/src/pages/docs/desktop/remote-models/custom-endpoint.mdx
@@ -102,6 +102,7 @@ tools, vision, or audio. Add each model manually and configure its capabilities
| vLLM | OpenAI-Compatible | `http://localhost:8000/v1` |
| Ollama | OpenAI-Compatible | `http://localhost:11434/v1` |
| LocalAI | OpenAI-Compatible | `http://localhost:8080/v1` |
+| llama.cpp `llama-server` | OpenAI-Compatible | `http://localhost:8080/v1` |
| Text Generation Inference (TGI) | OpenAI-Compatible | `http://localhost:8080/v1` |
| LiteLLM (OpenAI mode) | OpenAI-Compatible | `http://localhost:4000/v1` |
| LiteLLM (Anthropic mode) | Anthropic-Compatible | `http://localhost:4000` |
@@ -111,6 +112,45 @@ Ports and paths depend on how you launched the server — check its startup logs
are defaults and may differ in your setup.
</Callout>
+## Use a different llama.cpp version
+
+Jan's built-in llama.cpp engine (**Settings** > **Llama.cpp**) is the version that ships with the app, and it updates together with Jan. If a model misbehaves on that version but works on another one, for example after a llama.cpp regression on your GPU, run the llama.cpp version you need yourself and connect it as a custom endpoint. This works today, with any llama.cpp build.
+
+<Steps>
+
+### Step 1: Get llama.cpp
+
+Open [ggml-org/llama.cpp releases](https://github.com/ggml-org/llama.cpp/releases) and pick a numbered build such as `b11514`; GitHub marks these as pre-releases, and the release marked "Latest" has no binaries. Download the `llama-<build>-bin-…` archive for your system and GPU and unpack it, for example:
+
+- Windows: `llama-b11514-bin-win-vulkan-x64.zip` or `llama-b11514-bin-win-cuda-13.4-x64.zip`. CUDA builds also need the matching `cudart-llama-bin-win-cuda-13.4-x64.zip`, unpacked into the same folder.
+- Linux: `llama-b11514-bin-ubuntu-vulkan-x64.tar.gz` or `llama-b11514-bin-ubuntu-cuda-13.4-x64.tar.gz`.
+- macOS (Apple Silicon): `llama-b11514-bin-macos-arm64.tar.gz`.
+
+### Step 2: Start `llama-server` with your model
+
+```bash
+llama-server -m /path/to/model.gguf --alias my-model --port 8080 -ngl 99 --jinja
+```
+
+- `--alias` is the model name Jan will show. Without it, the model is listed under its full file path.
+- `-ngl 99` offloads every layer to the GPU; lower it if the model doesn't fit. Recent builds default to `auto`, older ones to CPU only.
+- `--jinja` uses the model's own chat template, which tool calling needs. It is the default in recent builds and harmless to pass.
+- Use a port other than 1337, which Jan's own Local API Server uses by default.
+
+Models you downloaded in Jan are under your Jan data folder, in `llamacpp/models/<model>/model.gguf`.
+
+### Step 3: Add it to Jan
+
+Follow [Add a custom provider](#add-a-custom-provider) with **OpenAI-compatible**, base URL `http://localhost:8080/v1` and any placeholder API key (e.g. `sk-no-key`). Jan lists the model under its `--alias`; pick it in the chat's model selector.
+
+To let the model call tools, click the pencil next to it in the provider's **Models** list and turn on **Tools** under **Capabilities**. Jan can't detect a custom provider's capabilities on its own.
+
+</Steps>
+
+<Callout type="info">
+A model served this way is not managed by Jan: its download, load settings and GPU offload are whatever you pass to `llama-server`, and Jan's per-model llama.cpp settings don't apply to it.
+</Callout>
+
## API key fallbacks
For remote providers you can configure **multiple API keys**. Jan uses the primary key first and
diff --git a/web-app/src/containers/LlamacppEngineInfo.tsx b/web-app/src/containers/LlamacppEngineInfo.tsx
index 15505de13..08e224c97 100644
--- a/web-app/src/containers/LlamacppEngineInfo.tsx
+++ b/web-app/src/containers/LlamacppEngineInfo.tsx
@@ -7,6 +7,10 @@ import type { EngineVersionInfo } from '@/services/models/types'
const UPSTREAM_REPO = 'https://github.com/ggml-org/llama.cpp'
const SHORT_SHA = 8
+// The escape hatch for a regression in the bundled version: any llama.cpp
+// build, served by the user's own llama-server and added as a custom provider.
+const OTHER_VERSION_DOCS =
+ 'https://jan.ai/docs/desktop/remote-models/custom-endpoint#use-a-different-llamacpp-version'
function Fact({ label, value }: { label: string; value: string }) {
return (
@@ -72,6 +76,18 @@ export function LlamacppEngineInfo() {
<p className="mt-1.5 text-xs leading-normal text-muted-foreground">
{t('providers:engineBundled')}
</p>
+ <p className="mt-1 text-xs leading-normal text-muted-foreground">
+ {t('providers:engineOtherVersion')}{' '}
+ <a
+ href={OTHER_VERSION_DOCS}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex items-center gap-0.5 underline-offset-2 hover:text-foreground hover:underline"
+ >
+ {t('providers:engineOtherVersionLink')}
+ <IconExternalLink size={12} />
+ </a>
+ </p>
<dl className="mt-3 flex flex-wrap gap-x-6 gap-y-1">
<Fact label={t('providers:engineBuild')} value={engine.tag} />
<Fact
diff --git a/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx b/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx
index 8ee410ff4..bbb804377 100644
--- a/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx
+++ b/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx
@@ -51,6 +51,23 @@ describe('LlamacppEngineInfo', () => {
)
})
+ // The bundled engine has no version picker, so the panel names the way out
+ // when that one version regresses a model: the user's own llama-server.
+ it('points to running another llama.cpp version as a custom provider', async () => {
+ getEngineVersion.mockResolvedValue(PIN)
+ render(<LlamacppEngineInfo />)
+
+ expect(
+ await screen.findByText(/engineOtherVersion$/)
+ ).toBeInTheDocument()
+ expect(
+ screen.getByRole('link', { name: /engineOtherVersionLink/ })
+ ).toHaveAttribute(
+ 'href',
+ 'https://jan.ai/docs/desktop/remote-models/custom-endpoint#use-a-different-llamacpp-version'
+ )
+ })
+
// A panel with blanks in it makes a weaker claim than no panel: on a build
// with no engine there is nothing truthful to show.
it('renders nothing when the version is unavailable', async () => {
diff --git a/web-app/src/locales/en/providers.json b/web-app/src/locales/en/providers.json
index df956bf48..65c36e150 100644
--- a/web-app/src/locales/en/providers.json
+++ b/web-app/src/locales/en/providers.json
@@ -2,6 +2,8 @@
"limitedSupport": "This provider may not be fully supported. Capabilities (tools, vision, audio) are not auto-detected - add models manually and configure capabilities per model.",
"mlxExperimental": "MLX support is experimental. Embeddings are unavailable, the reasoning toggle is not yet wired through, and some newer model architectures may fail to load. Report issues on GitHub so we can prioritize them.",
"engineBundled": "The inference engine is built into Jan, so there is nothing to download or update separately. Quote this version when reporting a model that fails to load.",
+ "engineOtherVersion": "Need a different llama.cpp version? Run your own llama-server and add it as a custom OpenAI-compatible provider.",
+ "engineOtherVersionLink": "How to",
"engineReleaseNotes": "Release notes",
"engineBuild": "Build",
"engineCommit": "Commit",