Skip to content

Spring AI from NordRouter

Add starter spring-ai-starter-model-openai, then configure application.properties:

properties
spring.ai.openai.api-key=${NORDROUTER_API_KEY}
spring.ai.openai.base-url=https://nordrouter.com
spring.ai.openai.chat.model=anthropic/claude-sonnet-4.6

Spring AI itself adds /v1/chat/completions to the base address.

java
String answer = chatClient.prompt()
    .user("Ответь: работает")
    .call()
    .content();

If the version you are using sends a request without /v1, set the chat-specific address spring.ai.openai.chat.base-url=https://nordrouter.com/v1 and check the URL in the debug log.

Official information:Spring AI OpenAI Chat.

All programs