feat(M3-002): implement AnthropicAdapter for Claude Sonnet 4.6, Opus 4.6, and Haiku 4.5
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
ci/woodpecker/push/ci Pipeline failed

Adds AnthropicAdapter implementing IProviderAdapter. Installs @anthropic-ai/sdk,
registers the three Claude models with the Pi ModelRegistry, implements healthCheck()
via client.models.list(), and createCompletion() with streaming via messages.stream().
Replaces the legacy inline registerAnthropicProvider() method in ProviderService.
Gracefully skips registration when ANTHROPIC_API_KEY is not set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 16:30:15 -05:00
parent 6c6bcbdb7f
commit ca5c98cb0a
5 changed files with 214 additions and 7 deletions

18
pnpm-lock.yaml generated
View File

@@ -41,6 +41,9 @@ importers:
apps/gateway:
dependencies:
'@anthropic-ai/sdk':
specifier: ^0.80.0
version: 0.80.0(zod@4.3.6)
'@fastify/helmet':
specifier: ^13.0.2
version: 13.0.2
@@ -582,6 +585,15 @@ packages:
zod:
optional: true
'@anthropic-ai/sdk@0.80.0':
resolution: {integrity: sha512-WeXLn7zNVk3yjeshn+xZHvld6AoFUOR3Sep6pSoHho5YbSi6HwcirqgPA5ccFuW8QTVJAAU7N8uQQC6Wa9TG+g==}
hasBin: true
peerDependencies:
zod: ^3.25.0 || ^4.0.0
peerDependenciesMeta:
zod:
optional: true
'@asamuzakjp/css-color@5.0.1':
resolution: {integrity: sha512-2SZFvqMyvboVV1d15lMf7XiI3m7SDqXUuKaTymJYLN6dSGadqp+fVojqJlVoMlbZnlTmu3S0TLwLTJpvBMO1Aw==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
@@ -5937,6 +5949,12 @@ snapshots:
optionalDependencies:
zod: 4.3.6
'@anthropic-ai/sdk@0.80.0(zod@4.3.6)':
dependencies:
json-schema-to-ts: 3.1.1
optionalDependencies:
zod: 4.3.6
'@asamuzakjp/css-color@5.0.1':
dependencies:
'@csstools/css-calc': 3.1.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)