feat!: replace ai/ai-sdk deps with in-house provider clients - #75
Merged
Conversation
Drop the "ai" runtime dependency and all @ai-sdk/* optionalDependencies. Every LLM provider (OpenAI, Anthropic, Google, Bedrock, Mistral, Cohere, Groq, xAI, DeepSeek, and OpenAI-compatible gateways) now talks directly to its HTTP API via a small in-house fetch-based client, cutting the package's dependency/attack surface to just @scolladon/tsgit and diff. Bedrock auth is a from-scratch AWS SigV4 signer supporting only static credentials (env vars or an ~/.aws/credentials profile) instead of the full AWS SDK credential chain. BREAKING CHANGE: llmModelProvider now returns a ChatModel (this package's own minimal interface) instead of a Vercel AI SDK LanguageModel. Bedrock no longer supports SSO, instance-role, or container credentials. optionalDependencies on @ai-sdk/* packages are removed entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds direct unit tests for llmClient's retry loop, the shared HTTP helper, and each new provider client (Anthropic, Google, Cohere, Bedrock, SigV4 signing, AWS credential/region resolution) to bring patch coverage on the new files up to ~100% statements/lines and 98.6% branches. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
airuntime dependency and all@ai-sdk/*optionalDependenciesin favor of small, in-housefetch-based clients per provider (OpenAI, Anthropic, Google, Bedrock, Mistral, Cohere, Groq, xAI, DeepSeek, and OpenAI-compatible gateways), cutting the package down to@scolladon/tsgitanddiffas its only runtime dependencies.src/ai/providers/sigv4.ts) and a minimal AWS credential resolver (env vars or~/.aws/credentialsprofile) so Bedrock support no longer needs the AWS SDK — static credentials only, not the full credential-provider chain (SSO/instance-role/container credentials are out of scope).llmProviders.tsno longer does dynamicimport()s of optional packages; every provider is always available with nothing extra to install.ChatModel/ChatCallOptions/ChatResult/ChatUsagetypes (src/ai/llmClient.ts) replace the Vercel AI SDK'sLanguageModel/generateText, with an equivalent retry loop for transient failures.test/llmProviders.spec.tsnow asserts against mockedfetchcalls (URL, headers, body) instead of mocked@ai-sdk/*factories.Breaking changes
llmModelProvidernow returns this package's ownChatModelinstead of a Vercel AI SDKLanguageModel.optionalDependencieson@ai-sdk/*packages are removed — nothing to install per-provider anymore.Test plan
npx vitest run --coverage— 318/318 passingnpx tsc --noEmit— cleannpx biome lint .— cleannpx knip— cleannpx rollup -c— builds successfully (pre-existing Node-builtin/external warnings only, same class as before)🤖 Generated with Claude Code