This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
GitHub credentials are required for the private JClouds Maven package (hosted on GitHub Packages):
# Set credentials via environment variables
export GPR_USERNAME=<github_user>
export GPR_PASSWORD=<github_token>
# Build (skip tests)
./gradlew build -x test
# Run all tests
./gradlew test
# Run tests for a specific module
./gradlew :server:test
# Run a single test class
./gradlew :server:test --tests "com.epam.aidial.core.server.ResourceApiTest"
# Run a single test method
./gradlew :server:test --tests "com.epam.aidial.core.server.ResourceApiTest.testWorkflow"
# Checkstyle
./gradlew checkstyleMain checkstyleTest
# Run locally
./gradlew :server:runAt runtime, set AIDIAL_SETTINGS env var pointing to a JSON settings file (see sample/aidial.settings.json).
AI DIAL Core is an HTTP reverse proxy / API gateway for LLMs built on Java 21 + Eclipse Vert.x (reactive, non-blocking). It exposes an OpenAI-compatible API and routes requests to backend AI providers (Azure OpenAI, AWS, GCP, etc.).
| Module | Root Package | Responsibility |
|---|---|---|
config |
com.epam.aidial.core.config |
POJOs for the dynamic config (Config, Model, Application, Key, Role, Route, Interceptor, ToolSet, Upstream, Limit, …) + JSON validation |
storage |
com.epam.aidial.core.storage |
Blob storage abstraction via Apache JClouds (S3, GCS, Azure Blob, filesystem), Redis-backed resource service, resource descriptors, locking |
credentials |
com.epam.aidial.core.credentials |
OAuth2 token management, AES credential encryption, KMS integration (AWS/Azure/GCP) |
server |
com.epam.aidial.core.server |
Entry point (AiDial.java), HTTP proxy engine (Proxy.java), all controllers, services, security, rate limiting, upstream load balancing, telemetry |
controller/— HTTP request handlers (chat completions, embeddings, file upload, resource CRUD, sharing, publications, toolsets, health check)service/— Business logic (ApplicationService, PublicationService, ShareService, RuleService, ToolSetService, CodeInterpreterService, …)security/— JWT validation (JWKS), API key store, AES encryption service, access controlupstream/— Load balancing: tiered + weighted random over upstream endpointslimiter/— Token-based and request-based rate limiting (per-minute/per-day per role)token/— Token usage stats tracking and per-provider response parsingfunction/— Request/response transformation middleware pipelinetracing/— OpenTelemetry span processingconfig/— Dynamic config hot-reload (FileConfigStore)
Two config files govern the system:
- Static settings (
aidial.settings.json): Vert.x server/client options, blob storage provider, Redis connection, identity providers, encryption keys, metrics endpoints. Not hot-reloaded. - Dynamic config (
aidial.config.json): models, applications, API keys, roles, interceptors, routes, toolsets, rate-limit pricing. Hot-reloaded at runtime.
See sample/ for examples of both files; server/src/main/resources/aidial.settings.json contains the built-in defaults.
- Java 21, Gradle 8, Lombok (via
io.freefair.lombokplugin) - Eclipse Vert.x 4.5 — async HTTP server/client (event-loop model)
- Apache JClouds — multi-cloud blob storage
- Redisson — Redis client (caching, distributed locks)
- Jackson 2.18 — JSON serialization
- Auth0 java-jwt + jwks-rsa — JWT/JWKS authentication
- Micrometer (Prometheus + OTLP) + OpenTelemetry SDK — metrics & tracing
- JUnit 5 + Mockito 5 + Vert.x JUnit 5 — testing; integration tests start the full stack with embedded Redis and OkHttp
MockWebServerfor upstream simulation - Checkstyle — Google Java Style, 180-char line limit (
checkstyle/checkstyle.xml)
Use comments sparingly. Only comment complex code.