Configuration Reference
This reference describes configuration that exists in the current codebase.
Standalone Builder
The standalone builder exposes:
provider(provider, name = ..., default = ...)model(modelName, providerName)fallbackModel(requestedModelName, fallbackModelName, providerName)fallbackProvider(modelName, providerName)defaultProvider(providerName)observer(observer)circuitBreaker(settings)retryPolicy(settings)tokenBudget(settings)
Example:
val tramai = Tramai {
provider(OpenAiProvider(System.getenv("OPENAI_API_KEY")), name = "openai")
model("gpt-4o", "openai")
defaultProvider("openai")
}
Spring Boot Namespace
Spring configuration binds under:
tramai:
Top-level keys:
default-providermodelsfallbacksresiliencecostcacheproviders
Full Current Spring Shape
tramai:
default-provider: openai
models:
gpt-4o: openai
gpt-4o-mini: openai
claude-sonnet-4-20250514: anthropic
llama3.2: ollama
fallbacks:
gpt-4o:
- provider: openai
model: gpt-4o-mini
- provider: ollama
model: llama3.2
resilience:
circuit-breaker:
enabled: true
failure-threshold: 3
open-duration-millis: 30000
retry:
max-retry-after-millis: 20000
jitter-ratio: 0.1
cost:
token-budget:
hard-max-tokens-per-attempt: 4000
hard-max-tokens-per-operation: 12000
soft-max-tokens-per-operation: 8000
cache:
in-memory:
enabled: true
max-entries: 1000
providers:
anthropic:
api-key: ${ANTHROPIC_API_KEY}
api-key-secret-ref: null
base-url: https://api.anthropic.com
openai:
api-key: ${OPENAI_API_KEY}
api-key-secret-ref: null
bearer-token: null
bearer-token-secret-ref: null
base-url: https://api.openai.com/v1
organization: null
project: null
codex-auth:
enabled: false
auth-file: /home/you/.codex/auth.json
openai-compatible:
provider-name: compatible
api-key: null
api-key-secret-ref: null
bearer-token: ${COMPATIBLE_API_TOKEN}
bearer-token-secret-ref: null
base-url: https://compatible.example.com/v1
codex-auth:
enabled: false
auth-file: /home/you/.codex/auth.json
ollama:
base-url: http://localhost:11434
gemini:
api-key: ${GEMINI_API_KEY}
base-url: https://generativelanguage.googleapis.com
deepseek:
api-key: ${DEEPSEEK_API_KEY}
base-url: https://api.deepseek.com
Important Notes
modelsis the main routing tablefallbacksis an ordered list of explicit backup routes per requested model- provider names in
modelsmust match registered provider names - provider beans and property-defined providers are merged in Spring
- bean-backed providers override property-backed providers when names collide
- Tramai already supports per-operation timeout and retry settings through
@Operation(timeoutMillis = ..., maxRetries = ...) tramai.cache.in-memory.*enables the built-in in-memory response cache for cacheable non-streaming operationstramai.resilience.retry.max-retry-after-milliscaps provider-suppliedRetry-Afterdelaystramai.resilience.retry.jitter-ratioadds positive jitter to scheduled retry delaystramai.resilience.circuit-breaker.*controls engine-owned provider health protectiontramai.cost.token-budget.hard-max-tokens-per-attemptfails a single provider attempt when reported usage is too hightramai.cost.token-budget.hard-max-tokens-per-operationfails a logical operation when cumulative reported usage exceeds budget across retries or tool loopstramai.cost.token-budget.soft-max-tokens-per-operationemits an engine event without failing the call*-secret-reffields are resolved through SpringSecretValueResolverbeans; built-in resolvers supportenv:NAMEandfile:/path/to/secret.txt
What Does Not Exist Yet
These configuration concepts appear in planning documents but are not fully implemented in runtime code yet:
- provider-level timeout policy configuration in standalone or Spring properties
- default max tokens and temperature at the framework level
- streaming configuration
- preflight token estimation before a provider call is sent
- bundled AWS Secrets Manager or Vault resolver implementations
Document them only when they land in code.
