tramai-spring-provider-anthropic
Version: 0.6.0
Status: Preview
Role: Provider adapter module: Anthropic configuration for Spring applications.
Purpose
This adapter registers an AnthropicProvider from application properties. Like the other Spring provider adapters it constructs a provider and nothing else: model routing, retries, fallbacks and resilience stay in the runtime.
What it provides
| Component | Detail |
|---|---|
AnthropicProviderAutoConfiguration | Registered through META-INF/spring/...AutoConfiguration.imports; backs off when the application defines its own Tramai bean |
AnthropicProperties | Binds tramai.providers.anthropic.* |
anthropicProvider bean | A SpringConfiguredModelProvider with provider id anthropic |
| Key | Notes |
|---|---|
tramai.providers.anthropic.api-key | Direct key |
tramai.providers.anthropic.api-key-secret-ref | Secret reference resolved through the shared chain (env:, file:, vault:, aws-secretsmanager:) |
tramai.providers.anthropic.base-url | Defaults to https://api.anthropic.com |
Setting api-key and api-key-secret-ref together fails startup; a secret reference that no resolver can resolve fails startup as well. With no key at all the auto-configuration contributes nothing, so the provider is simply absent.
Dependencies
dependencies {
implementation(platform("dev.tramai:tramai-bom:0.6.0"))
implementation("dev.tramai:tramai-spring-boot-starter")
implementation("dev.tramai:tramai-spring-provider-anthropic")
}
tramai:
models:
claude-sonnet-4-5: anthropic
providers:
anthropic:
api-key-secret-ref: env:ANTHROPIC_API_KEY
When to use this module
- You call Claude from a Spring application and want credentials bound from configuration.
- You want the key resolved from Vault or AWS Secrets Manager rather than an environment variable.
When NOT to use this module
- You expect retry, fallback or budget policy here — configure
tramai.resilience.*andtramai.cost.*instead. - You are not using Spring: construct
AnthropicProviderdirectly with tramai-anthropic. - You want to add a new provider: depend on tramai-spring-core and follow the same adapter shape.
