- LM Studio functions as the inference engine that runs the GGUF models, while AnythingLLM acts as the data management and orchestration layer.
- Integration allows the implementation of advanced RAG systems to interact with private documents without the information leaving the local hardware.
- The use of protocols such as MCP and agent capabilities transforms a simple chat into an assistant capable of browsing the web and running external tools.
If you want to use artificial intelligence on your computer without sending all your conversations and documents to a large company's servers, combine LM Studio with AnythingLLM It's one of the most practical options. Both applications can run locally and perform different tasks within the system.
LM Studio handles downloading and running the language model, while AnythingLLM provides the conversational interface, workspaces, document management, RAG system, and agent tools. By connecting them, you can build a personal assistant capable of answering questions about your own files.
In this guide we will see How to connect LM Studio with AnythingLLMwhich address you should use depending on the type of installation and how to configure language models and embeddings to work with documents.
What function does each application serve?

LM Studio is an application for downloading, loading, and running language models on Windows, macOS, and Linux. Among other features, it allows you to work with models in GGUF format and expose them using a Local API supported by OpenAI.
This means that other applications can send requests to the model through an address like:
http://localhost:1234
AnythingLLM acts as the productivity layer. It allows you to create workspaces, save conversations, embed documents, configure agents, and connect different model providers. The system-wide model can also be replaced with a different one within a specific workspace.
AnythingLLM includes its own local modeling option, so LM Studio isn't required. However, connecting it is useful if you already manage your models from LM Studio, want to test different quantizations, or prefer to separate the inference engine from the document interface.
What you need before you start
To establish the connection, you must have both applications installed and a compatible model downloaded in LM Studio. It is also recommended to verify that the model works correctly within the LM Studio chat before attempting to use it from AnythingLLM.
Memory requirements will depend on the model, quantization, configured context, and the number of layers offloaded to the GPU. As a general guideline, LM Studio recommends at least 16 GB of RAM and, on Windows, a GPU with a minimum of 4 GB of dedicated VRAM.
This doesn't mean that any model will work well with that configuration. Small, quantized models are best to start with. A 7B or 8B model in Q4_K_M is usually a reasonable choice, but it also consumes additional memory for context, the KV cache, and inference operations.
In addition, it is advisable to use a model of the type Instruct or trained to converse. A basic model can generate text, but it will typically follow instructions less effectively and offer a less useful experience within AnythingLLM.
What are GGUF and quantization?

GGUF is one of the formats used to distribute models compatible with llama.cpp-based engines. It can contain model weights and various metadata necessary for proper loading.
Quantization reduces the precision used to store weights. This decreases file size and memory requirements, although it can also result in some loss of quality. A Q4 variant is significantly smaller than the original FP16 model, while Q5 or Q8 maintain higher precision at the cost of increased resource consumption.
Q4_K_M usually offers a good balance For home computers, it's not automatically the best option in every case. If you have enough memory and need greater precision, you can try Q5_K_M or Q8_0. If the model doesn't fit, you'll have to use lighter quantization, reduce the context, or choose a model with fewer parameters.
Also remember that 8B means approximately 8.000 billion parameters. In Spanish, it should not be translated as "ocho trillion" (eight trillion), as the English term... billion equivalent to one billion.
How to start the LM Studio local server
Open LM Studio and go to the model search or discovery section. Download a model suitable for your equipment and wait for the process to finish.
Next, open the section dedicated to the local server or developer mode, select the model, and load it. LM Studio typically uses the port 1234 for your local server.
The usual address will be:
http://localhost:1234
LM Studio offers OpenAI-compatible endpoints, such as the one used to list models:
http://localhost:1234/v1/models
You can open that address in your browser or make a request to check if the server is responding. If information about available models appears, the API is working.
Current versions of LM Studio also allow you to start the server from the terminal:
lms server start
The server can run in the background, but it must remain running while AnythingLLM is using it. If you stop LM Studio, download the model, or shut down the server, AnythingLLM will stop receiving responses.
How to connect LM Studio with AnythingLLM

With the server active, open AnythingLLM and go into its settings. Within the language model provider settings, select LM Studio.
If you use LM Studio and AnythingLLM Desktop on the same computer, enter this address:
http://127.0.0.1:1234/v1
It may also work:
http://localhost:1234/v1
AnythingLLM will query the server endpoint to display the available templates. Select the one you want to use and save the configuration.
If the list appears empty, check that the server is still running, the port is correct, and LM Studio allows the necessary connections. In some versions, you may need to load the model beforehand or manually select its identifier.
After saving your changes, create a workspace and start a simple conversation. Before adding documents, confirm that the model responds correctly to a standard message. This will help you distinguish between a connection problem and an issue related to RAG or embeddings.
Which address to use if AnythingLLM works in Docker
One of the most frequent errors occurs when AnythingLLM is run within Docker. In that case, localhost y 127.0.0.1 They point to the container itself, not to the computer where LM Studio is running.
In Docker Desktop for Windows or macOS you should normally use:
http://host.docker.internal:1234/v1
In some Docker installations on Linux, it may be necessary to use the Docker bridge address:
http://172.17.0.1:1234/v1
The exact address may vary if you've modified the Docker network. You should also configure LM Studio to accept connections from other devices on the local network or from the container. Do not expose the inference server directly to the internet without authentication and additional security measures.
If the connection continues to fail, check from the container whether the endpoint is reachable. The problem isn't with the model if AnythingLLM can't even reach port 1234.
Set up an embedding model
The conversational model and the embeddings model serve different functions. The former drafts the responses, while the latter transforms document fragments into numerical vectors so they can be found through semantic searches.
AnythingLLM includes a local embeddings model that is downloaded during first use. The representations generated by this model remain on the computer when using the local configuration.
You can also use LM Studio as an embedding provider, but to do so you must download and upload an specific embeddings modelYou should not automatically select the same LLM you use for chatting, as a conversational model does not necessarily offer a compatible embeddings endpoint.
The embedding provider's settings apply system-wide. If you change the model after indexing documents, the vector dimensions may differ. In that case, you'll need to delete and regenerate the embeds for the affected documents.
For easy installation, the most convenient option is to use LM Studio as the LLM provider and keep the default local embeddings model from AnythingLLM.
How to use documents and RAG
AnythingLLM allows you to attach documents directly to a conversation or incorporate them into a workspace using RAG. These are not exactly the same procedures.
When you attach a file to the chat, AnythingLLM can insert its content directly into the context of that conversation. This provides access to a larger portion of the document, but consumes more tokens and may exceed the model's context window.
When you integrate a document into a workspace, AnythingLLM divides it into fragments, generates its embeddings, and stores them in a vector database. When you ask a question, it retrieves the fragments it considers most relevant and delivers them to the model along with your query.
LanceDB is the default local vector database, although AnythingLLM supports other alternatives. It's not advisable to switch databases after indexing all files, as vectors are not automatically migrated and the documents will need to be reprocessed.
RAG can reduce fabricated responses by providing relevant information, but It does not completely eliminate hallucinationsThe model may misinterpret a fragment, retrieve an inappropriate section, or respond using its prior knowledge.
Adjust fragments and recovery

There is no single perfect fragment size for all documents. A technical manual, a table, a contract, and a novel all have very different structures. Always use between 1024 and 2048 characters does not guarantee better answers.
Small snippets offer more precise searches, but can detach an explanation from its context. Large snippets keep more information together, although they introduce noise and consume a larger portion of the available window.
Before modifying global parameters, test the default settings with questions you know the answers to. If the system doesn't retrieve the correct information, you can check the following:
- The size of the fragments and their overlap.
- The maximum number of fragments sent to the model.
- The quality of the text extracted from the file.
- The selected embedding model.
- The search mode and the reranking option.
- The context window available in the LLM.
AnythingLLM recommends typically keeping between four and six context snippets for many models. Sending too many can fill up the available window and introduce irrelevant information.
The precision-optimized search option retrieves more results and reorders them using a reranking model. This can improve relevance, but it adds resource consumption and some latency.
Use agents and tools
AnythingLLM includes agents capable of using tools such as web browsing, scraping, document querying, graph generation, and database access. They are typically invoked using the agent function available in the conversation.
Not all local models use tools with the same reliability. A small model might respond that it will perform an action without actually calling the tool correctly. For best results, use a model that explicitly indicates compatibility with tool use or function calls.
You should also only activate the necessary skills. Giving an agent access to the file system, a database, or external services expands what it can do, but also increases the impact of a misinterpreted instruction.
For SQL connections, use a read-only user whenever possible. Even if the agent is instructed to perform safe queries, actual restrictions must also be enforced at the database level.
Connect MCP servers with AnythingLLM
AnythingLLM supports tools provided via the Model Context Protocol. MCP servers can be added from the corresponding management screen or via the file anythingllm_mcp_servers.json located in the add-ons storage folder.
In AnythingLLM Desktop, MCP servers require a compatible version of the application and are used by agents. Furthermore, the implementation is focused on the MCP ToolsNot all protocol capabilities, such as Resources, Prompts, or Sampling, are necessarily available.
Before adding a server, check that commands like node, npx, uv o uvx They are installed when your configuration requires them. AnythingLLM does not automatically install all the programs required by each MCP server.
Do not run servers from unknown sources. An MCP tool can read files, query credentials, or modify information if it has the necessary permissions. AnythingLLM Cloud also does not offer MCP or custom agents due to these security implications; to use them, you need the desktop application or a compatible self-managed installation.
Privacy: how long data stays on the computer
The combination can work entirely locally if LM Studio runs the model, AnythingLLM uses local embeddings, and LanceDB stores the vectors on the same machine.
However, installing both applications does not guarantee that no data will leave your computer. Information can still be sent externally if you enable:
- A provider of cloud-hosted models or embeddings.
- A web browsing or search tool.
- A remote MCP server.
- A third-party API used by an agent.
- An external transcription or storage system.
If you're going to work with confidential documents, review each provider and tool individually. Also, keep in mind that documents embedded in a workspace may be accessible to other users with access to that workspace.
How to improve performance
If generation is too slow or LM Studio displays memory errors, start by choosing a smaller model or lighter quantization. You can also reduce the context window size and adjust the number of layers offloaded to the GPU.
On a computer with a dedicated GPU, LM Studio can distribute the model between VRAM and RAM using GPU Offload. The more layers that go to the GPU, the faster the model usually is, but you should allow headroom for the system, the KV cache, and other applications.
On Macs with Apple Silicon, the CPU and GPU share unified memory. This avoids some of the transfers typical of dedicated GPUs, but the operating system and other applications also need to use that memory.
It's incorrect to say that 16 GB of RAM and 6 GB of VRAM are more than enough for any 7B model. That configuration can run many quantized models, but the final resource consumption depends on the variant, the context, the backend, and the offload level.
70B models require significantly more memory even after quantization. They can run by distributing the load between the CPU and GPU or using multiple GPUs, although performance can drop considerably if much of the processing relies on RAM and the processor.
What to check if AnythingLLM won't connect to LM Studio
If the model does not appear or AnythingLLM returns an error, check these points:
- Check that the LM Studio server is running.
- Verify that the template is downloaded and available.
- Open
http://localhost:1234/v1/modelsto check the API. - Use
http://127.0.0.1:1234/v1with desktop applications. - Use
host.docker.internalif AnythingLLM is inside Docker Desktop. - Enables the necessary network connections in LM Studio.
- Check your Windows firewall and make sure port 1234 is not blocked.
- Confirm that the model fits in memory and has finished loading.
- Try a conversation first without documents or tools.
If the normal chat works but the file responses are incorrect, the problem is likely to be in the embeddings model, document extraction, indexing, or recovery settings.
With LM Studio as your inference engine and AnythingLLM as your interface for documents and agents, you can build a flexible local assistant without necessarily relying on a cloud API. The key is to take the right approach, differentiate LLM from the embedding model, and review which external tools have access to the information.
I am a technology enthusiast who has turned his "geek" interests into a profession. I have spent more than 10 years of my life using cutting-edge technology and tinkering with all kinds of programs out of pure curiosity. Now I have specialized in computer technology and video games. This is because for more than 5 years I have been writing for various websites on technology and video games, creating articles that seek to give you the information you need in a language that is understandable to everyone.
If you have any questions, my knowledge ranges from everything related to the Windows operating system as well as Android for mobile phones. And my commitment is to you, I am always willing to spend a few minutes and help you resolve any questions you may have in this internet world.
