cherry-studio/packages/ai-sdk-provider
MyPrototypeWhat 77529b3cd3
chore: update ai-core release scripts and bump version to 1.0.7 (#11370)
* chore: update ai-core release scripts and bump version to 1.0.7

* chore: update ai-sdk-provider release script to include build step and enhance type exports in webSearchPlugin and providers

* chore: bump @cherrystudio/ai-core version to 1.0.8 and update dependencies in package.json and yarn.lock

* chore: bump @cherrystudio/ai-core version to 1.0.9 and @cherrystudio/ai-sdk-provider version to 0.1.2 in package.json and yarn.lock

---------

Co-authored-by: suyao <sy20010504@gmail.com>
2025-11-19 20:44:22 +08:00
..
src feat: add @cherrystudio/ai-sdk-provider package and integrate (#10715) 2025-11-12 18:16:27 +08:00
package.json chore: update ai-core release scripts and bump version to 1.0.7 (#11370) 2025-11-19 20:44:22 +08:00
README.md feat: add @cherrystudio/ai-sdk-provider package and integrate (#10715) 2025-11-12 18:16:27 +08:00
tsconfig.json feat: add @cherrystudio/ai-sdk-provider package and integrate (#10715) 2025-11-12 18:16:27 +08:00
tsdown.config.ts feat: add @cherrystudio/ai-sdk-provider package and integrate (#10715) 2025-11-12 18:16:27 +08:00

@cherrystudio/ai-sdk-provider

CherryIN provider bundle for the Vercel AI SDK.
It exposes the CherryIN OpenAI-compatible entrypoints and dynamically routes Anthropic and Gemini model ids to their CherryIN upstream equivalents.

Installation

npm install ai @cherrystudio/ai-sdk-provider @ai-sdk/anthropic @ai-sdk/google @ai-sdk/openai
# or
yarn add ai @cherrystudio/ai-sdk-provider @ai-sdk/anthropic @ai-sdk/google @ai-sdk/openai

Note

: This package requires peer dependencies ai, @ai-sdk/anthropic, @ai-sdk/google, and @ai-sdk/openai to be installed.

Usage

import { createCherryIn, cherryIn } from '@cherrystudio/ai-sdk-provider'

const cherryInProvider = createCherryIn({
  apiKey: process.env.CHERRYIN_API_KEY,
  // optional overrides:
  // baseURL: 'https://open.cherryin.net/v1',
  // anthropicBaseURL: 'https://open.cherryin.net/anthropic',
  // geminiBaseURL: 'https://open.cherryin.net/gemini/v1beta',
})

// Chat models will auto-route based on the model id prefix:
const openaiModel = cherryInProvider.chat('gpt-4o-mini')
const anthropicModel = cherryInProvider.chat('claude-3-5-sonnet-latest')
const geminiModel = cherryInProvider.chat('gemini-2.0-pro-exp')

const { text } = await openaiModel.invoke('Hello CherryIN!')

The provider also exposes completion, responses, embedding, image, transcription, and speech helpers aligned with the upstream APIs.

See AI SDK docs for configuring custom providers.