TramAI - governed AI workflows for Java and Kotlin

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

ComponentDetail
AnthropicProviderAutoConfigurationRegistered through META-INF/spring/...AutoConfiguration.imports; backs off when the application defines its own Tramai bean
AnthropicPropertiesBinds tramai.providers.anthropic.*
anthropicProvider beanA SpringConfiguredModelProvider with provider id anthropic
KeyNotes
tramai.providers.anthropic.api-keyDirect key
tramai.providers.anthropic.api-key-secret-refSecret reference resolved through the shared chain (env:, file:, vault:, aws-secretsmanager:)
tramai.providers.anthropic.base-urlDefaults 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.* and tramai.cost.* instead.
  • You are not using Spring: construct AnthropicProvider directly with tramai-anthropic.
  • You want to add a new provider: depend on tramai-spring-core and follow the same adapter shape.