feat(stage-ui): add OpenPaths provider (#1980)
Co-authored-by-agent: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1361,6 +1361,9 @@ pages:
|
||||
n1n:
|
||||
description: n1n.ai - High-performance AI API provider.
|
||||
title: n1n
|
||||
openpaths:
|
||||
description: openpaths.io
|
||||
title: OpenPaths
|
||||
openrouter:
|
||||
description: openrouter.ai
|
||||
title: OpenRouter
|
||||
|
||||
@@ -9,6 +9,7 @@ import './volcengine-coding-plan'
|
||||
import './byteplus'
|
||||
import './byteplus-coding-plan'
|
||||
import './n1n'
|
||||
import './openpaths'
|
||||
import './openrouter-ai'
|
||||
import './nvidia'
|
||||
import './groq'
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { createOpenAI } from '@xsai-ext/providers/create'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { ProviderValidationCheck } from '../../types'
|
||||
import { createOpenAICompatibleValidators } from '../../validators'
|
||||
import { defineProvider } from '../registry'
|
||||
|
||||
const openPathsConfigSchema = z.object({
|
||||
apiKey: z
|
||||
.string('API Key'),
|
||||
baseUrl: z
|
||||
.string('Base URL')
|
||||
.optional()
|
||||
.default('https://openpaths.io/v1'),
|
||||
})
|
||||
|
||||
type OpenPathsConfig = z.input<typeof openPathsConfigSchema>
|
||||
|
||||
export const providerOpenPaths = defineProvider<OpenPathsConfig>({
|
||||
id: 'openpaths',
|
||||
name: 'OpenPaths',
|
||||
nameLocalize: ({ t }) => t('settings.pages.providers.provider.openpaths.title'),
|
||||
description: 'openpaths.io',
|
||||
descriptionLocalize: ({ t }) => t('settings.pages.providers.provider.openpaths.description'),
|
||||
tasks: ['chat'],
|
||||
icon: 'i-lobe-icons:openai',
|
||||
|
||||
createProviderConfig: ({ t }) => openPathsConfigSchema.extend({
|
||||
apiKey: openPathsConfigSchema.shape.apiKey.meta({
|
||||
labelLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.api-key.label'),
|
||||
descriptionLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.api-key.description'),
|
||||
placeholderLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.api-key.placeholder'),
|
||||
type: 'password',
|
||||
}),
|
||||
baseUrl: openPathsConfigSchema.shape.baseUrl.meta({
|
||||
labelLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.base-url.label'),
|
||||
descriptionLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.base-url.description'),
|
||||
placeholderLocalized: t('settings.pages.providers.catalog.edit.config.common.fields.field.base-url.placeholder'),
|
||||
}),
|
||||
}),
|
||||
createProvider(config) {
|
||||
return createOpenAI(config.apiKey, config.baseUrl)
|
||||
},
|
||||
|
||||
validationRequiredWhen(config) {
|
||||
return !!config.apiKey?.trim()
|
||||
},
|
||||
validators: {
|
||||
...createOpenAICompatibleValidators({
|
||||
checks: [ProviderValidationCheck.Connectivity, ProviderValidationCheck.ModelList, ProviderValidationCheck.ChatCompletions],
|
||||
}),
|
||||
},
|
||||
})
|
||||
@@ -87,6 +87,7 @@ const providerSourceMetadataById = {
|
||||
'openai-compatible': false,
|
||||
'openai-compatible-audio-speech': false,
|
||||
'openai-compatible-audio-transcription': false,
|
||||
'openpaths': paidCloud,
|
||||
'openrouter-ai': paidCloud,
|
||||
'openrouter-audio-speech': paidCloud,
|
||||
'perplexity-ai': paidCloud,
|
||||
|
||||
Reference in New Issue
Block a user