Skip to content
anthonypdrPublic

About

Lightweight terminal client for local LLMs. Supports LM Studio, Ollama and OpenAI-compatible APIs with minimal prompt overhead.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Glim

Tests Python 3.10+ License: MIT

Local chat. Project tools when you ask for them.

Glim is a lightweight terminal client for the models you already run locally. Start with LM Studio, Ollama, or another local server with OpenAI-compatible model and chat endpoints.

It provides a compact terminal experience without a large, always-on system prompt. Optional project tools are only attached when you explicitly ask for them.

Glim is early-stage software. Review agent-proposed changes and approve commands deliberately.

Glim terminal preview showing a Python answer with highlighted code and an example opt-in agent request

Sample conversation rendered with Glim's own terminal components. The response is illustrative; the editable composer is not shown.

Install · LM Studio setup · Ollama setup · Releases · Report a bug

Features

  • Connects to LM Studio by default (http://127.0.0.1:1234)
  • Shows the models currently running in LM Studio with /model
  • Gives in-terminal connection steps when no model server or model is found
  • Connects to other local OpenAI-compatible model servers with one environment variable
  • Streams normal chat responses in a focused terminal interface
  • Enables agent tools only for requests prefixed with @
  • Lets the agent inspect and edit files inside the current project
  • Requires approval for shell commands other than a small read-only allowlist
  • Supports web search and readable web-page fetching in agent mode
  • Keeps the input available during responses and queues follow-up requests
  • Displays syntax-highlighted code blocks and a model, path, and conversation footer

Install

You need Python 3.10 or newer, Git, a terminal, and a local model server. Glim is a client: install and run the model separately. Your model determines the RAM/VRAM you need. The steps below install from GitHub into an isolated virtual environment.

Linux / macOS

git clone https://github.com/anthonypdr/glim.git
cd glim
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install .

Windows (PowerShell)

git clone https://github.com/anthonypdr/glim.git
cd glim
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install .

On Linux/macOS, run glim while the environment is active. In a new terminal, activate it again with source /path/to/glim/.venv/bin/activate. On Windows, run C:\path\to\glim\.venv\Scripts\glim.exe; activation is not required. Use the actual path to your checkout, and launch from the project directory you want Glim to work in.

For a fixed alpha version, run git checkout v0.1.0a1 after cloning and before installing. See the release notes.

Development install

After creating and activating the virtual environment, use an editable install while working on Glim itself (on Windows, substitute .\.venv\Scripts\python.exe for python):

python -m pip install -e .

Quick start with LM Studio

  1. Open LM Studio and load a chat-capable model.
  2. Open LM Studio's Developer tab and turn on Start server. You can also run lms server start.
  3. Change into the project you want help with.
  4. Run:
glim

Type /model to display the models currently running in LM Studio and select one. If nothing is displayed, Glim explains how to load a model and start the local server directly in the terminal.

Use with Ollama

  1. Install Ollama and keep its app or service running. For a standalone CLI setup, run ollama serve in a separate terminal if the server is not already running.

  2. Download a model that fits your machine, for example:

    ollama pull qwen3:8b
  3. Launch Glim from your project directory:

    Linux / macOS (with Glim's environment active):

    GLIM_SERVER_URL=http://127.0.0.1:11434 GLIM_SERVER_NAME=Ollama glim

    Windows (PowerShell):

    $env:GLIM_SERVER_URL = "http://127.0.0.1:11434"
    $env:GLIM_SERVER_NAME = "Ollama"
    & "C:\path\to\glim\.venv\Scripts\glim.exe"
  4. Type /model and select the downloaded model. Start with a normal chat; @ requests additionally require a model that supports tool calling.

Glim uses Ollama's OpenAI-compatible API. Model discovery lists available models; it does not indicate which Ollama models are currently loaded in memory. Model quality and tool support vary.

Other compatible local servers

To connect to a local server that provides /v1/models and /v1/chat/completions, set its base URL before launching:

GLIM_SERVER_URL=http://127.0.0.1:PORT GLIM_SERVER_NAME="My local server" glim

Replace PORT with the server's port. A trailing /v1 is also accepted. GLIM_LMSTUDIO_URL remains supported for an LM Studio URL override; GLIM_SERVER_URL takes precedence if both are set.

Using Glim

Type a normal message for lightweight chat:

Explain this Python traceback.

Prefix a request with @ to enable the agent and its tools for that request:

@ inspect this project and explain its structure
@ read package.json and summarize the dependencies
@ fix the failing test in tests/test_api.py
@ run pytest
@ search the web for the current Python packaging guidance

@ run COMMAND directly runs a shell command through the same safety checks:

@ run rg "TODO" .

Commands on the read-only allowlist run immediately. Other commands require confirmation through the approval menu below; some destructive commands are blocked. File-editing tools can write within the current project without a separate approval prompt. These checks are not an operating-system sandbox.

Built-in commands

Command What it does
/help Show in-app help
/model Display running LM Studio models, or selectable models from another compatible local server
/status Show connection, model, directory, and context status
/tools Show the tools available through @ agent mode
/clear Clear the shared chat and agent history
/title NAME Rename the conversation displayed below the input
/exit Quit Glim

The input stays available while Glim works. Submit another message to queue it; requests run in order. The footer shows the active model, working directory, conversation title, and working or queued status. Titles start from your first message and can be changed with /title NAME.

When a shell command needs approval, its command and a numbered menu appear above the input. Press 1 or Y to allow once, or 2, N, or Esc to decline. You can also select with the arrow keys and confirm with Enter. Decline is selected initially. Shortcuts apply when the input is empty; an existing draft stays editable, and submitted follow-up messages are queued. Slash commands are available after queued work finishes. Responses appear as formatted paragraphs and complete code blocks, with language labels and syntax highlighting.

The right side of the footer shows the percentage of request context used. Glim uses LM Studio's loaded context window and reported token usage when available. ~ marks an estimate (including while streaming); Context — means the server did not expose the loaded context limit. This is per-request usage, not a cumulative count across requests. /clear resets the displayed usage.

Normal chat and @ requests share conversation history within the running session, including earlier tool calls and results. Switching models keeps that history; /clear resets it. Normal chat still runs without tool definitions or agent instructions. History is held in memory and is not restored after restart.

How it stays lightweight

Normal chat sends only your conversation to the local model server. The optional tool instructions and definitions are attached only for requests beginning with @; they are not permanently included in every request. That keeps the common path small while retaining project automation when you need it.

Development

After installing the package, run the test suite from the repository root:

python -m unittest discover -s tests -v

Tests use mocked model responses and do not require a running model server. GitHub Actions runs them on Linux, macOS, and Windows with Python 3.10 and 3.14. This checks the package and automated tests; it is not a live-model certification for every operating system or provider.

Regenerate the README's sample terminal preview with:

python scripts/render_preview.py

The package's command-line entry point is glim.cli:main. Launching python -m glim runs the same terminal application.

Troubleshooting and feedback

  • Cannot connect / no models: Check that the server is running, then use /status to inspect Glim's URL and /model to retry. Load a model in LM Studio or download one with Ollama first.
  • glim not found: Activate the virtual environment, or run its executable by full path as shown above.
  • venv unavailable: Install your operating system's Python venv support, then repeat the environment creation step.
  • Agent tools do not work: Try normal chat first, then check that your chosen model and server support tool calling.

History lasts only for the current session. Web search and page fetching contact external services when used in agent mode.

Found a problem? Open an issue with your OS, Python version, Glim version or commit, model/server, reproduction steps, and expected versus actual behavior. Remove private project content from logs. Small pull requests are welcome; include relevant tests for behavior changes.

Development transparency

Glim is developed with AI-assisted coding tools. Bug reports, testing, and code review from the community are welcome.

License

MIT. See LICENSE.

Images, titles, and long conversations

Attach a local image with @ (quote paths containing spaces):

@"/home/you/Pictures/screenshot.png" What is wrong with this screen?
Explain this chart @./chart.png
@ fix the layout using @./reference.png

A leading image reference opens an image chat. @ fix ... still uses agent tools and can include image references. /image "PATH" QUESTION also remains available. The @ reference sends the actual image to the model, not just its filename.

PNG, JPEG, and WebP files up to 20 MB are accepted. Select a vision model with /model. Images remain available to follow-up questions while their turn fits in the request context.

Paste a screenshot

  1. Copy an image using Print Screen, Snipping Tool, or your screenshot app.
  2. In Glim, press Ctrl+V (or Alt+V, also available as Esc then V).
  3. An @clipboard-1.png attachment marker appears. Type your question and press Enter.

You do not need to save the screenshot or find a path. Pasted images also work with agent requests, for example @ fix this layout followed by the pasted marker. Delete the marker from the draft to omit that image. Text clipboard contents are inserted as text and do not automatically submit the draft.

Some terminals intercept Ctrl+V, Ctrl+Shift+V, or right-click Paste and only send text to terminal apps. Use Alt+V if normal terminal paste does nothing for an image. Glim reads the desktop clipboard only when its paste shortcut is pressed.

Clipboard backends:

  • Linux Wayland: wl-paste from wl-clipboard.
  • Linux X11: xclip.
  • Windows / WSL: Windows PowerShell and the Windows Forms clipboard API.
  • macOS: the built-in osascript clipboard interface.

Linux needs access to the local desktop session. SSH sessions without desktop clipboard access can still attach image files with @. No additional Python packages are needed. Images are kept in a private temporary directory for the session, including queued requests, and removed when the session finishes. The existing 20 MB image limit and model vision checks apply.

After the first successful turn, Glim requests a short title summarizing the first prompt's overall intent. This separate request does not enter conversation history. LM Studio reasoning is disabled for naming when the model supports it. Use /title NAME to override the title. A naming error leaves the default title and does not interrupt the conversation.

When LM Studio reports a loaded context length, Glim reserves half that window for generation and estimation error, removing whole older turns from the outgoing request as needed. A notice identifies omitted messages; full session history is retained locally. The current turn and its tool-call/result pairs are preserved. An oversized current turn produces an actionable error instead of resending an invalid request. Estimates are approximate, including a fixed allowance for images. The output budget is capped at 4,096 tokens or the estimated remaining space. Compatible servers without context metadata cannot use automatic context trimming.

Interrupted streams and server errors are reported explicitly. Partial answers are retained; requests with no answer are removed from history so subsequent questions can recover. The status line distinguishes waiting, reasoning, and receiving an answer. A token-limit finish is shown as an incomplete reply. Requests use a 10-second connection timeout and a 120-second read timeout; streamed responses can run longer while data continues arriving.

For long coding sessions, a larger loaded context length in LM Studio allows more history and larger tool results. This uses more memory; the model's advertised maximum is not the window it is currently loaded with. Refresh /model after changing the loaded model or its context settings. /clear starts fresh.

About

Lightweight terminal client for local LLMs. Supports LM Studio, Ollama and OpenAI-compatible APIs with minimal prompt overhead.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages