What Can You Do After Deploying a Local LLM? Building an Excel AI Assistant

    A practical guide to what local LLM deployment enables, why privacy, cost, offline access, and customization matter, and how to connect a local model to Excel through VBA, an API gateway, and a local inference runtime, including working code and engineering tips.

    What Can You Do After Deploying a Local LLM? From Fundamentals to an Excel AI Assistant

    As open-source large language models continue to improve, more developers are deploying models in local environments. After deployment, the first question is often: the model is running, so what can I do with it? This article first reviews the core value and typical application directions of local deployment, then walks through a complete example: embedding a private AI assistant into a spreadsheet.

    Why Choose Local Deployment

    Before discussing what you can build, it helps to clarify the main advantages of local deployment compared with calling a cloud API directly. These advantages determine which scenarios are a good fit.

    1. Data stays inside the local network, with controllable privacy. Local inference means all inputs and outputs remain on your own machine or within your company network. Nothing is sent to a third-party server. For scenarios involving financial data, customer records, internal documents, and other sensitive information, this is a decisive factor.

    2. No per-token billing, with predictable costs. Cloud APIs usually charge by token, and costs can accumulate quickly in high-frequency scenarios. With local deployment, inference only consumes local compute. There is no limit on the number of calls, which makes it suitable for batch processing and automation tasks.

    3. Offline availability, independent of network conditions. In environments without internet access or with unstable connectivity, such as isolated server rooms or field operations, a local model can still work.

    4. Deep customization. A local model can be combined with a private knowledge base for retrieval-augmented generation, or fine-tuned to build capabilities tailored to a specific business.

    Of course, local deployment has trade-offs. Limited by hardware VRAM, it usually runs smaller distilled or quantized models, so reasoning capability may be lower than flagship cloud models. When selecting a model, match its size to your machine configuration. For a typical consumer-grade GPU, a quantized model in the 7B–14B range is a reasonable starting point. On machines with less memory, you can start with a small model around 1.5B.

    Typical Application Directions for Local LLMs

    After deployment, the model is essentially a backend that provides inference through an HTTP API. Any program that can send HTTP requests can call it. Common application directions include:

    • Office automation: Embed the model in spreadsheets or document editors for text polishing, data interpretation, formula generation, and batch translation.
    • Private knowledge base Q&A: Use retrieval-augmented generation (RAG) to answer questions over internal documents and product manuals.
    • Code assistance: Provide code completion, explanation, and refactoring suggestions inside a local IDE, without sending code off the machine.
    • Data batch processing: Perform batch classification, summarization, and sentiment analysis on logs, reviews, tickets, and other text.
    • Automation workflow integration: Combine the model with scripts and scheduled tasks to build unattended intelligent processing pipelines.

    The following section uses the spreadsheet AI assistant scenario, which has a low barrier to entry and broad audience, to walk through the full implementation process.

    Overall Architecture

    The goal of this solution is simple: enter a question in a spreadsheet cell, click a button, call the local LLM, and write the reasoning process and answer back to specified cells. The overall pipeline has four layers:

    1. User input (cell A2) → VBA macro (HTTP client) → local API gateway service → local inference runtime (loads LLM)
    2. ↓
    3. User reads result (cell A4) ← response parsing ← JSON/SSE streaming response ← model generation

    The responsibilities of each layer are as follows:

    • Local inference runtime: Loads model files and performs inference calculations, exposing a standardized model invocation interface. Several open-source runtimes are available, and they generally support pulling and running models from the command line.
    • Local API gateway / conversation management service: Wraps the inference runtime with a unified REST interface and provides workspace management, API key authentication, and conversation context maintenance. The benefit of this layer is that upper-layer applications only need to integrate with one stable interface. Changing the underlying model or runtime does not require changing the calling code.
    • VBA macro: The built-in programming capability in the spreadsheet acts as an HTTP client. It reads the input, sends the request, parses the response, and writes the result back.

    Environment Preparation and Deployment Steps

    Step 1: Install a local inference runtime. Choose a mainstream open-source local model runtime and complete the installation. Confirm that its command-line tool is available and that the local service port, typically 11434 or a similar port, is listening.

    Step 2: Pull and run a model. Pull a suitable open-source inference model from the model repository provided by the runtime. The model size must match your hardware. If VRAM is insufficient, prefer a quantized version. After pulling, run a simple chat test to confirm that the model can generate output normally.

    Step 3: Deploy the API gateway service. Install a conversation management application that supports local model integration. In its configuration, enter the endpoint of the inference runtime and specify the model deployed in the previous step. Then complete two key configuration tasks:

    1. Create a workspace and record its name. When calling the API, the name is usually required in lowercase.
    2. Generate an API key in the application’s developer settings for API authentication.

    After configuration, send a test request with a command-line tool or API debugging tool to confirm that the gateway can forward the request correctly and return the model response. Then proceed with the spreadsheet-side development.

    Step 4: Confirm the spreadsheet environment. Make sure desktop spreadsheet software that supports VBA macros is installed, and enable macros and the Developer tab in settings.

    Writing the VBA Call Code

    In Excel, press Alt + F11 to open the VBA editor, insert a new module, and write the following core code:

    1. Sub CallLocalLLM()
    2. Dim question As String, url As String, apiKey As String
    3. Dim http As Object, requestBody As String, response As String
    4. ' 1. Read the question from cell A2
    5. question = ThisWorkbook.Sheets(1).Range("A2").Value
    6. If Len(Trim(question)) = 0 Then
    7. MsgBox "Please enter a question in cell A2"
    8. Exit Sub
    9. End If
    10. ' 2. Configure the local API URL and key
    11. url = "http://localhost:3001/api/v1/workspace/your-workspace-name/stream-chat"
    12. apiKey = "replace-with-your-api-key"
    13. ' 3. Build the HTTP request
    14. Set http = CreateObject("MSXML2.XMLHTTP")
    15. http.Open "POST", url, False
    16. http.setRequestHeader "accept", "text/event-stream"
    17. http.setRequestHeader "Content-Type", "application/json"
    18. http.setRequestHeader "Authorization", "Bearer " & apiKey
    19. ' 4. Build the JSON request body (double quotes must be escaped in VBA)
    20. requestBody = "{""message"":""" & question & """,""mode"":""chat""}"
    21. http.send requestBody
    22. ' 5. Process the response
    23. If http.Status = 200 Then
    24. response = http.responseText
    25. ThisWorkbook.Sheets(1).Range("A4").Value = ParseNestedJSON(response)
    26. Else
    27. ThisWorkbook.Sheets(1).Range("A4").Value = "Request failed. Status code: " & http.Status
    28. End If
    29. End Sub

    Several points in the code require attention:

    • Synchronous vs. asynchronous: In the example, the third parameter of http.Open is set to False, which means synchronous blocking mode. The macro waits until the request returns. Model inference can take a long time, and tens of seconds is normal. This is an acceptable simplification. For a better interaction experience, you can switch to asynchronous mode with a callback.
    • JSON escaping: Double quotes inside VBA strings must be written as two consecutive double quotes. Check the request body carefully when constructing it. If the question may contain quotes, line breaks, or other special characters, escape and sanitize question first. Otherwise, the request body may become invalid.
    • Response parsing: The gateway returns streaming events in SSE format. Each line starts with data: and carries a JSON fragment. ParseNestedJSON must be implemented separately: iterate over each line, strip the prefix, extract the text field from the JSON, and concatenate the fragments to produce the complete answer. If the model outputs both a reasoning process and a final answer, you can choose what to keep during parsing. For example, write only the final conclusion to the cell, and put the reasoning process in a comment or another cell for reference.

    Finally, insert a button control in the spreadsheet and bind its macro to CallLocalLLM. The assistant is then ready to use: enter a question in A2, click the button, and read the answer in A4.

    Engineering Optimization Suggestions

    After the basic functionality works, you can refine it in the following directions:

    1. Timeouts and exception handling: Set reasonable timeouts for HTTP requests and provide friendly messages for network errors, service not started, and similar failures. Avoid freezing the spreadsheet interface.
    2. Multi-turn conversation support: Switch the mode parameter to conversation mode and pass a conversation identifier so the model can remember context and support follow-up questions.
    3. Batch processing: Submit questions from multiple rows in a column in a loop and write results to an adjacent column. This enables batch translation, batch classification, and other automation scenarios. Control the request pace to avoid overloading local compute.
    4. Structured results: In the prompt, ask the model to output in a fixed format, such as JSON or table text, so formulas or scripts can process the result later.
    5. Prompt templates: Preset a system prompt in the workspace or request body, for example, “You are a financial analysis assistant,” so the response style fits the specific business context.

    Conclusion

    Local LLM deployment is not the end point. It is the starting point. With the general architecture of “inference runtime + API gateway + any HTTP client,” model capabilities can be embedded into spreadsheets, scripts, internal systems, and almost any other tool. The spreadsheet assistant in this article is only an entry-level example. Once you understand this approach, you can extend it to private knowledge base Q&A, scheduled scripts for log summaries, and offline intelligent services for an organization. It is also worth noting that when business scale grows and local compute becomes insufficient, the same architecture can be migrated to cloud model services. For example, Baidu AI Cloud provides model inference and AI application development capabilities. The calling logic does not need major changes. Replacing the endpoint and key can provide stronger model performance and elastic compute where data compliance allows.