<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk" -->

---
title: Building a Clone of ChatGPT | Spring AI | daily.dev
description: A walkthrough of building a ChatGPT-like clone using Spring AI and Java. Covers creating a REST controller endpoint, using ChatModel vs ChatClient (with...
canonical: https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building a Clone of ChatGPT | Spring AI | daily.dev
og:description: A walkthrough of building a ChatGPT-like clone using Spring AI and Java. Covers creating a REST controller endpoint, using ChatModel vs ChatClient (with...
og:url: https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk
og:image: https://api.daily.dev/og/posts/ju2NEpbMk.png
og:image:alt: Building a Clone of ChatGPT | Spring AI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

[Telusko](https://daily.dev/sources/telusko)

[Watch video](https://api.daily.dev/r/ju2NEpbMk)

# [Building a Clone of ChatGPT | Spring AI](https://api.daily.dev/r/ju2NEpbMk "Go to post")

A walkthrough of building a ChatGPT-like clone using Spring AI and Java. Covers creating a REST controller endpoint, using ChatModel vs ChatClient (with builder pattern), fetching response metadata including token usage and model name, and adding conversation memory via MessageChatMemoryAdvisor so the LLM can recall previous messages in a session. Also briefly explains how LLM providers charge based on token consumption.

[#java](/tags/java "Check all #java posts")[#llm](/tags/llm "Check all #llm posts")[#rest-api](/tags/rest-api "Check all #rest-api posts")[#anthropic](/tags/anthropic "Check all #anthropic posts")[#spring-ai](/tags/spring-ai "Check all #spring-ai posts")

Mar 15•27m watch time

Comment

Bookmark

Copy

![Placeholder image for anonymous user](https://media.daily.dev/image/upload/s--qsFuKGv_--/t_logo,f_auto/public/noProfile)Share your thoughtsPost

[![Telusko's image](https://media.daily.dev/image/upload/s--xVEBUipN--/f_auto/v1728072944/logos/telusko)](https://daily.dev/sources/telusko)

[Telusko](https://daily.dev/sources/telusko "https://daily.dev/sources/telusko")

128 Followers

•

714 Upvotes

#### Would you recommend this post?

Copy link

WhatsApp

Facebook

X

New Squad

Copy linkShare with your friends

```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":"Building a Clone of ChatGPT | Spring AI","url":"https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk"},"datePublished":"2026-03-15T07:33:06.242Z","dateModified":"2026-03-15T07:47:11.795Z","description":"A walkthrough of building a ChatGPT-like clone using Spring AI and Java. Covers creating a REST controller endpoint, using ChatModel vs ChatClient (with...","image":"https://i.ytimg.com/vi/bHF2F8XcmSs/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/bHF2F8XcmSs/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Telusko","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":"Telusko","logo":"https://media.daily.dev/image/upload/s--xVEBUipN--/f_auto/v1728072944/logos/telusko","url":"https://daily.dev/sources/telusko"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-a-clone-of-chatgpt-spring-ai-ju2nepbmk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,llm,rest-api,anthropic,spring-ai","timeRequired":"PT27M","video":{"@type":"VideoObject","name":"Building a Clone of ChatGPT | Spring AI","description":"A walkthrough of building a ChatGPT-like clone using Spring AI and Java. Covers creating a REST controller endpoint, using ChatModel vs ChatClient (with...","thumbnailUrl":"https://i.ytimg.com/vi/bHF2F8XcmSs/sddefault.jpg","uploadDate":"2026-03-15T07:33:06.242Z","duration":"PT27M","url":"https://api.daily.dev/r/ju2NEpbMk","embedUrl":"https://www.youtube.com/embed/bHF2F8XcmSs"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Telusko","item":"https://daily.dev/sources/telusko"},{"@type":"ListItem","position":3,"name":"Building a Clone of ChatGPT | Spring AI"}]}
```

