complete and stream, native token counting, and SDK retries disabled so the loader owns retry policy.
Why
Choose Anthropic when you want Claude models with first-class streaming and accuratecountTokens via the Messages API. You can run Anthropic alongside OpenAI and Google in the same deployment — routing is by model id, not a global client switch.
Setup
- Confirm
apps/backend/package.jsonincludes"tooling-ai-anthropic": "workspace:*"(default in the boilerplate). - Run
make deps-installif you changed dependencies. - Add or extend
tools.aiinapps/backend/src/configuration/development.ts(andproduction.tswhen ready):
- No
compose.ymlchanges are required — Anthropic is reached over HTTPS; no extra Docker service. - Add to
.env.development:
- Verify:
Local observability
Anthropic traffic does not ship a local dashboard in Refract. You’ll seeai feature logs and StatsD metrics (ai.request.*) from instrumentation when tools.metrics is configured. Use your Anthropic console for spend and rate-limit debugging.
Adding a new model id
- Add the model string to
tools.ai.anthropic.modelsin each environment config that uses Anthropic. - Optionally set
defaultModelto that id (must remain inmodels). - Confirm
getAvailableModelsreturns the new id before exposing it in UI. - Run
make test module=tooling-ai-anthropic.
Gotchas
- Model ids must match Anthropic’s API names exactly — typos throw
AiValidationErrorat the loader, not a clear SDK message. - If Anthropic is the only provider configured, omitting
params.modelusesdefaultModelor the firstmodelsentry. - Loader provider order is anthropic → openai → google; Anthropic is primary only when it is the first block present in config and loaded.
What’s next?
- AI tooling overview — routing, request policy, and
tools.aiusage - OpenAI · Google Gemini — sibling providers
- Configuration — env vars and config files
- Tooling system — pluggable tool architecture
