Practical overview
When it fits
Use it when adding language-model features to a Quarkus application and you want a declarative Java interface, with the option to use lower-level LangChain4j APIs for additional control.
Who it is for
- Java developers building Quarkus applications with model-backed features.
- Teams adding classification, text extraction, summarization, chat, or retrieval-augmented search to Quarkus services.
Documented uses
- Call a language model from an annotated Java interface.
- Add model-backed text classification, triage, extraction or generation to an application.
- Build chat assistants and retrieval-augmented search or question-answering features.
- Configure model integrations and Quarkus observability within an application.
Requirements & limits
- The extension builds on LangChain4j and provides a Quarkus-oriented declarative programming model.
- The quickstart requires a model-provider dependency and provider credentials; its example uses an OpenAI API key.
- The documentation identifies OpenAI, Hugging Face and Ollama among supported model-serving options.
- Developers can choose between the high-level @RegisterAiService approach and lower-level LangChain4j APIs.
- The documentation describes integrations for retrieval stores, observability, chat memory, function calling and agentic patterns.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up a model-backed Quarkus AI service
Configure the documented OpenAI example and define a Java interface that invokes a model.
Before you start
- A Quarkus project using Maven.
- The Quarkus LangChain4j OpenAI extension dependency, with versions aligned through the Quarkus LangChain4j BOM or specified directly.
- An OpenAI API key configured in application.properties or the documented environment variable.
Steps
Add the quarkus-langchain4j-openai dependency to the project; the quickstart also shows importing the Quarkus LangChain4j BOM for dependency version alignment.
Set quarkus.langchain4j.openai.api-key in application.properties, or set QUARKUS_LANGCHAIN4J_OPENAI_API_KEY.
Declare a Java interface annotated with @RegisterAiService and define a method with a prompt annotation, as shown in the quickstart.
Expected outcome
The application has a declared AI service whose method can invoke the configured model; the quickstart’s example generates a poem from method parameters.
Guide limitations
- This covers extension configuration and AI-service declaration; it does not include steps to run or package the application.
- The illustrated provider is OpenAI; other providers have their own documented configuration.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 13 November 2026
- Original website title
- Quarkus LangChain4j :: Quarkiverse Documentation · Official homepage title · retained in its source language

