A Spring Boot middleware service for chatting with an LLM through different AI personalities. Built with Java 25 and Spring Boot 4 as part of a school assignment.
- music-nerd — knows everything about every genre and artist, has strong opinions
- dungeon-master — responds to everything like it's an epic fantasy quest
- expert-coder — direct, precise, slightly impatient with vague questions
- default — a friendly and helpful assistant
You'll need Java 25 and Maven installed.
- Clone the repo and create a
.envfile from the example:
cp .env.example .env- Add your OpenRouter API key to
.env— you can get a free one at openrouter.ai:
AI_API_KEY=your-key-here
AI_MODEL=openrouter/free- Run it:
./mvnw spring-boot:runOpen http://localhost:8080 and start chatting.
{
"personality": "music-nerd",
"message": "What is a for-loop?",
"sessionId": "optional-session-id"
}| Field | Type | Required | Description |
|---|---|---|---|
| personality | String | Yes | Determines the system prompt. Options: music-nerd, dungeon-master, expert-coder, default |
| message | String | Yes | The user's message |
| sessionId | String | No | Used to maintain conversation history across requests |
The sessionId is optional — include it if you want the AI to remember previous messages in the conversation.
Swagger UI is available at http://localhost:8080/swagger-ui.html when running with the dev profile active.
- Java 25, Spring Boot 4
- Spring RestClient
- Caffeine Cache (conversation memory)
- springdoc-openapi (Swagger)
- WireMock (testing)
