cherry-studio/packages/shared/provider/config/vertex-anthropic.ts
suyao a5e7aa1342
feat: Implement shared provider utilities and API host formatting
- Added provider API host formatting utilities to handle differences between Cherry Studio and AI SDK.
- Introduced functions for formatting provider API hosts, including support for Azure OpenAI and Vertex AI.
- Created a simple API key rotator for managing API key rotation.
- Developed shared provider initialization and mapping utilities for resolving provider IDs.
- Implemented AI SDK configuration utilities for converting Cherry Studio providers to AI SDK configurations.
- Added support for various providers including OpenRouter, Google Vertex AI, and Amazon Bedrock.
- Enhanced error handling and logging in the unified messages service for better debugging.
- Introduced functions for streaming and generating unified messages using AI SDK.
2025-11-27 15:30:19 +08:00

20 lines
650 B
TypeScript

import type { MinimalModel, MinimalProvider } from '../types'
import { provider2Provider, startsWith } from './helper'
import type { RuleSet } from './types'
const VERTEX_ANTHROPIC_RULES: RuleSet = {
rules: [
{
match: startsWith('claude'),
provider: (provider: MinimalProvider) => ({
...provider,
id: 'google-vertex-anthropic'
})
}
],
fallbackRule: (provider: MinimalProvider) => provider
}
export const vertexAnthropicProviderCreator = <P extends MinimalProvider>(model: MinimalModel, provider: P): P =>
provider2Provider<MinimalModel, MinimalProvider, P>(VERTEX_ANTHROPIC_RULES, model, provider)