npm.io
0.19.2 • Published 4d ago

@aparte/provider-ai-sdk

Licence
MIT
Version
0.19.2
Deps
0
Size
38 kB
Vulns
0
Weekly
0

@aparte/provider-ai-sdk

Bridge any Vercel AI SDK model into aparté. aparté's own wire concern is deliberately tiny — @aparte/provider-openai-compat covers the one de-facto-standard format; everything else (Anthropic, Google, Bedrock, 25+ vendors) rides the AI SDK ecosystem through this bridge. You bring your @ai-sdk/* package, hand its model to createAiSdkProvider, and the bridge maps streamText's fullStream to aparté's events.

npm install @aparte/provider-ai-sdk @aparte/core ai @ai-sdk/anthropic

ai and your chosen @ai-sdk/* vendor package are peer dependencies — you pick the versions, and only the vendors you actually use end up in your bundle. @aparte/core is a peer too.

import { createAnthropic } from '@ai-sdk/anthropic';
import { createAiSdkProvider } from '@aparte/provider-ai-sdk';
import { aparteGlobalConfig } from '@aparte/core';

aparteGlobalConfig.registerAIProvider(createAiSdkProvider({
    id: 'anthropic',
    name: 'Anthropic',
    models: [{ id: 'claude-sonnet-4-5', name: 'Claude Sonnet 4.5' }],
    languageModel: (modelId, auth) =>
        createAnthropic({ apiKey: typeof auth === 'string' ? auth : auth?.['apiKey'] })(modelId),
}));

ai is a peerDependency pinned to the verified major (^7) — this bridge is the only aparté module touching the SDK's types. @aparte/core is a peer dependency.

Works on the server too. This bridge touches no DOM, and core resolves its DOM-free entry under Node's export condition — so it runs in a backend, an Electron main process or an SSR pass as well as in the browser.

Part of the aparté monorepo. ESM-only. See the Providers guide in the docs for the full usage.

Keywords