<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho" -->

---
title: Spring AI Tutorial : 02 - Chat with Gemini, Groq,...
description: A hands-on walkthrough shows how to swap free OpenAI-compatible LLM providers into a Spring AI application without changing code, only Spring profile...
canonical: https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE | daily.dev
og:description: A hands-on walkthrough shows how to swap free OpenAI-compatible LLM providers into a Spring AI application without changing code, only Spring profile...
og:url: https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho
og:image: https://api.daily.dev/og/posts/CztgtnRHo.png
og:image:alt: Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE
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.

# Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE

**[SivaLabs \(YouTube\)](https://daily.dev/sources/sivalabs-youtube)** · 17 min read · 0 upvotes · 0 comments

## Summary

A hands-on walkthrough shows how to swap free OpenAI-compatible LLM providers into a Spring AI application without changing code, only Spring profile properties. Covers configuring Gemini (Google AI Studio), Groq, OpenRouter (which proxies to models like Qwen3 Coder and DeepSeek), and Docker Model Runner for local model inference, using Spring profiles and MockMvcTester integration tests to verify each provider by asking for a Java joke.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=efRd68orIqY>

## Questions this post answers

### How do I switch a Spring AI application from OpenAI to Gemini without changing code?

Create a Spring profile-specific properties file, such as application-gemini.properties, that overrides the base URL, completions path, API key, and model name. Since Gemini exposes an OpenAI-compatible endpoint, activating that profile (e.g. via IntelliJ's active profile setting) redirects the same chat controller code to Google's Gemini 2.0 Flash model instead of OpenAI, with no code changes required.

_daily.dev surfaces practical guides like this for developers wiring multiple LLM providers into Spring AI._

### Can I use OpenRouter to access DeepSeek models for free instead of paying for a DeepSeek API key?

Yes, OpenRouter acts as a proxy that exposes an OpenAI-compatible API and can route requests to DeepSeek and other models, including some marked free on its model list. Configuring the OpenRouter base URL, API key, and a free model name (such as a DeepSeek or Qwen3 Coder variant) in a Spring properties file lets an app reach models that would otherwise require a paid subscription.

_Developers comparing LLM routing options can find similar cost-saving tricks on daily.dev._

### How do I run a local LLM with Docker Model Runner and connect it to a Java application?

Enable Docker Model Runner and host-side TCP support in Docker Desktop's beta features, pull a lightweight model like AI/smallm2 from Docker Hub, then point the application at the local host port shown in the Docker Desktop model settings. No real API key is needed, though a placeholder value must still be supplied since the field cannot be left empty.

_daily.dev helps developers track local-inference setups like Docker Model Runner for LLM experimentation._

## Similar posts on daily.dev

- [Introduction to Google GenAI Chat and Spring AI](https://daily.dev/posts/introduction-to-google-genai-chat-and-spring-ai-h3wj5zlvx) · Baeldung · 1 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
- [Spring AI Series](https://daily.dev/posts/spring-ai-series-j7w3rmryb) · Baeldung · 4 upvotes · 0 comments

---

Tags: [#llm](https://daily.dev/tags/llm), [#java](https://daily.dev/tags/java), [#docker](https://daily.dev/tags/docker), [#google-gemini](https://daily.dev/tags/google-gemini), [#spring-ai](https://daily.dev/tags/spring-ai)

[View this post on daily.dev](https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho)

```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":"Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE","url":"https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho"},"datePublished":"2026-09-27T07:26:41.322Z","dateModified":"2026-09-27T07:53:23.410Z","description":"A hands-on walkthrough shows how to swap free OpenAI-compatible LLM providers into a Spring AI application without changing code, only Spring profile...","image":"https://i.ytimg.com/vi/efRd68orIqY/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/efRd68orIqY/sddefault.jpg","isAccessibleForFree":true,"articleSection":"SivaLabs (YouTube)","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":"SivaLabs (YouTube)","logo":"https://media.daily.dev/image/upload/s--8ATVo4an--/f_auto,q_auto/v1790493987/logos/sivalabs-youtube?_a=BAMAMicg0","url":"https://daily.dev/sources/sivalabs-youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"llm,java,docker,google-gemini,spring-ai","timeRequired":"PT17M","video":{"@type":"VideoObject","name":"Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE","description":"A hands-on walkthrough shows how to swap free OpenAI-compatible LLM providers into a Spring AI application without changing code, only Spring profile...","thumbnailUrl":"https://i.ytimg.com/vi/efRd68orIqY/sddefault.jpg","uploadDate":"2026-09-27T07:26:41.322Z","duration":"PT17M","url":"https://api.daily.dev/r/CztgtnRHo","embedUrl":"https://www.youtube.com/embed/efRd68orIqY"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SivaLabs (YouTube)","item":"https://daily.dev/sources/sivalabs-youtube"},{"@type":"ListItem","position":3,"name":"Spring AI Tutorial : 02 - Chat with Gemini, Groq, OpenRouter, Docker Model Runner for FREE"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-ai-tutorial-02---chat-with-gemini-groq-openrouter-docker-model-runner-for-free-cztgtnrho#faq","mainEntity":[{"@type":"Question","name":"How do I switch a Spring AI application from OpenAI to Gemini without changing code?","acceptedAnswer":{"@type":"Answer","text":"Create a Spring profile-specific properties file, such as application-gemini.properties, that overrides the base URL, completions path, API key, and model name. Since Gemini exposes an OpenAI-compatible endpoint, activating that profile (e.g. via IntelliJ's active profile setting) redirects the same chat controller code to Google's Gemini 2.0 Flash model instead of OpenAI, with no code changes required. daily.dev surfaces practical guides like this for developers wiring multiple LLM providers into Spring AI."}},{"@type":"Question","name":"Can I use OpenRouter to access DeepSeek models for free instead of paying for a DeepSeek API key?","acceptedAnswer":{"@type":"Answer","text":"Yes, OpenRouter acts as a proxy that exposes an OpenAI-compatible API and can route requests to DeepSeek and other models, including some marked free on its model list. Configuring the OpenRouter base URL, API key, and a free model name (such as a DeepSeek or Qwen3 Coder variant) in a Spring properties file lets an app reach models that would otherwise require a paid subscription. Developers comparing LLM routing options can find similar cost-saving tricks on daily.dev."}},{"@type":"Question","name":"How do I run a local LLM with Docker Model Runner and connect it to a Java application?","acceptedAnswer":{"@type":"Answer","text":"Enable Docker Model Runner and host-side TCP support in Docker Desktop's beta features, pull a lightweight model like AI/smallm2 from Docker Hub, then point the application at the local host port shown in the Docker Desktop model settings. No real API key is needed, though a placeholder value must still be supplied since the field cannot be left empty. daily.dev helps developers track local-inference setups like Docker Model Runner for LLM experimentation."}}]}
```

