mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-12 00:49:14 +08:00
feat(code-tools): add 302.AI as Claude Code provider (#12254)
* feat(code-tools): add 302.AI as Claude Code provider * feat(agent): add 302.AI anthropicApiHost to enable Agent support 302.AI now supports Claude Code (Agent) functionality by configuring the anthropicApiHost endpoint. Users can use 302.AI's Claude models (claude-sonnet-4-20250514, claude-opus-4-20250514) with Agent. * feat(migrate): add migration 192 to set 302ai API host
This commit is contained in:
parent
4c67e5b43a
commit
68a75dc4e3
@ -212,6 +212,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record<SystemProviderId, SystemProvider> =
|
||||
type: 'openai',
|
||||
apiKey: '',
|
||||
apiHost: 'https://api.302.ai',
|
||||
anthropicApiHost: 'https://api.302.ai',
|
||||
models: SYSTEM_MODELS['302ai'],
|
||||
isSystem: true,
|
||||
enabled: false
|
||||
|
||||
@ -43,6 +43,7 @@ export const CLAUDE_SUPPORTED_PROVIDERS = [
|
||||
'dmxapi',
|
||||
'new-api',
|
||||
'cherryin',
|
||||
'302ai',
|
||||
...CLAUDE_OFFICIAL_SUPPORTED_PROVIDERS
|
||||
]
|
||||
export const OPENAI_CODEX_SUPPORTED_PROVIDERS = ['openai', 'openrouter', 'aihubmix', 'new-api', 'cherryin']
|
||||
@ -96,6 +97,11 @@ export const getCodeToolsApiBaseUrl = (model: Model, type: EndpointType) => {
|
||||
anthropic: {
|
||||
api_base_url: 'https://api.minimaxi.com/anthropic'
|
||||
}
|
||||
},
|
||||
'302ai': {
|
||||
anthropic: {
|
||||
api_base_url: 'https://api.302.ai'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ const persistedReducer = persistReducer(
|
||||
{
|
||||
key: 'cherry-studio',
|
||||
storage,
|
||||
version: 191,
|
||||
version: 192,
|
||||
blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs', 'toolPermissions'],
|
||||
migrate
|
||||
},
|
||||
|
||||
@ -3144,6 +3144,20 @@ const migrateConfig = {
|
||||
logger.error('migrate 191 error', error as Error)
|
||||
return state
|
||||
}
|
||||
},
|
||||
'192': (state: RootState) => {
|
||||
try {
|
||||
state.llm.providers.forEach((provider) => {
|
||||
if (provider.id === '302ai') {
|
||||
provider.anthropicApiHost = 'https://api.302.ai'
|
||||
}
|
||||
})
|
||||
logger.info('migrate 192 success')
|
||||
return state
|
||||
} catch (error) {
|
||||
logger.error('migrate 192 error', error as Error)
|
||||
return state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user