<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp" -->

---
title: Integrating Local LLMs with Spring AI Using LM Studio
description: A step-by-step guide to integrating Spring AI with LM Studio for running LLMs locally. Covers Maven dependencies, application.yml configuration using the...
canonical: https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Integrating Local LLMs with Spring AI Using LM Studio | daily.dev
og:description: A step-by-step guide to integrating Spring AI with LM Studio for running LLMs locally. Covers Maven dependencies, application.yml configuration using the...
og:url: https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp
og:image: https://api.daily.dev/og/posts/ckB5XJjdP.png
og:image:alt: Integrating Local LLMs with Spring AI Using LM Studio
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrating Local LLMs with Spring AI Using LM Studio

**[Baeldung](https://daily.dev/sources/baeldung)** · 5 min read · 2 upvotes · 0 comments

## Summary

A step-by-step guide to integrating Spring AI with LM Studio for running LLMs locally. Covers Maven dependencies, application.yml configuration using the OpenAI-compatible API endpoint, and building REST endpoints for both chat and embedding models. Demonstrates how to avoid sending data to cloud providers by hosting models locally, with curl-based test examples using Google's Gemma 4 chat model and a 300M embedding model.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://feeds.feedblitz.com/~/961624313/0/baeldung~Integrating-Local-LLMs-with-Spring-AI-Using-LM-Studio>

## Questions this post answers

### How do I connect Spring AI to LM Studio for local chat and embedding models?

Use the spring-ai-starter-model-openai dependency, since LM Studio exposes OpenAI-compatible endpoints and the Anthropic-compatible module lacks embedding support. Configure application.yml with an arbitrary api-key, the base-url pointing to LM Studio's local server with a /v1 suffix, and optional chat/embedding model names when multiple models are loaded.

_Developers wiring local models into Spring apps can browse related Spring AI setups on daily.dev._

### Why does Spring AI Anthropic not work for embedding models with LM Studio?

The Spring AI Anthropic dependency does not support embedding models at all, only chat models. Because LM Studio offers both OpenAI-compatible and Anthropic-compatible endpoints, choosing the OpenAI-compatible Spring AI dependency is necessary to get embedding functionality alongside chat.

_Anyone picking between Spring AI integrations can compare tradeoffs like this on daily.dev._

### What is the difference between LM Studio and Ollama for running local LLMs?

LM Studio provides a graphical desktop interface for browsing, downloading, and hosting models, plus OpenAI- and Anthropic-compatible API endpoints, making it more beginner-friendly. Ollama is primarily a command-line tool without a model-browsing interface, better suited to CLI-driven workflows. Both let frameworks like Spring AI interact with locally hosted models.

_Developers deciding between local LLM tools can weigh options like this on daily.dev._

## Similar posts on daily.dev

- [Local AI Models with LM Studio and Spring AI](https://daily.dev/posts/local-ai-models-with-lm-studio-and-spring-ai-eo7mw3wk4) · Piotr Minkowski TechBlog · 0 upvotes · 0 comments
- [Integrating LLMs with Ollama and Spring AI](https://daily.dev/posts/integrating-llms-with-ollama-and-spring-ai-ftjw4akn6) · codecentric · 0 upvotes · 0 comments
- [Spring AI tutorial: Get started with Spring AI](https://daily.dev/posts/spring-ai-tutorial-get-started-with-spring-ai-phjfbwkwg) · InfoWorld · 0 upvotes · 0 comments
- [I run Claude, ChatGPT, and my local LLM through one interface, and I'm not going back](https://daily.dev/posts/i-run-claude-chatgpt-and-my-local-llm-through-one-interface-and-i-m-not-going-back-4btre1plt) · XDA Developers · 0 upvotes · 0 comments
- [Running local models is good now](https://daily.dev/posts/running-local-models-is-good-now-q20vqhe78) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#llm](https://daily.dev/tags/llm), [#java](https://daily.dev/tags/java), [#embeddings](https://daily.dev/tags/embeddings), [#spring-ai](https://daily.dev/tags/spring-ai), [#lm-studio](https://daily.dev/tags/lm-studio)

[View this post on daily.dev](https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Integrating Local LLMs with Spring AI Using LM Studio","url":"https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp"},"datePublished":"2026-07-22T11:32:22.731Z","dateModified":"2026-09-14T08:54:10.281Z","description":"A step-by-step guide to integrating Spring AI with LM Studio for running LLMs locally. Covers Maven dependencies, application.yml configuration using the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ebafd2222608245ba4447db750943c20?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ebafd2222608245ba4447db750943c20?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Baeldung","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Baeldung","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/52cccfb454d946c4b7dfa5e816f9e576","url":"https://daily.dev/sources/baeldung"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"llm,java,embeddings,spring-ai,lm-studio","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Baeldung","item":"https://daily.dev/sources/baeldung"},{"@type":"ListItem","position":3,"name":"Integrating Local LLMs with Spring AI Using LM Studio"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/integrating-local-llms-with-spring-ai-using-lm-studio-ckb5xjjdp#faq","mainEntity":[{"@type":"Question","name":"How do I connect Spring AI to LM Studio for local chat and embedding models?","acceptedAnswer":{"@type":"Answer","text":"Use the spring-ai-starter-model-openai dependency, since LM Studio exposes OpenAI-compatible endpoints and the Anthropic-compatible module lacks embedding support. Configure application.yml with an arbitrary api-key, the base-url pointing to LM Studio's local server with a /v1 suffix, and optional chat/embedding model names when multiple models are loaded. Developers wiring local models into Spring apps can browse related Spring AI setups on daily.dev."}},{"@type":"Question","name":"Why does Spring AI Anthropic not work for embedding models with LM Studio?","acceptedAnswer":{"@type":"Answer","text":"The Spring AI Anthropic dependency does not support embedding models at all, only chat models. Because LM Studio offers both OpenAI-compatible and Anthropic-compatible endpoints, choosing the OpenAI-compatible Spring AI dependency is necessary to get embedding functionality alongside chat. Anyone picking between Spring AI integrations can compare tradeoffs like this on daily.dev."}},{"@type":"Question","name":"What is the difference between LM Studio and Ollama for running local LLMs?","acceptedAnswer":{"@type":"Answer","text":"LM Studio provides a graphical desktop interface for browsing, downloading, and hosting models, plus OpenAI- and Anthropic-compatible API endpoints, making it more beginner-friendly. Ollama is primarily a command-line tool without a model-browsing interface, better suited to CLI-driven workflows. Both let frameworks like Spring AI interact with locally hosted models. Developers deciding between local LLM tools can weigh options like this on daily.dev."}}]}
```

