Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589)
lyingbuge179f4444592
diff --git a/.github/workflows/app.yml b/.github/workflows/app.ymlindex e83def8cf..ebaabe4fc 100644--- a/.github/workflows/app.yml+++ b/.github/workflows/app.yml@@ -24,6 +24,10 @@ on:- "THIRD_PARTY_NOTICES.md"- "licenses/**"- "internal/textconv/data/**"+ - "internal/models/catalog/data/**"+ - "internal/models/parity/testdata/**"+ - "internal/models/providers/assets/**"+ - "scripts/model-catalog/**"- "scripts/*license*.sh"- "scripts/git-hooks/**"- "scripts/test-git-hooks.sh"@@ -48,6 +52,10 @@ on:- "THIRD_PARTY_NOTICES.md"- "licenses/**"- "internal/textconv/data/**"+ - "internal/models/catalog/data/**"+ - "internal/models/parity/testdata/**"+ - "internal/models/providers/assets/**"+ - "scripts/model-catalog/**"- "scripts/*license*.sh"- "scripts/git-hooks/**"- "scripts/test-git-hooks.sh"@@ -117,6 +125,9 @@ jobs:exit 1fi+ - name: Verify generated model catalog+ run: python3 scripts/model-catalog/generate.py --check+- name: Verify Git hook test coveragerun: bash ./scripts/test-git-hooks.shdiff --git a/Makefile b/Makefileindex 67f74ac7a..2f4540683 100644--- a/Makefile+++ b/Makefile@@ -112,12 +112,14 @@ run: buildtest:go test -v ./...-# Vendor catalog: invariants, legacy-behaviour parity and vendor facts.-# Run this after adding a vendor or editing any models.json.-.PHONY: model-catalog-check+# Generate reviewed metadata + protocol overrides, then verify every model.+.PHONY: model-catalog-generate model-catalog-check+model-catalog-generate:+ python3 scripts/model-catalog/generate.py+model-catalog-check:- go test ./internal/models/parity/ ./internal/models/vendors/ ./internal/models/catalog/ ./internal/models/api/... \- ./internal/models/rerank/ ./internal/models/embedding/ ./internal/models/asr/+ python3 scripts/model-catalog/generate.py --check+ go test ./internal/models/...# Vendor catalog: report where our model metadata differs from models.dev.# Development aid only — nothing is fetched at runtime and nothing is written@@ -367,5 +369,3 @@ dev-app:dev-frontend:./scripts/dev.sh frontend--diff --git a/frontend/src/api/initialization/index.ts b/frontend/src/api/initialization/index.tsindex 7fd1c3db1..9f020cd83 100644--- a/frontend/src/api/initialization/index.ts+++ b/frontend/src/api/initialization/index.ts@@ -1,6 +1,6 @@import { get, post, put } from '../../utils/request';import i18n from '@/i18n'-import type { ModelCapabilities, ReasoningEffortLevel } from '../model'+import type { ModelCapabilities, ModelSpecOverride, ReasoningEffortLevel } from '../model'const t = (key: string) => i18n.global.t(key)@@ -305,6 +305,7 @@ export function getCurrentConfigByKB(kbId: string): Promise<InitializationConfig// customHeaders / extraConfig / interfaceType 对应后端 ModelTestRequest 里的同名字段,// 会被透传给真正的模型装配流程,保证测试连接与生产调用走完全相同的路径。interface BaseModelTestPayload {+ spec?: ModelSpecOverride;customHeaders?: Record<string, string>;extraConfig?: Record<string, string>;interfaceType?: string;@@ -690,6 +691,7 @@ export function listModelProviders(modelType?: string): Promise<ModelProviderOpt}export interface ResolveModelCatalogParams {+ spec?: ModelSpecOverride;provider: string;model?: string;base_url?: string;@@ -700,7 +702,7 @@ export interface ResolveModelCatalogParams {// Vendor-declared non-secret extra fields (Azure api_version, ...) are// forwarded by key so the preview resolves the same request the runtime// will make. The backend only accepts keys the vendor declares.- [extraField: string]: string | undefined;+ [extraField: string]: string | ModelSpecOverride | undefined;}// 目录解析结果。Mirrors handler.ResolveModelCatalog response data.@@ -722,14 +724,8 @@ export interface ResolvedModelCatalog {// 解析模型的有效接入配置(协议、思考等级、上下文窗口等),供编辑器实时展示。export function resolveModelCatalog(params: ResolveModelCatalogParams): Promise<ResolvedModelCatalog> {- const query = new URLSearchParams();- for (const [key, value] of Object.entries(params)) {- if (value !== undefined && value !== null && String(value).trim() !== '') {- query.set(key, String(value).trim());- }- }return new Promise((resolve, reject) => {- get(`/api/v1/models/catalog/resolve?${query.toString()}`)+ post(`/api/v1/models/catalog/resolve`, params).then((response: any) => {if (response?.success && response?.data) {resolve(response.data as ResolvedModelCatalog);diff --git a/frontend/src/components/ModelEditorDialog.vue b/frontend/src/components/ModelEditorDialog.vueindex cdb63d964..de2ea5334 100644--- a/frontend/src/components/ModelEditorDialog.vue+++ b/frontend/src/components/ModelEditorDialog.vue@@ -1003,6 +1003,7 @@ const runResolve = async () => {try {const result = await resolveModelCatalog({provider,+ spec: buildSpec(),model: formData.value.modelName || '',base_url: formData.value.baseUrl || '',model_type: activeModelType.value,@@ -1067,6 +1068,16 @@ const specCompatError = computed(() => {}})+// Match the parent save path: retain row metadata, replace the edited compat.+const buildSpec = (): ModelSpecOverride => {+ if (specCompatError.value) throw new Error(specCompatError.value)+ const spec: ModelSpecOverride = { ...(formData.value.spec || {}) }+ const text = (formData.value.specCompat || '').trim()+ if (text) spec.compat = JSON.parse(text)+ else delete spec.compat+ return spec+}+const dialogVisible = computed({get: () => props.visible,set: (val) => {@@ -1303,6 +1314,7 @@ watch(props.visible, formData.value.source, formData.value.provider, formData.value.modelName,formData.value.baseUrl, formData.value.extraConfig?.api, formData.value.extraConfig?.remote_model_name,formData.value.thinkingControl, activeModelType.value,+ formData.value.specCompat, JSON.stringify(formData.value.spec),],() => {if (!props.visible) return@@ -1503,6 +1515,7 @@ watch(formData.value.apiKey, formData.value.appSecret, formData.value.customHeaders,formData.value.dimension, formData.value.supportsDimensionOverride,formData.value.extraConfig, formData.value.thinkingControl,+ formData.value.specCompat, formData.value.spec,],() => {if (!applyingDetectedDimension) invalidateConnectionTest(props.visible && !hydratingForm.value)@@ -1826,6 +1839,7 @@ const checkRemoteAPI = async () => {// 使测试连接走与生产调用相同的目录解析路径。const extraConfig = buildExtraConfig()const extraPayload = {+ spec: buildSpec(),...(Object.keys(extraConfig).length > 0 ? { extraConfig } : {}),...(formData.value.appSecret?.trim() ? { appSecret: formData.value.appSecret.trim() } : {}),}diff --git a/frontend/src/components/ResourceSortControl.vue b/frontend/src/components/ResourceSortControl.vueindex 877379699..d01272acf 100644--- a/frontend/src/components/ResourceSortControl.vue+++ b/frontend/src/components/ResourceSortControl.vue@@ -88,7 +88,7 @@ function selectOption(value: ResourceSortValue) {height: 28px;padding: 0 8px;border: 1px solid var(--td-component-stroke);- border-radius: 6px;+ border-radius: var(--app-radius-sm);background: var(--td-bg-color-secondarycontainer);color: var(--td-text-color-secondary);font-family: var(--app-font-family);@@ -168,7 +168,7 @@ function selectOption(value: ResourceSortValue) {height: 32px;padding: 0 10px;border: 0;- border-radius: 6px;+ border-radius: var(--app-radius-sm);background: transparent;color: var(--td-text-color-primary);font-family: var(--app-font-family);diff --git a/frontend/src/components/modelEditorFlow.test.ts b/frontend/src/components/modelEditorFlow.test.tsindex 9ca219a93..ffa68ac25 100644--- a/frontend/src/components/modelEditorFlow.test.ts+++ b/frontend/src/components/modelEditorFlow.test.ts@@ -884,3 +884,31 @@ test('extraFieldDisplayPlaceholder resolves the vendor placeholder for the activf.close()}})++for (const type of ['chat', 'embedding', 'rerank', 'vllm', 'asr']) {+ test(`${type}: connection tests include edited spec and clearing compat`, async () => {+ const f = await fixture({ type })+ try {+ f.vm.formData.spec = { context_window: 64000, compat: { old: true } }+ f.vm.formData.specCompat = '{"custom_option": true}'+ await f.vm.checkRemoteAPI()+ assert.deepEqual(plain(f.requests[0].spec), { context_window: 64000, compat: { custom_option: true } })+ f.vm.formData.specCompat = ''+ await nextTick()+ assert.equal(f.vm.remoteChecked, false, 'editing spec invalidates the old connection result')+ await f.vm.checkRemoteAPI()+ assert.deepEqual(plain(f.requests[1].spec), { context_window: 64000 })+ } finally { f.close() }+ })+}++test('capability preview includes the same edited spec as connection tests', async () => {+ const f = await fixture({ type: 'chat' })+ try {+ f.vm.formData.provider = 'openai'+ f.vm.formData.spec = { api: 'openai-completions' }+ f.vm.formData.specCompat = '{"supports_temperature": false}'+ await f.vm.runResolve()+ assert.deepEqual(plain(f.resolves.at(-1).spec), { api: 'openai-completions', compat: { supports_temperature: false } })+ } finally { f.close() }+})diff --git a/frontend/src/views/creatChat/creatChat.test.mjs b/frontend/src/views/creatChat/creatChat.test.mjsindex 681e8257d..dbffed594 100644--- a/frontend/src/views/creatChat/creatChat.test.mjs+++ b/frontend/src/views/creatChat/creatChat.test.mjs@@ -22,4 +22,3 @@ test('new-session page has a single project button flush above the composer', ()assert.doesNotMatch(source, /t-select/)assert.doesNotMatch(source, /project-dir-picker/)})-diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vueindex 14df4c09c..d39564aed 100644--- a/frontend/src/views/knowledge/KnowledgeBase.vue+++ b/frontend/src/views/knowledge/KnowledgeBase.vue@@ -2913,7 +2913,7 @@ const handleKBEditorSuccess = (kbIdValue: string) => {height: 32px;padding: 0 10px;border: 0;- border-radius: 6px;+ border-radius: var(--app-radius-sm);background: transparent;color: var(--td-text-color-primary);font-family: var(--app-font-family);diff --git a/internal/agent/tool_images_test.go b/internal/agent/tool_images_test.goindex 063277866..beddd5039 100644--- a/internal/agent/tool_images_test.go+++ b/internal/agent/tool_images_test.go@@ -6,8 +6,8 @@ import ("errors""testing"+ "github.com/Tencent/WeKnora/internal/models/api""github.com/Tencent/WeKnora/internal/models/api/openaicompletions"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/require")@@ -30,7 +30,7 @@ func TestToolImagesReachNextModelTurnAfterAllReplies(t *testing.T) {require.Equal(t, "user", messages[3].Role)require.Equal(t, step.ToolCalls[0].Result.Images, messages[3].Images)require.Contains(t, messages[3].Content, "untrusted tool evidence")- client := openaicompletions.New(openaicompletions.Config{Settings: catalog.DefaultOpenAICompletions()})+ client := openaicompletions.New(openaicompletions.Config{Settings: api.DefaultOpenAICompletions()})body, err := client.BuildRequestBody(messages, nil, false)require.NoError(t, err)raw, err := json.Marshal(body["messages"])diff --git a/internal/application/service/model.go b/internal/application/service/model.goindex c9ca6a3df..8d842c664 100644--- a/internal/application/service/model.go+++ b/internal/application/service/model.go@@ -11,9 +11,9 @@ import ("github.com/Tencent/WeKnora/internal/models/asr""github.com/Tencent/WeKnora/internal/models/chat""github.com/Tencent/WeKnora/internal/models/embedding"+ "github.com/Tencent/WeKnora/internal/models/providers""github.com/Tencent/WeKnora/internal/models/rerank""github.com/Tencent/WeKnora/internal/models/utils/ollama"- "github.com/Tencent/WeKnora/internal/models/vendors/weknoracloud""github.com/Tencent/WeKnora/internal/models/vlm""github.com/Tencent/WeKnora/internal/types""github.com/Tencent/WeKnora/internal/types/interfaces"@@ -70,7 +70,7 @@ func (s *modelService) resolveWeKnoraCloudCredentials(ctx context.Context, paramappID = params.AppIDappSecret = s.decryptAppSecret(params.AppSecret)- if params.Provider != weknoracloud.ID {+ if params.Provider != providers.WeKnoraCloudID {return}if appID != "" && appSecret != "" {diff --git a/internal/application/service/weknoracloud.go b/internal/application/service/weknoracloud.goindex 8b51347ab..3709bc5e1 100644--- a/internal/application/service/weknoracloud.go+++ b/internal/application/service/weknoracloud.go@@ -8,8 +8,8 @@ import ("time""github.com/Tencent/WeKnora/internal/logger"+ "github.com/Tencent/WeKnora/internal/models/providers"modelsutils "github.com/Tencent/WeKnora/internal/models/utils"- "github.com/Tencent/WeKnora/internal/models/vendors/weknoracloud""github.com/Tencent/WeKnora/internal/types""github.com/Tencent/WeKnora/internal/types/interfaces""github.com/Tencent/WeKnora/internal/utils"@@ -30,7 +30,7 @@ func NewWeKnoraCloudService(}func IsWeKnoraCloudDocReaderAddr(addr string) bool {- readerURL := strings.TrimRight(weknoracloud.BaseURL, "/") + "/api/v1/doc/reader"+ readerURL := strings.TrimRight(providers.WeKnoraCloudBaseURL, "/") + "/api/v1/doc/reader"return strings.TrimSuffix(strings.TrimSpace(addr), "/") == readerURL}@@ -56,7 +56,7 @@ func (s *weKnoraCloudService) SaveCredentials(ctx context.Context, appID, appSec// 注意:health 一般为探活接口,远端常不校验 APPID/SECRET 或签名;HTTP 200 通常只表示// 「网关/服务可达」,不能严格证明凭证有效。若需强校验,应改为调用必须鉴权的业务接口。func (s *weKnoraCloudService) verifyCredentials(ctx context.Context, appID, appSecret string) error {- baseURL := strings.TrimRight(weknoracloud.BaseURL, "/")+ baseURL := strings.TrimRight(providers.WeKnoraCloudBaseURL, "/")healthURL := baseURL + "/api/v1/health"req, err := http.NewRequestWithContext(ctx, http.MethodGet, healthURL, nil)diff --git a/internal/container/container.go b/internal/container/container.goindex 0afec2f80..19392a788 100644--- a/internal/container/container.go+++ b/internal/container/container.go@@ -18,6 +18,8 @@ import ("strings""time"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+sqlite_vec "github.com/asg017/sqlite-vec-go-bindings/cgo"_ "github.com/duckdb/duckdb-go/v2"esv7 "github.com/elastic/go-elasticsearch/v7"@@ -86,11 +88,9 @@ import ("github.com/Tencent/WeKnora/internal/mcp""github.com/Tencent/WeKnora/internal/mcpserver""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/models/embedding"- "github.com/Tencent/WeKnora/internal/models/limiter"+ "github.com/Tencent/WeKnora/internal/models/limiter" // register built-in vendors"github.com/Tencent/WeKnora/internal/models/utils/ollama"- _ "github.com/Tencent/WeKnora/internal/models/vendors" // register built-in vendors"github.com/Tencent/WeKnora/internal/router""github.com/Tencent/WeKnora/internal/sandbox""github.com/Tencent/WeKnora/internal/storageallowlist"@@ -115,9 +115,8 @@ import (// - Configured container with all application dependencies registeredfunc BuildContainer(container *dig.Container) *dig.Container {// Deployment-level model catalog overlay (config/models.json, optional).- // Built-in vendors register themselves through the vendors package- // import; the overlay may add vendors or patch built-in ones.- if err := catalog.LoadOverlay(config.ConfigDir()); err != nil {+ // Register providers explicitly, then validate and publish one catalog generation.+ if err := modelruntime.Initialize(config.ConfigDir()); err != nil {logger.Warnf(context.Background(), "Load models catalog overlay failed: %v", err)}ctx := context.Background()@@ -914,7 +913,7 @@ func initDatabase(cfg *config.Config) (*gorm.DB, error) {// Post-migration: declarative built-in models from config/builtin_models.yaml (optional).// The loader validates each row's catalog parameters through this hook;// the wiring lives here because internal/types cannot import the catalog.- types.ValidateModelParameters = catalog.ValidateRow+ types.ValidateModelParameters = modelruntime.ValidateRowif err := types.LoadBuiltinModelsConfig(context.Background(), db, config.ConfigDir()); err != nil {logger.Warnf(context.Background(), "Load builtin models config failed: %v", err)}diff --git a/internal/handler/dto/model.go b/internal/handler/dto/model.goindex e982c893b..d57051971 100644--- a/internal/handler/dto/model.go+++ b/internal/handler/dto/model.go@@ -5,7 +5,7 @@ import ("strings""time"- "github.com/Tencent/WeKnora/internal/models/catalog"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -23,7 +23,7 @@ type VendorRef struct {func (r VendorRef) vendorID() string {id := strings.ToLower(strings.TrimSpace(r.Provider))if id == "" {- id = catalog.DetectByURL(r.BaseURL)+ id = modelruntime.DetectByURL(r.BaseURL)}return id}@@ -35,7 +35,7 @@ func (r VendorRef) names() bool {return strings.TrimSpace(r.Provider) != "" || strings.TrimSpace(r.BaseURL) != ""}-func secretKeysOf(v *catalog.Vendor, into map[string]bool) map[string]bool {+func secretKeysOf(v *modelruntime.Provider, into map[string]bool) map[string]bool {for _, f := range v.ExtraFields {if !f.Secret && f.Type != "password" {continue@@ -49,7 +49,7 @@ func secretKeysOf(v *catalog.Vendor, into map[string]bool) map[string]bool {}// SecretExtraConfigKeys returns the extra_config keys the vendor declares as-// secret (catalog.ExtraField.Secret, or a password input). These are real+// secret (providers.ExtraField.Secret, or a password input). These are real// credentials — LKEAP and Volcengine rerank keep an IAM/CAM secret key there// — so they get the same treatment as api_key / app_secret: never echoed,// only reported as present.@@ -58,7 +58,7 @@ func secretKeysOf(v *catalog.Vendor, into map[string]bool) map[string]bool {// secret for any model type of the vendor is redacted for every row of that// vendor.func SecretExtraConfigKeys(provider, baseURL string) map[string]bool {- v, ok := catalog.Get(VendorRef{Provider: provider, BaseURL: baseURL}.vendorID())+ v, ok := modelruntime.Get(VendorRef{Provider: provider, BaseURL: baseURL}.vendorID())if !ok {return nil}@@ -76,7 +76,7 @@ func SecretExtraConfigKeys(provider, baseURL string) map[string]bool {// withholding a value that happened to reuse the name.func AllSecretExtraConfigKeys() map[string]bool {var keys map[string]bool- for _, v := range catalog.List() {+ for _, v := range modelruntime.List() {keys = secretKeysOf(v, keys)}return keys@@ -195,7 +195,7 @@ type ModelResponse struct {Credentials map[string]CredentialFieldMetadata `json:"credentials,omitempty"`// Capabilities is the catalog view of the model: protocol, whether it// can think and at which levels, context window. Chat models only.- Capabilities *catalog.Capabilities `json:"capabilities,omitempty"`+ Capabilities *modelruntime.Capabilities `json:"capabilities,omitempty"`}// ModelParametersDTO carries every parameter field EXCEPT the two secret@@ -307,9 +307,9 @@ func NewModelResponse(ctx context.Context, m *types.Model) *ModelResponse {}}}- var caps *catalog.Capabilities+ var caps *modelruntime.Capabilitiesif m.Type == types.ModelTypeKnowledgeQA || m.Type == types.ModelTypeVLLM {- if resolved, err := catalog.Resolve(catalog.Ref{+ if resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: m.Parameters.Provider, Model: m.Name, BaseURL: m.Parameters.BaseURL,ModelType: m.Type, Extra: m.Parameters.ExtraConfig, Override: m.Parameters.Spec,}); err == nil && m.Source == types.ModelSourceRemote {diff --git a/internal/handler/dto/model_test.go b/internal/handler/dto/model_test.goindex 6af628347..acda26383 100644--- a/internal/handler/dto/model_test.go+++ b/internal/handler/dto/model_test.go@@ -6,7 +6,8 @@ import ("strings""testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -122,12 +123,12 @@ func TestModelResponse_ViewerStripsIntegrationDetail(t *testing.T) {func registerSecretExtraVendor(t *testing.T) string {t.Helper()id := "dto-secret-extra-vendor"- catalog.Register(&catalog.Vendor{+ modelruntime.Register(&providers.Definition{ID: id,Name: "Secret Extra Vendor",ModelTypes: []types.ModelType{types.ModelTypeRerank},URLPatterns: []string{"secret-extra-vendor.example.com"},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []providers.ExtraField{{Key: "secret_key", Label: "Secret Key", Type: "password", Secret: true},{Key: "region", Label: "Region", Type: "string"},},diff --git a/internal/handler/initialization.go b/internal/handler/initialization.goindex 9bcb6c401..51bce42cf 100644--- a/internal/handler/initialization.go+++ b/internal/handler/initialization.go@@ -25,10 +25,9 @@ import ("github.com/Tencent/WeKnora/internal/models/asr""github.com/Tencent/WeKnora/internal/models/chat""github.com/Tencent/WeKnora/internal/models/embedding"+ "github.com/Tencent/WeKnora/internal/models/providers""github.com/Tencent/WeKnora/internal/models/rerank""github.com/Tencent/WeKnora/internal/models/utils/ollama"- "github.com/Tencent/WeKnora/internal/models/vendors/lkeap"- "github.com/Tencent/WeKnora/internal/models/vendors/volcengine""github.com/Tencent/WeKnora/internal/types""github.com/Tencent/WeKnora/internal/types/interfaces""github.com/Tencent/WeKnora/internal/utils"@@ -1764,16 +1763,17 @@ func (h *InitializationHandler) buildConfigResponse(ctx context.Context, models// 所有 provider/model 通用字段都在这里集中声明;若未来新增字段(比如现在的// custom_headers),只需改一处,生产路径和测试路径会同时生效。type ModelTestRequest struct {- Source string `json:"source"` // 为空时按需默认为 "remote"- ModelName string `json:"modelName" binding:"required"`- BaseURL string `json:"baseUrl"`- APIKey string `json:"apiKey"`- Provider string `json:"provider"`- InterfaceType string `json:"interfaceType,omitempty"`- Dimension int `json:"dimension,omitempty"`- SupportsDimensionOverride bool `json:"supportsDimensionOverride,omitempty"`- CustomHeaders map[string]string `json:"customHeaders,omitempty"`- ExtraConfig map[string]string `json:"extraConfig,omitempty"`+ Spec *types.ModelSpecOverride `json:"spec,omitempty"`+ Source string `json:"source"` // 为空时按需默认为 "remote"+ ModelName string `json:"modelName" binding:"required"`+ BaseURL string `json:"baseUrl"`+ APIKey string `json:"apiKey"`+ Provider string `json:"provider"`+ InterfaceType string `json:"interfaceType,omitempty"`+ Dimension int `json:"dimension,omitempty"`+ SupportsDimensionOverride bool `json:"supportsDimensionOverride,omitempty"`+ CustomHeaders map[string]string `json:"customHeaders,omitempty"`+ ExtraConfig map[string]string `json:"extraConfig,omitempty"`// AppSecret 用于 LKEAP / Volcengine Rerank 等需要第二段密钥的场景(对应模型 Parameters.AppSecret)。AppSecret string `json:"appSecret,omitempty"`// ModelID, when set, instructs the handler to substitute any missing@@ -1806,7 +1806,7 @@ func (h *InitializationHandler) fillSecretsFromStoredModel(ctx context.Context,// secret stored in extra_config (LKEAP / Volcengine secret_key) is// redacted by GET, so "extraConfig is present" does not mean it is// complete.- if req.APIKey != "" && req.AppSecret != "" && req.ExtraConfig != nil &&+ if req.APIKey != "" && req.AppSecret != "" && req.ExtraConfig != nil && req.Spec != nil &&dto.HasAllSecretExtras(req.Provider, req.BaseURL, req.ExtraConfig) {return}@@ -1816,6 +1816,9 @@ func (h *InitializationHandler) fillSecretsFromStoredModel(ctx context.Context,utils.SanitizeForLog(req.ModelID), err)return}+ if req.Spec == nil && req.Provider == stored.Parameters.Provider {+ req.Spec = stored.Parameters.Spec+ }if req.APIKey == "" {req.APIKey = stored.Parameters.APIKey}@@ -1872,6 +1875,7 @@ func (h *InitializationHandler) buildTestModel(Provider: req.Provider,InterfaceType: req.InterfaceType,ExtraConfig: req.ExtraConfig,+ Spec: req.Spec,CustomHeaders: req.CustomHeaders,EmbeddingParameters: types.EmbeddingParameters{Dimension: req.Dimension,@@ -2170,7 +2174,7 @@ func (h *InitializationHandler) CheckRerankModel(c *gin.Context) {model := h.buildTestModel(&req, types.ModelTypeRerank, types.ModelSourceRemote)// LKEAP and Volcengine rerank sign with a key pair stored on the row// itself, not with the tenant's WeKnora Cloud credentials.- if p := model.Parameters.Provider; p == lkeap.ID || p == volcengine.ID {+ if p := model.Parameters.Provider; p == providers.LkeapID || p == providers.VolcengineID {appID = ""appSecret = decryptModelAppSecret(model.Parameters.AppSecret)}diff --git a/internal/handler/model.go b/internal/handler/model.goindex 2a73e723e..778546f5c 100644--- a/internal/handler/model.go+++ b/internal/handler/model.go@@ -8,12 +8,13 @@ import ("strings""time"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+"github.com/Tencent/WeKnora/internal/application/service""github.com/Tencent/WeKnora/internal/errors""github.com/Tencent/WeKnora/internal/handler/dto""github.com/Tencent/WeKnora/internal/logger""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/models/chat""github.com/Tencent/WeKnora/internal/types""github.com/Tencent/WeKnora/internal/types/interfaces"@@ -759,7 +760,7 @@ func (h *ModelHandler) DeleteModel(c *gin.Context) {// validateCatalogParameters rejects protocol / compat overrides the catalog// cannot interpret (unknown extra_config.api, unknown compat keys, bad// reasoning levels) so a typo fails at save time instead of at the first-// call. Every model type is checked; see catalog.ValidateRow.+// call. Every model type is checked; see modelruntime.ValidateRow.func validateCatalogParameters(name string, modelType types.ModelType, params *types.ModelParameters) error {- return catalog.ValidateRow(name, modelType, params)+ return modelruntime.ValidateRow(name, modelType, params)}diff --git a/internal/handler/model_catalog.go b/internal/handler/model_catalog.goindex a1f787967..68ca7497c 100644--- a/internal/handler/model_catalog.go+++ b/internal/handler/model_catalog.go@@ -2,14 +2,17 @@ package handlerimport ("encoding/base64"+ "encoding/json""net/http""strings""github.com/Tencent/WeKnora/internal/errors""github.com/Tencent/WeKnora/internal/handler/dto""github.com/Tencent/WeKnora/internal/logger"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types"secutils "github.com/Tencent/WeKnora/internal/utils""github.com/gin-gonic/gin"@@ -27,19 +30,19 @@ type ModelProviderDTO struct {Descriptions map[string]string `json:"descriptions,omitempty"`Website string `json:"website,omitempty"`// Icon is a data: URI (image/svg+xml;base64) ready for <img src>.- Icon string `json:"icon,omitempty"`- API api.API `json:"api"`- Auth catalog.AuthStyle `json:"auth"`- RequiresAuth bool `json:"requiresAuth"`- DefaultURLs map[string]string `json:"defaultUrls"`- ModelTypes []string `json:"modelTypes"`- ExtraFields []catalog.ExtraField `json:"extraFields,omitempty"`+ Icon string `json:"icon,omitempty"`+ API api.API `json:"api"`+ Auth providers.AuthStyle `json:"auth"`+ RequiresAuth bool `json:"requiresAuth"`+ DefaultURLs map[string]string `json:"defaultUrls"`+ ModelTypes []string `json:"modelTypes"`+ ExtraFields []providers.ExtraField `json:"extraFields,omitempty"`// CredentialLabels rename the primary credential input for the model// types that do not take a plain API key (signed rerank APIs).- CredentialLabels []catalog.CredentialLabel `json:"credentialLabels,omitempty"`- Models []ModelCatalogEntryDTO `json:"models,omitempty"`- Thinking ProviderThinkingDTO `json:"thinking"`- Order int `json:"order"`+ CredentialLabels []providers.CredentialLabel `json:"credentialLabels,omitempty"`+ Models []ModelCatalogEntryDTO `json:"models,omitempty"`+ Thinking ProviderThinkingDTO `json:"thinking"`+ Order int `json:"order"`}// ProviderThinkingDTO summarizes how the vendor encodes thinking so the UI@@ -61,7 +64,7 @@ type ModelCatalogEntryDTO struct {MaxOutputTokens int `json:"max_output_tokens,omitempty"`Dimension int `json:"dimension,omitempty"`ThinkingLevels []api.ReasoningEffort `json:"thinking_levels"`- Cost *catalog.ModelCost `json:"cost,omitempty"`+ Cost *models.ModelCost `json:"cost,omitempty"`// Source is the vendor page these facts were read from, so the editor can// send an operator to the documentation for this exact model.Source string `json:"source,omitempty"`@@ -93,7 +96,7 @@ func iconDataURI(svg []byte) string {return "data:image/svg+xml;base64," + base64.StdEncoding.EncodeToString(svg)}-func providerDTO(v *catalog.Vendor, modelType types.ModelType, includeModels bool) ModelProviderDTO {+func providerDTO(v *modelruntime.Provider, modelType types.ModelType, includeModels bool) ModelProviderDTO {defaultURLs := make(map[string]string, len(v.DefaultBaseURLs))for mt, url := range v.DefaultBaseURLs {defaultURLs[modelTypeToFrontend(mt)] = url@@ -123,7 +126,12 @@ func providerDTO(v *catalog.Vendor, modelType types.ModelType, includeModels boo}// Vendor-level thinking summary: resolve an unknown model so only the// vendor defaults contribute.- if resolved, err := catalog.Resolve(catalog.Ref{Provider: v.ID, Model: "__vendor_default__"}); err == nil {+ if resolved, err := v.Resolve(+ modelruntime.Ref{+ Provider: v.ID,+ Model: "__vendor_default__",+ },+ ); err == nil {caps := resolved.Capabilities()dto.Thinking = ProviderThinkingDTO{Format: caps.ThinkingFormat, Levels: caps.ThinkingLevels}}@@ -162,7 +170,7 @@ func providerDTO(v *catalog.Vendor, modelType types.ModelType, includeModels boo// derived from Input), so this covers reasoning VLMs too;// embedding / rerank / ASR entries have no thinking levels.if m.Type == "" || m.Type == "KnowledgeQA" {- if resolved, err := catalog.Resolve(catalog.Ref{Provider: v.ID, Model: m.ID}); err == nil {+ if resolved, err := v.Resolve(modelruntime.Ref{Provider: v.ID, Model: m.ID}); err == nil {entry.ThinkingLevels = resolved.Capabilities().ThinkingLevels}}@@ -190,7 +198,7 @@ func (h *ModelHandler) ListModelProviders(c *gin.Context) {var backendType types.ModelTypeif modelType != "" {- parsed, ok := catalog.ParseModelType(modelType)+ parsed, ok := models.ParseModelType(modelType)if !ok {_ = c.Error(errors.NewBadRequestError("unknown model_type"))return@@ -198,11 +206,11 @@ func (h *ModelHandler) ListModelProviders(c *gin.Context) {backendType = parsed}- var vendors []*catalog.Vendor+ var vendors []*modelruntime.Providerif backendType != "" {- vendors = catalog.ListByType(backendType)+ vendors = modelruntime.ListByType(backendType)} else {- vendors = catalog.List()+ vendors = modelruntime.List()}// Default base URLs are the editor's prefill, and only a caller who may// configure integrations can use them. A deployment overlay may also@@ -237,13 +245,40 @@ func (h *ModelHandler) ListModelProviders(c *gin.Context) {// @Security ApiKeyAuth// @Router /models/catalog/resolve [get]func (h *ModelHandler) ResolveModelCatalog(c *gin.Context) {+ // POST carries the row spec in the body; GET remains compatible with old clients.+ query := c.Query+ var spec *types.ModelSpecOverride+ if c.Request.Method == http.MethodPost {+ var body map[string]json.RawMessage+ if err := c.ShouldBindJSON(&body); err != nil {+ _ = c.Error(errors.NewBadRequestError(err.Error()))+ return+ }+ values := map[string]string{}+ for key, raw := range body {+ if key == "spec" {+ if err := json.Unmarshal(raw, &spec); err != nil {+ _ = c.Error(errors.NewBadRequestError("invalid model spec"))+ return+ }+ continue+ }+ var value string+ if err := json.Unmarshal(raw, &value); err != nil {+ _ = c.Error(errors.NewBadRequestError("invalid resolve field: " + key))+ return+ }+ values[key] = value+ }+ query = func(key string) string { return values[key] }+ }ctx := c.Request.Context()- providerID := strings.TrimSpace(c.Query("provider"))- modelName := strings.TrimSpace(c.Query("model"))- baseURL := strings.TrimSpace(c.Query("base_url"))+ providerID := strings.TrimSpace(query("provider"))+ modelName := strings.TrimSpace(query("model"))+ baseURL := strings.TrimSpace(query("base_url"))modelType := types.ModelTypeKnowledgeQA- if raw := c.Query("model_type"); raw != "" {- if parsed, ok := catalog.ParseModelType(raw); ok {+ if raw := query("model_type"); raw != "" {+ if parsed, ok := models.ParseModelType(raw); ok {modelType = parsed}}@@ -255,23 +290,23 @@ func (h *ModelHandler) ResolveModelCatalog(c *gin.Context) {// here. Secret fields are never accepted: this is a GET, and a credential// in a query string lands in access logs and browser history.extra := map[string]string{}- for _, key := range []string{catalog.ExtraAPI, catalog.ExtraThinkingControl, catalog.ExtraRemoteModelName} {- if v := strings.TrimSpace(c.Query(key)); v != "" {+ for _, key := range []string{models.ExtraAPI, models.ExtraThinkingControl, models.ExtraRemoteModelName} {+ if v := strings.TrimSpace(query(key)); v != "" {extra[key] = v}}- if vendor, ok := catalog.Get(providerID); ok {+ if vendor, ok := modelruntime.Get(providerID); ok {for _, field := range vendor.ExtraFields {if field.Secret || field.Type == "password" {continue}- if v := strings.TrimSpace(c.Query(field.Key)); v != "" {+ if v := strings.TrimSpace(query(field.Key)); v != "" {extra[field.Key] = v}}}- resolved, err := catalog.Resolve(catalog.Ref{- Provider: providerID, Model: modelName, BaseURL: baseURL, ModelType: modelType, Extra: extra,+ resolved, err := modelruntime.Resolve(modelruntime.Ref{+ Provider: providerID, Model: modelName, BaseURL: baseURL, ModelType: modelType, Extra: extra, Override: spec,})if err != nil {_ = c.Error(errors.NewBadRequestError(err.Error()))@@ -300,7 +335,7 @@ func (h *ModelHandler) ResolveModelCatalog(c *gin.Context) {// normalise several base-URL shapes) report nothing rather than a// path this endpoint would have to guess.if resolved.Vendor.Endpoint != nil {- endpointURL, query := resolved.Vendor.Endpoint(catalog.EndpointRequest{+ endpointURL, query := resolved.Vendor.Endpoint(providers.EndpointRequest{BaseURL: resolved.BaseURL,Model: resolved.RemoteModel,ModelType: modelType,diff --git a/internal/handler/model_catalog_visibility_test.go b/internal/handler/model_catalog_visibility_test.goindex 4ae7b8af0..0d3848cd0 100644--- a/internal/handler/model_catalog_visibility_test.go+++ b/internal/handler/model_catalog_visibility_test.go@@ -10,8 +10,6 @@ import ("github.com/Tencent/WeKnora/internal/types""github.com/gin-gonic/gin"-- _ "github.com/Tencent/WeKnora/internal/models/vendors")// listProvidersAs drives the real handler with one tenant role.diff --git a/internal/handler/model_secret_extra_test.go b/internal/handler/model_secret_extra_test.goindex 2fed4ce03..4a170b2b0 100644--- a/internal/handler/model_secret_extra_test.go+++ b/internal/handler/model_secret_extra_test.go@@ -8,7 +8,8 @@ import ("net/http/httptest""testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/Tencent/WeKnora/internal/types/interfaces""github.com/gin-gonic/gin"@@ -43,16 +44,16 @@ const (func registerSecretExtraVendor(t *testing.T) {t.Helper()- catalog.Register(&catalog.Vendor{+ modelruntime.Register(&providers.Definition{ID: secretExtraProvider,Name: "Secret Extra Vendor",ModelTypes: []types.ModelType{types.ModelTypeRerank},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []providers.ExtraField{{Key: "secret_key", Label: "Secret Key", Type: "password", Secret: true},{Key: "region", Label: "Region", Type: "string"},},})- catalog.Register(&catalog.Vendor{+ modelruntime.Register(&providers.Definition{ID: plainExtraProvider,Name: "Plain Extra Vendor",ModelTypes: []types.ModelType{types.ModelTypeRerank},diff --git a/internal/handler/model_spec_flow_test.go b/internal/handler/model_spec_flow_test.gonew file mode 100644index 000000000..3bc72b6c6--- /dev/null+++ b/internal/handler/model_spec_flow_test.go@@ -0,0 +1,69 @@+package handler++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "strings"+ "testing"++ "github.com/Tencent/WeKnora/internal/types"+ "github.com/gin-gonic/gin"+ "github.com/stretchr/testify/require"+)++func TestResolvePostUsesUnsavedSpec(t *testing.T) {+ gin.SetMode(gin.TestMode)+ recorder := httptest.NewRecorder()+ c, _ := gin.CreateTestContext(recorder)+ c.Request = httptest.NewRequest(http.MethodPost, "/api/v1/models/catalog/resolve", strings.NewReader(`{+ "provider": "openai",+ "model": "gpt-5",+ "base_url": "https://api.openai.com/v1",+ "spec": {+ "api": "openai-completions",+ "context_window": 12345,+ "compat": {+ "supports_temperature": false+ }+ }+}`))+ c.Request.Header.Set("Content-Type", "application/json")+ (&ModelHandler{}).ResolveModelCatalog(c)+ require.Empty(t, c.Errors)+ var body struct {+ Data struct {+ API string `json:"api"`+ Capabilities struct {+ ContextWindow int `json:"context_window"`+ } `json:"capabilities"`+ } `json:"data"`+ }+ require.NoError(t, json.Unmarshal(recorder.Body.Bytes(), &body))+ require.Equal(t, "openai-completions", body.Data.API)+ require.Equal(t, 12345, body.Data.Capabilities.ContextWindow)+}++func TestConnectionTestModelCarriesSpecForEveryCapability(t *testing.T) {+ spec := &types.ModelSpecOverride{Compat: map[string]any{"path": "/custom"}}+ for _, kind := range []types.ModelType{+ types.ModelTypeKnowledgeQA,+ types.ModelTypeEmbedding,+ types.ModelTypeRerank,+ types.ModelTypeASR,+ types.ModelTypeVLLM,+ } {+ row := (&InitializationHandler{}).buildTestModel(+ &ModelTestRequest{+ ModelName: "test",+ Provider: "generic",+ APIKey: "row-key",+ Spec: spec,+ },+ kind,+ types.ModelSourceRemote,+ )+ require.Equal(t, spec, row.Parameters.Spec)+ require.Equal(t, "row-key", row.Parameters.APIKey)+ }+}diff --git a/internal/handler/model_test.go b/internal/handler/model_test.goindex b3e510247..91334a100 100644--- a/internal/handler/model_test.go+++ b/internal/handler/model_test.go@@ -4,7 +4,8 @@ import ("encoding/json""testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -52,11 +53,11 @@ func TestRedactedDebugConfig(t *testing.T) {// credential field is called something the name heuristic cannot guess is// still redacted, because the vendor declared it Secret.func TestRedactedDebugConfigUsesVendorDeclaration(t *testing.T) {- catalog.Register(&catalog.Vendor{+ modelruntime.Register(&providers.Definition{ID: "handler-debug-redaction-vendor",Name: "Debug Redaction Vendor",ModelTypes: []types.ModelType{types.ModelTypeRerank},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []providers.ExtraField{{Key: "signing_material", Label: "Signing Material", Secret: true},},})diff --git a/internal/models/api/anthropicmessages/anthropicmessages_test.go b/internal/models/api/anthropicmessages/anthropicmessages_test.goindex 3e03c7db6..43e8a5d83 100644--- a/internal/models/api/anthropicmessages/anthropicmessages_test.go+++ b/internal/models/api/anthropicmessages/anthropicmessages_test.go@@ -9,7 +9,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -23,7 +22,7 @@ func newClient(t *testing.T, baseURL string, mutate func(*Config)) *Client {Auth: api.HeaderAuth("x-api-key", "test-key"),Headers: map[string]string{"anthropic-beta": "test-beta"},},- Settings: catalog.DefaultAnthropicMessages(),+ Settings: api.DefaultAnthropicMessages(),ThinkingLevels: api.ThinkingLevelMap{},Reasoning: true,}@@ -98,7 +97,7 @@ func TestBuildRequestBody_BudgetThinkingAndTools(t *testing.T) {func TestBuildRequestBody_AdaptiveEffort(t *testing.T) {c := newClient(t, "https://api.anthropic.com/v1", func(cfg *Config) {- cfg.Settings.ThinkingMode = catalog.AnthropicThinkingAdaptive+ cfg.Settings.ThinkingMode = api.AnthropicThinkingAdaptivecfg.Settings.SupportsEffort = truecfg.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningXHigh: api.StringPtr("max")}})diff --git a/internal/models/api/anthropicmessages/request.go b/internal/models/api/anthropicmessages/request.goindex a57e4cc72..93deae6f6 100644--- a/internal/models/api/anthropicmessages/request.go+++ b/internal/models/api/anthropicmessages/request.go@@ -2,7 +2,7 @@// (https://docs.anthropic.com/en/api/messages). MiniMax, Zhipu, Moonshot and// Volcengine expose the same protocol on an ".../anthropic" base URL, so the// package contains no vendor names: every deviation is a-// catalog.AnthropicMessagesSettings field.+// api.AnthropicMessagesSettings field.package anthropicmessagesimport (@@ -12,14 +12,13 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.AnthropicMessagesSettings+ Settings api.AnthropicMessagesSettingsThinkingLevels api.ThinkingLevelMapReasoning bool}@@ -142,7 +141,7 @@ func (c *Client) planThinking(opts *api.Options) thinkingPlan {level = levels.Clamp(level)}if !level.Enabled() {- if levels.Supports(api.ReasoningOff) && s.ThinkingMode == catalog.AnthropicThinkingAdaptive {+ if levels.Supports(api.ReasoningOff) && s.ThinkingMode == api.AnthropicThinkingAdaptive {return thinkingPlan{body: map[string]any{"type": "disabled"}}}// Budget mode: omitting the thinking object disables it.@@ -150,7 +149,7 @@ func (c *Client) planThinking(opts *api.Options) thinkingPlan {}plan := thinkingPlan{enabled: true}switch s.ThinkingMode {- case catalog.AnthropicThinkingAdaptive:+ case api.AnthropicThinkingAdaptive:plan.body = map[string]any{"type": "adaptive"}if level.Graded() && s.SupportsEffort {plan.effort = levels.Value(level)@@ -309,7 +308,7 @@ func (c *Client) betaHeader(plan thinkingPlan, opts *api.Options, userValue strifor _, b := range s.BetaHeaders {add(b)}- if plan.enabled && s.ThinkingMode != catalog.AnthropicThinkingAdaptive && s.InterleavedThinkingBeta != "" &&+ if plan.enabled && s.ThinkingMode != api.AnthropicThinkingAdaptive && s.InterleavedThinkingBeta != "" &&opts != nil && len(opts.Tools) > 0 {add(s.InterleavedThinkingBeta)}diff --git a/internal/models/api/arkembeddings/client.go b/internal/models/api/arkembeddings/client.goindex e9bdffd3a..a4eb00fa3 100644--- a/internal/models/api/arkembeddings/client.go+++ b/internal/models/api/arkembeddings/client.go@@ -22,13 +22,12 @@ import ("fmt""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.EmbeddingsSettings+ Settings api.EmbeddingsSettingsDimensions intRetry api.RetryPolicy}diff --git a/internal/models/api/arkembeddings/golden_test.go b/internal/models/api/arkembeddings/golden_test.goindex 9fe8a313e..00a5ddd72 100644--- a/internal/models/api/arkembeddings/golden_test.go+++ b/internal/models/api/arkembeddings/golden_test.go@@ -7,7 +7,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -35,7 +34,7 @@ const endpoint = "/api/v3/embeddings/multimodal"func newClient(url string, dims int) *Client {return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "doubao-embedding-vision-251215", Auth: api.BearerAuth("k")},- Settings: catalog.EmbeddingsSettings{+ Settings: api.EmbeddingsSettings{SendEncodingFormat: true, DimensionsField: "dimensions",},Dimensions: dims,diff --git a/internal/models/api/cohererank/client.go b/internal/models/api/cohererank/client.goindex a83650482..7aebd3474 100644--- a/internal/models/api/cohererank/client.go+++ b/internal/models/api/cohererank/client.go@@ -5,7 +5,7 @@// Jina, Zhipu, SiliconFlow, Qianfan, GPUStack, WeKnora Cloud and any// OpenAI-compatible gateway that serves rerank all speak it. Their// differences — which optional fields are accepted, where the endpoint sits,-// what the documented ceilings are — arrive as catalog.RerankSettings; this+// what the documented ceilings are — arrive as api.RerankSettings; this// package contains no vendor names.package cohererank@@ -16,13 +16,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.RerankSettings+ Settings api.RerankSettings}// Client talks the Cohere rerank shape to one endpoint.diff --git a/internal/models/api/cohererank/golden_test.go b/internal/models/api/cohererank/golden_test.goindex 7b2ef8b37..23b6c8e32 100644--- a/internal/models/api/cohererank/golden_test.go+++ b/internal/models/api/cohererank/golden_test.go@@ -8,7 +8,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -40,7 +39,7 @@ const jinaResponse = `{"usage": {"total_tokens": 32}}`-func newClient(t *testing.T, url string, settings catalog.RerankSettings) *Client {+func newClient(t *testing.T, url string, settings api.RerankSettings) *Client {t.Helper()return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "rerank", Auth: api.BearerAuth("k")},@@ -63,7 +62,7 @@ func serve(t *testing.T, payload string) (*httptest.Server, *string, *map[string}func TestRequestBodyCarriesOnlyWhatTheVendorDeclares(t *testing.T) {- c := newClient(t, "https://example.invalid/v1", catalog.RerankSettings{})+ c := newClient(t, "https://example.invalid/v1", api.RerankSettings{})body, err := c.BuildRequestBody("上海天气", []string{"上海气候", "北京美食"})require.NoError(t, err)@@ -76,7 +75,7 @@ func TestRequestBodyCarriesOnlyWhatTheVendorDeclares(t *testing.T) {func TestRequestBodyAddsTheOptionalFieldsAVendorDeclares(t *testing.T) {c := newClient(t, "https://example.invalid/v1",- catalog.RerankSettings{SendTopN: true, SendReturnDocs: true})+ api.RerankSettings{SendTopN: true, SendReturnDocs: true})body, err := c.BuildRequestBody("q", []string{"a", "b", "c"})require.NoError(t, err)@@ -88,7 +87,7 @@ func TestDecodesAStringDocument(t *testing.T) {server, _, _ := serve(t, zhipuResponse)defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})got, err := c.Rerank(context.Background(), "上海天气", []string{"北京美食", "上海气候"})require.NoError(t, err)@@ -102,7 +101,7 @@ func TestDecodesAnObjectDocument(t *testing.T) {server, _, _ := serve(t, jinaResponse)defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})got, err := c.Rerank(context.Background(), "上海天气", []string{"上海气候", "北京美食"})require.NoError(t, err)@@ -118,7 +117,7 @@ func TestDecodesTheScoreAlias(t *testing.T) {server, _, _ := serve(t, `{"results":[{"index":0,"score":0.42}]}`)defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})got, err := c.Rerank(context.Background(), "q", []string{"d"})require.NoError(t, err)require.Len(t, got, 1)@@ -129,7 +128,7 @@ func TestAppendsTheRerankPathToABareBaseURL(t *testing.T) {server, path, _ := serve(t, `{"results":[]}`)defer server.Close()- c := newClient(t, server.URL+"/v1", catalog.RerankSettings{})+ c := newClient(t, server.URL+"/v1", api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.NoError(t, err)assert.Equal(t, "/v1/rerank", *path)@@ -141,7 +140,7 @@ func TestDoesNotDoubleTheRerankPath(t *testing.T) {server, path, _ := serve(t, `{"results":[]}`)defer server.Close()- c := newClient(t, server.URL+"/api/paas/v4/rerank", catalog.RerankSettings{})+ c := newClient(t, server.URL+"/api/paas/v4/rerank", api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.NoError(t, err)assert.Equal(t, "/api/paas/v4/rerank", *path)@@ -152,7 +151,7 @@ func TestHonoursAVendorDeclaredPath(t *testing.T) {server, path, _ := serve(t, `{"results":[]}`)defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{Path: "/api/v1/rerank"})+ c := newClient(t, server.URL, api.RerankSettings{Path: "/api/v1/rerank"})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.NoError(t, err)assert.Equal(t, "/api/v1/rerank", *path)@@ -162,7 +161,7 @@ func TestRejectsAnOutOfRangeIndex(t *testing.T) {server, _, _ := serve(t, `{"results":[{"index":9,"relevance_score":0.5}]}`)defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.Error(t, err)assert.Contains(t, err.Error(), "out of range")@@ -176,7 +175,7 @@ func TestSurfacesTheVendorErrorBody(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.Error(t, err)assert.Contains(t, err.Error(), "documents exceeds the limit")@@ -187,14 +186,14 @@ func TestSurfacesTheVendorErrorBody(t *testing.T) {// and the operator opted in, and never by default — sending it unasked is how// an undocumented field ends up on every request to every gateway.func TestTruncatePromptTokensIsAbsentByDefault(t *testing.T) {- c := newClient(t, "https://example.invalid/v1", catalog.RerankSettings{})+ c := newClient(t, "https://example.invalid/v1", api.RerankSettings{})body, err := c.BuildRequestBody("q", []string{"d"})require.NoError(t, err)assert.NotContains(t, body, "truncate_prompt_tokens")}func TestTruncatePromptTokensIsSentWhenTheRowOptedIn(t *testing.T) {- c := newClient(t, "https://example.invalid/v1", catalog.RerankSettings{+ c := newClient(t, "https://example.invalid/v1", api.RerankSettings{AcceptsTruncatePromptTokens: true, TruncatePromptTokens: 512,})body, err := c.BuildRequestBody("q", []string{"d"})diff --git a/internal/models/catalog/compat.go b/internal/models/api/compat_settings.gosimilarity index 70%rename from internal/models/catalog/compat.gorename to internal/models/api/compat_settings.goindex f2a479d07..fae87b8cc 100644--- a/internal/models/catalog/compat.go+++ b/internal/models/api/compat_settings.go@@ -1,12 +1,4 @@-package catalog--import (- "encoding/json"- "fmt"- "reflect"-- "github.com/Tencent/WeKnora/internal/models/api"-)+package api// ThinkingFormat names how an OpenAI-compatible vendor encodes the thinking// switch. It is the single most divergent field across vendors, which is@@ -183,7 +175,7 @@ type OpenAIResponsesSettings struct {ExtraBody map[string]any}-// DefaultOpenAIResponses is the api.openai.com baseline.+// DefaultOpenAIResponses is the openai.com baseline.func DefaultOpenAIResponses() OpenAIResponsesSettings {return OpenAIResponsesSettings{SupportsDeveloperRole: true,@@ -211,21 +203,21 @@ const (// AnthropicMessagesCompat is the overlay for the Messages protocol.type AnthropicMessagesCompat struct {- ThinkingMode *AnthropicThinkingMode `json:"thinking_mode,omitempty"`- SupportsEffort *bool `json:"supports_effort,omitempty"`- ThinkingBudgets map[api.ReasoningEffort]int `json:"thinking_budgets,omitempty"`- DefaultMaxTokens *int `json:"default_max_tokens,omitempty"`- SupportsTemperature *bool `json:"supports_temperature,omitempty"`- TemperatureWithThinking *bool `json:"temperature_with_thinking,omitempty"`- SupportsTopP *bool `json:"supports_top_p,omitempty"`- SupportsCacheControl *bool `json:"supports_cache_control,omitempty"`- SupportsCacheControlOnTool *bool `json:"supports_cache_control_on_tools,omitempty"`- LongCacheTTL *string `json:"long_cache_ttl,omitempty"`- Version *string `json:"version,omitempty"`- BetaHeaders []string `json:"beta_headers,omitempty"`- InterleavedThinkingBeta *string `json:"interleaved_thinking_beta,omitempty"`- PromptCacheAccounting *bool `json:"prompt_cache_accounting,omitempty"`- ExtraBody map[string]any `json:"extra_body,omitempty"`+ ThinkingMode *AnthropicThinkingMode `json:"thinking_mode,omitempty"`+ SupportsEffort *bool `json:"supports_effort,omitempty"`+ ThinkingBudgets map[ReasoningEffort]int `json:"thinking_budgets,omitempty"`+ DefaultMaxTokens *int `json:"default_max_tokens,omitempty"`+ SupportsTemperature *bool `json:"supports_temperature,omitempty"`+ TemperatureWithThinking *bool `json:"temperature_with_thinking,omitempty"`+ SupportsTopP *bool `json:"supports_top_p,omitempty"`+ SupportsCacheControl *bool `json:"supports_cache_control,omitempty"`+ SupportsCacheControlOnTool *bool `json:"supports_cache_control_on_tools,omitempty"`+ LongCacheTTL *string `json:"long_cache_ttl,omitempty"`+ Version *string `json:"version,omitempty"`+ BetaHeaders []string `json:"beta_headers,omitempty"`+ InterleavedThinkingBeta *string `json:"interleaved_thinking_beta,omitempty"`+ PromptCacheAccounting *bool `json:"prompt_cache_accounting,omitempty"`+ ExtraBody map[string]any `json:"extra_body,omitempty"`}// AnthropicMessagesSettings is the resolved Messages configuration.@@ -233,7 +225,7 @@ type AnthropicMessagesSettings struct {ThinkingMode AnthropicThinkingModeSupportsEffort bool// ThinkingBudgets maps graded levels to budget_tokens for budget mode.- ThinkingBudgets map[api.ReasoningEffort]int+ ThinkingBudgets map[ReasoningEffort]int// DefaultMaxTokens is used when the caller set no budget (max_tokens is// mandatory on this protocol).DefaultMaxTokens int@@ -252,18 +244,18 @@ type AnthropicMessagesSettings struct {ExtraBody map[string]any}-// DefaultAnthropicMessages is the api.anthropic.com baseline for the+// DefaultAnthropicMessages is the anthropic.com baseline for the// budget-thinking generation of models.func DefaultAnthropicMessages() AnthropicMessagesSettings {return AnthropicMessagesSettings{ThinkingMode: AnthropicThinkingBudget,- ThinkingBudgets: map[api.ReasoningEffort]int{- api.ReasoningMinimal: 1024,- api.ReasoningLow: 2048,- api.ReasoningMedium: 8192,- api.ReasoningHigh: 16384,- api.ReasoningXHigh: 32768,- api.ReasoningMax: 63999,+ ThinkingBudgets: map[ReasoningEffort]int{+ ReasoningMinimal: 1024,+ ReasoningLow: 2048,+ ReasoningMedium: 8192,+ ReasoningHigh: 16384,+ ReasoningXHigh: 32768,+ ReasoningMax: 63999,},DefaultMaxTokens: 4096,SupportsTemperature: true,@@ -292,20 +284,20 @@ const (// GoogleGenerativeAICompat is the overlay for the Gemini protocol.type GoogleGenerativeAICompat struct {- ThinkingMode *GoogleThinkingMode `json:"thinking_mode,omitempty"`- ThinkingBudgets map[api.ReasoningEffort]int `json:"thinking_budgets,omitempty"`- IncludeThoughts *bool `json:"include_thoughts,omitempty"`- SupportsSeed *bool `json:"supports_seed,omitempty"`- SupportsPenalty *bool `json:"supports_penalty,omitempty"`- ExtraGeneration map[string]any `json:"extra_generation_config,omitempty"`- PromptCacheAcct *bool `json:"prompt_cache_accounting,omitempty"`- APIVersionPrefix *string `json:"api_version_prefix,omitempty"`+ ThinkingMode *GoogleThinkingMode `json:"thinking_mode,omitempty"`+ ThinkingBudgets map[ReasoningEffort]int `json:"thinking_budgets,omitempty"`+ IncludeThoughts *bool `json:"include_thoughts,omitempty"`+ SupportsSeed *bool `json:"supports_seed,omitempty"`+ SupportsPenalty *bool `json:"supports_penalty,omitempty"`+ ExtraGeneration map[string]any `json:"extra_generation_config,omitempty"`+ PromptCacheAcct *bool `json:"prompt_cache_accounting,omitempty"`+ APIVersionPrefix *string `json:"api_version_prefix,omitempty"`}// GoogleGenerativeAISettings is the resolved Gemini configuration.type GoogleGenerativeAISettings struct {ThinkingMode GoogleThinkingMode- ThinkingBudgets map[api.ReasoningEffort]int+ ThinkingBudgets map[ReasoningEffort]intIncludeThoughts boolSupportsSeed boolSupportsPenalty bool@@ -319,13 +311,13 @@ type GoogleGenerativeAISettings struct {func DefaultGoogleGenerativeAI() GoogleGenerativeAISettings {return GoogleGenerativeAISettings{ThinkingMode: GoogleThinkingBudget,- ThinkingBudgets: map[api.ReasoningEffort]int{- api.ReasoningMinimal: 128,- api.ReasoningLow: 2048,- api.ReasoningMedium: 8192,- api.ReasoningHigh: 24576,- api.ReasoningXHigh: 32768,- api.ReasoningMax: 32768,+ ThinkingBudgets: map[ReasoningEffort]int{+ ReasoningMinimal: 128,+ ReasoningLow: 2048,+ ReasoningMedium: 8192,+ ReasoningHigh: 24576,+ ReasoningXHigh: 32768,+ ReasoningMax: 32768,},IncludeThoughts: true,SupportsSeed: true,@@ -334,79 +326,3 @@ func DefaultGoogleGenerativeAI() GoogleGenerativeAISettings {APIVersionPrefix: "/v1beta",}}--// VendorCompat carries a vendor's defaults for every protocol it may speak.-type VendorCompat struct {- OpenAICompletions OpenAICompletionsCompat `json:"openai_completions,omitempty"`- OpenAIResponses OpenAIResponsesCompat `json:"openai_responses,omitempty"`- AnthropicMessages AnthropicMessagesCompat `json:"anthropic_messages,omitempty"`- GoogleGenerativeAI GoogleGenerativeAICompat `json:"google_generative_ai,omitempty"`- // Rerank is the rerank protocol overlay. It has no per-protocol variants:- // a vendor serves exactly one rerank dialect.- Rerank RerankCompat `json:"rerank,omitempty"`- // Embeddings is the embedding protocol overlay, likewise one per vendor.- Embeddings EmbeddingsCompat `json:"embeddings,omitempty"`- // Transcriptions is the speech-to-text overlay, likewise one per vendor.- Transcriptions TranscriptionsCompat `json:"transcriptions,omitempty"`-}--// apply writes the set fields of an overlay struct onto a settings struct-// with matching field names, dereferencing pointers. Slices and maps-// replace the default wholesale (no element merge) except map[string]any-// ExtraBody-style fields, which merge key by key.-func apply(settings any, compat any) {- sv := reflect.ValueOf(settings).Elem()- cv := reflect.ValueOf(compat).Elem()- ct := cv.Type()- for i := 0; i < cv.NumField(); i++ {- field := ct.Field(i)- if !field.IsExported() {- continue- }- target := sv.FieldByName(field.Name)- if !target.IsValid() {- panic(fmt.Sprintf("catalog: overlay field %s.%s has no settings counterpart", ct.Name(), field.Name))- }- f := cv.Field(i)- switch f.Kind() {- case reflect.Pointer:- if f.IsNil() {- continue- }- if target.Kind() == reflect.Pointer {- target.Set(f)- } else {- target.Set(f.Elem())- }- case reflect.Slice:- if f.Len() > 0 {- target.Set(f)- }- case reflect.Map:- if f.Len() == 0 {- continue- }- if target.IsNil() {- target.Set(reflect.MakeMap(target.Type()))- }- iter := f.MapRange()- for iter.Next() {- target.SetMapIndex(iter.Key(), iter.Value())- }- }- }-}--// decodeCompat unmarshals a flat compat object into the overlay type for an-// API. Unknown keys are rejected so typos in models.json surface early.-func decodeCompat(raw json.RawMessage, into any) error {- if len(raw) == 0 {- return nil- }- dec := json.NewDecoder(bytesReader(raw))- dec.DisallowUnknownFields()- if err := dec.Decode(into); err != nil {- return fmt.Errorf("decode compat: %w", err)- }- return nil-}diff --git a/internal/models/api/credentials.go b/internal/models/api/credentials.gonew file mode 100644index 000000000..eeb1c816d--- /dev/null+++ b/internal/models/api/credentials.go@@ -0,0 +1,11 @@+package api++// Credentials is what the operator stored for one model row.+type Credentials struct {+ APIKey string+ AppID string+ AppSecret string+}++// Ptr returns a pointer for optional protocol settings.+func Ptr[T any](value T) *T { return &value }diff --git a/internal/models/api/dashscopeembeddings/client.go b/internal/models/api/dashscopeembeddings/client.goindex 358838233..3ca334633 100644--- a/internal/models/api/dashscopeembeddings/client.go+++ b/internal/models/api/dashscopeembeddings/client.go@@ -14,13 +14,12 @@ import ("fmt""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.EmbeddingsSettings+ Settings api.EmbeddingsSettingsDimensions intRetry api.RetryPolicy}diff --git a/internal/models/api/dashscopeembeddings/golden_test.go b/internal/models/api/dashscopeembeddings/golden_test.goindex 1cc924515..d8eaa93e9 100644--- a/internal/models/api/dashscopeembeddings/golden_test.go+++ b/internal/models/api/dashscopeembeddings/golden_test.go@@ -7,7 +7,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -35,7 +34,7 @@ const endpoint = "/api/v1/services/embeddings/multimodal-embedding/multimodal-emfunc newClient(url string, dims int) *Client {return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "tongyi-embedding-vision-plus", Auth: api.BearerAuth("k")},- Settings: catalog.EmbeddingsSettings{DimensionsField: "dimension"},+ Settings: api.EmbeddingsSettings{DimensionsField: "dimension"},Dimensions: dims,})}diff --git a/internal/models/api/dashscoperank/client.go b/internal/models/api/dashscoperank/client.goindex 1f1fc4c01..ccdcfbbf4 100644--- a/internal/models/api/dashscoperank/client.go+++ b/internal/models/api/dashscoperank/client.go@@ -11,13 +11,12 @@ import ("fmt""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.RerankSettings+ Settings api.RerankSettings}// Client talks DashScope's native rerank to one endpoint.diff --git a/internal/models/api/dashscoperank/golden_test.go b/internal/models/api/dashscoperank/golden_test.goindex 675cdca2b..42e7b26d4 100644--- a/internal/models/api/dashscoperank/golden_test.go+++ b/internal/models/api/dashscoperank/golden_test.go@@ -8,7 +8,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -29,7 +28,7 @@ const documentedResponse = `{const endpointURL = "https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank"-func newClient(t *testing.T, url string, settings catalog.RerankSettings) *Client {+func newClient(t *testing.T, url string, settings api.RerankSettings) *Client {t.Helper()return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "gte-rerank-v2", Auth: api.BearerAuth("k")},@@ -38,7 +37,7 @@ func newClient(t *testing.T, url string, settings catalog.RerankSettings) *Clien}func TestRequestBodyMatchesTheDocumentedSchema(t *testing.T) {- c := newClient(t, endpointURL, catalog.RerankSettings{SendReturnDocs: true})+ c := newClient(t, endpointURL, api.RerankSettings{SendReturnDocs: true})body, err := c.BuildRequestBody("上海天气", []string{"北京美食", "上海气候"})require.NoError(t, err)@@ -58,7 +57,7 @@ func TestRequestBodyMatchesTheDocumentedSchema(t *testing.T) {// top_n is mandatory in this shape: zero would ask for nothing back, so the// full document count is always sent regardless of vendor settings.func TestTopNAlwaysCarriesTheDocumentCount(t *testing.T) {- c := newClient(t, endpointURL, catalog.RerankSettings{})+ c := newClient(t, endpointURL, api.RerankSettings{})body, err := c.BuildRequestBody("q", []string{"a", "b", "c", "d"})require.NoError(t, err)assert.Equal(t, float64(4), body["parameters"].(map[string]any)["top_n"])@@ -72,7 +71,7 @@ func TestDecodesTheDocumentedResponse(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})got, err := c.Rerank(context.Background(), "上海天气", []string{"北京美食", "上海气候"})require.NoError(t, err)@@ -91,7 +90,7 @@ func TestSurfacesAnInBodyError(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.Error(t, err)assert.Contains(t, err.Error(), "documents is too long")@@ -108,7 +107,7 @@ func TestPostsToTheBaseURLItself(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL+"/api/v1/services/rerank/text-rerank/text-rerank", catalog.RerankSettings{})+ c := newClient(t, server.URL+"/api/v1/services/rerank/text-rerank/text-rerank", api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d"})require.NoError(t, err)assert.Equal(t, "/api/v1/services/rerank/text-rerank/text-rerank", gotPath,diff --git a/internal/models/catalog/embeddings.go b/internal/models/api/embeddings_settings.gosimilarity index 89%rename from internal/models/catalog/embeddings.gorename to internal/models/api/embeddings_settings.goindex 87b12b0f9..85db5fdc9 100644--- a/internal/models/catalog/embeddings.go+++ b/internal/models/api/embeddings_settings.go@@ -1,6 +1,4 @@-package catalog--import "github.com/Tencent/WeKnora/internal/models/api"+package api// EmbeddingsCompat is the overlay form (every field optional) of the// embedding settings. JSON keys are the documented names used in models.json@@ -9,7 +7,7 @@ type EmbeddingsCompat struct {// API overrides the vendor's embedding protocol for one model. Aliyun and// Volcengine each serve two: a text endpoint in the OpenAI shape and a// multimodal one of their own, chosen by which model the row names.- API *api.EmbeddingAPI `json:"api,omitempty"`+ API *EmbeddingAPI `json:"api,omitempty"`Path *string `json:"path,omitempty"`SendEncodingFormat *bool `json:"send_encoding_format,omitempty"`DimensionsField *string `json:"dimensions_field,omitempty"`@@ -30,7 +28,7 @@ type EmbeddingsCompat struct {type EmbeddingsSettings struct {// API is the protocol this model speaks, which may differ from the// vendor's default.- API api.EmbeddingAPI+ API EmbeddingAPI// Path is appended to the base URL; vendors whose default base URL names// the full endpoint leave it empty.Path string@@ -51,7 +49,7 @@ type EmbeddingsSettings struct {TruncateValue string// InputTypeField names the parameter that distinguishes an indexed// document from a search query, and InputTypeValues maps the neutral- // api.EmbedInputType values onto the vendor's vocabulary. Asymmetric+ // EmbedInputType values onto the vendor's vocabulary. Asymmetric// models score the two sides differently and are measurably worse when// both are embedded the same way.InputTypeField string@@ -71,14 +69,14 @@ type EmbeddingsSettings struct {ExtraBody map[string]any}-// BatchLimits renders the documented ceilings for api.SplitBatches.-func (s EmbeddingsSettings) BatchLimits() api.BatchLimits {- return api.BatchLimits{MaxItems: s.MaxBatchSize, MaxItemRunes: s.MaxInputChars}+// BatchLimits renders the documented ceilings for SplitBatches.+func (s EmbeddingsSettings) BatchLimits() BatchLimits {+ return BatchLimits{MaxItems: s.MaxBatchSize, MaxItemRunes: s.MaxInputChars}}// InputTypeValue maps a neutral input kind onto the vendor's vocabulary,// returning "" when this vendor does not distinguish the two sides.-func (s EmbeddingsSettings) InputTypeValue(kind api.EmbedInputType) string {+func (s EmbeddingsSettings) InputTypeValue(kind EmbedInputType) string {if s.InputTypeField == "" {return ""}diff --git a/internal/models/api/googleembeddings/client.go b/internal/models/api/googleembeddings/client.goindex 60db1330a..e44c81852 100644--- a/internal/models/api/googleembeddings/client.go+++ b/internal/models/api/googleembeddings/client.go@@ -22,13 +22,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.EmbeddingsSettings+ Settings api.EmbeddingsSettingsDimensions intRetry api.RetryPolicy}diff --git a/internal/models/api/googleembeddings/golden_test.go b/internal/models/api/googleembeddings/golden_test.goindex 40f8f93af..ab29eb839 100644--- a/internal/models/api/googleembeddings/golden_test.go+++ b/internal/models/api/googleembeddings/golden_test.go@@ -7,7 +7,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -18,7 +17,7 @@ const documentedResponse = `{"embeddings":[{"values":[0.1,0.2]},{"values":[0.3,0var retrievalTasks = map[string]string{"document": "RETRIEVAL_DOCUMENT", "query": "RETRIEVAL_QUERY"}-func newClient(url, model string, settings catalog.EmbeddingsSettings, dims int) *Client {+func newClient(url, model string, settings api.EmbeddingsSettings, dims int) *Client {return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: model, Auth: api.HeaderAuth("x-goog-api-key", "k")},Settings: settings,@@ -30,7 +29,7 @@ func newClient(url, model string, settings catalog.EmbeddingsSettings, dims int)// fully qualified models/{id}.func TestRequestBodyForATaskTypeModel(t *testing.T) {c := newClient("https://generativelanguage.googleapis.com/v1beta", "gemini-embedding-001",- catalog.EmbeddingsSettings{+ api.EmbeddingsSettings{InputTypeField: "taskType", InputTypeValues: retrievalTasks,DimensionsField: "outputDimensionality",}, 768)@@ -56,7 +55,7 @@ func TestRequestBodyForATaskTypeModel(t *testing.T) {// undocumented parameter, so a model that declares none sends none.func TestNoTaskTypeWhereTheModelHasNone(t *testing.T) {c := newClient("https://generativelanguage.googleapis.com/v1beta", "gemini-embedding-2",- catalog.EmbeddingsSettings{}, 0)+ api.EmbeddingsSettings{}, 0)req := c.BuildRequestBody([]string{"a"}, api.EmbedDocument)["requests"].([]any)[0].(map[string]any)assert.NotContains(t, req, "embedContentConfig", "no option declared, so no config object")assert.NotContains(t, req, "taskType")@@ -72,7 +71,7 @@ func TestPostsToTheModelsMethod(t *testing.T) {defer server.Close()// An id stored with the prefix must not become models/models/…- c := newClient(server.URL+"/v1beta", "models/gemini-embedding-001", catalog.EmbeddingsSettings{}, 0)+ c := newClient(server.URL+"/v1beta", "models/gemini-embedding-001", api.EmbeddingsSettings{}, 0)got, err := c.Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, [][]float32{{0.1, 0.2}, {0.3, 0.4}}, got)@@ -80,7 +79,7 @@ func TestPostsToTheModelsMethod(t *testing.T) {// A row that chats through the OpenAI-compatible facade stores// .../v1beta/openai; its embeddings still go to the native method.- c = newClient(server.URL+"/v1beta/openai/", "gemini-embedding-001", catalog.EmbeddingsSettings{}, 0)+ c = newClient(server.URL+"/v1beta/openai/", "gemini-embedding-001", api.EmbeddingsSettings{}, 0)_, err = c.Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, "/v1beta/models/gemini-embedding-001:batchEmbedContents", path)@@ -94,7 +93,7 @@ func TestShortReplyIsAnError(t *testing.T) {}))defer server.Close()- _, err := newClient(server.URL+"/v1beta", "gemini-embedding-001", catalog.EmbeddingsSettings{}, 0).+ _, err := newClient(server.URL+"/v1beta", "gemini-embedding-001", api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)require.Error(t, err)assert.Contains(t, err.Error(), "1 embeddings for 2 inputs")diff --git a/internal/models/api/googlegenai/googlegenai_test.go b/internal/models/api/googlegenai/googlegenai_test.goindex bf0abbf64..4dd545eaf 100644--- a/internal/models/api/googlegenai/googlegenai_test.go+++ b/internal/models/api/googlegenai/googlegenai_test.go@@ -11,7 +11,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")@@ -24,7 +23,7 @@ func newTestClient(t *testing.T, baseURL string, mutate func(*Config)) *Client {ModelID: "model-123",Auth: api.HeaderAuth("x-goog-api-key", "test-key"),},- Settings: catalog.DefaultGoogleGenerativeAI(),+ Settings: api.DefaultGoogleGenerativeAI(),Reasoning: true,}if mutate != nil {@@ -196,7 +195,7 @@ func TestBuildRequestBodyGolden(t *testing.T) {{name: "level mode",mutate: func(c *Config) {- c.Settings.ThinkingMode = catalog.GoogleThinkingLevel+ c.Settings.ThinkingMode = api.GoogleThinkingLevelc.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningHigh: api.StringPtr("high")}},thinking: `{"thinkingLevel": "high", "includeThoughts": true}`,@@ -253,26 +252,26 @@ func TestThinkingConfigVariants(t *testing.T) {},{name: "mode none",- mutate: func(c *Config) { c.Settings.ThinkingMode = catalog.GoogleThinkingNone },+ mutate: func(c *Config) { c.Settings.ThinkingMode = api.GoogleThinkingNone },opts: &api.Options{ReasoningEffort: api.ReasoningHigh},want: "",},{name: "level off unmapped",- mutate: func(c *Config) { c.Settings.ThinkingMode = catalog.GoogleThinkingLevel },+ mutate: func(c *Config) { c.Settings.ThinkingMode = api.GoogleThinkingLevel },opts: &api.Options{ReasoningEffort: api.ReasoningOff},want: "",},{name: "level auto",- mutate: func(c *Config) { c.Settings.ThinkingMode = catalog.GoogleThinkingLevel },+ mutate: func(c *Config) { c.Settings.ThinkingMode = api.GoogleThinkingLevel },opts: &api.Options{ReasoningEffort: api.ReasoningAuto},want: `{"includeThoughts": true}`,},{name: "level clamps unsupported rung",mutate: func(c *Config) {- c.Settings.ThinkingMode = catalog.GoogleThinkingLevel+ c.Settings.ThinkingMode = api.GoogleThinkingLevelc.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningMedium: nil,api.ReasoningHigh: api.StringPtr("high"),diff --git a/internal/models/api/googlegenai/request.go b/internal/models/api/googlegenai/request.goindex 7c9b3795a..f7fd1ddf4 100644--- a/internal/models/api/googlegenai/request.go+++ b/internal/models/api/googlegenai/request.go@@ -1,6 +1,6 @@// Package googlegenai implements the native Google Gemini generateContent// wire protocol (https://ai.google.dev/api/generate-content). Every-// model-specific deviation is driven by catalog.GoogleGenerativeAISettings;+// model-specific deviation is driven by api.GoogleGenerativeAISettings;// this package contains no vendor names beyond the protocol itself.package googlegenai@@ -14,13 +14,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.GoogleGenerativeAISettings+ Settings api.GoogleGenerativeAISettings// ThinkingLevels maps neutral levels to the vendor vocabulary// (thinkingLevel values for Gemini 3, "off" support for budget models).ThinkingLevels api.ThinkingLevelMap@@ -469,10 +468,10 @@ func (c *Client) thinkingConfig(opts *api.Options) map[string]any {}mode := s.ThinkingModeif mode == "" {- mode = catalog.GoogleThinkingBudget+ mode = api.GoogleThinkingBudget}switch mode {- case catalog.GoogleThinkingBudget:+ case api.GoogleThinkingBudget:switch level {case api.ReasoningOff:if levels.Supports(api.ReasoningOff) {@@ -493,7 +492,7 @@ func (c *Client) thinkingConfig(opts *api.Options) map[string]any {}return map[string]any{"thinkingBudget": budget, "includeThoughts": s.IncludeThoughts}}- case catalog.GoogleThinkingLevel:+ case api.GoogleThinkingLevel:switch level {case api.ReasoningOff:// Gemini 3 cannot switch thinking off; only send a level when thediff --git a/internal/models/api/nimrerank/client.go b/internal/models/api/nimrerank/client.goindex 4eaefbeff..5aa803480 100644--- a/internal/models/api/nimrerank/client.go+++ b/internal/models/api/nimrerank/client.go@@ -3,7 +3,7 @@//// Two things separate it from the Cohere dialect and both matter to callers.// The score is an unbounded log-odds value that is routinely negative, not a-// 0..1 relevance — catalog.RerankSettings.ScoreScale says so. And `truncate`+// 0..1 relevance — api.RerankSettings.ScoreScale says so. And `truncate`// defaults to "NONE", which means an over-long passage fails the request// instead of being cut, so the vendor sets it explicitly.//@@ -16,13 +16,12 @@ import ("fmt""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.RerankSettings+ Settings api.RerankSettings}// Client talks NIM reranking to one endpoint.diff --git a/internal/models/api/nimrerank/golden_test.go b/internal/models/api/nimrerank/golden_test.goindex daa93f292..e44f1ebd2 100644--- a/internal/models/api/nimrerank/golden_test.go+++ b/internal/models/api/nimrerank/golden_test.go@@ -8,7 +8,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -19,7 +18,7 @@ import (// https://docs.api.nvidia.com/nim/reference/nvidia-llama-3_2-nv-rerankqa-1b-v2-infer//// Note the negative logit. This protocol does not return a 0..1 relevance-// score, which is why catalog.RerankSettings.ScoreScale exists.+// score, which is why api.RerankSettings.ScoreScale exists.const documentedResponse = `{"rankings": [{"index": 2, "logit": 0.226318359375},@@ -28,7 +27,7 @@ const documentedResponse = `{]}`-func newClient(t *testing.T, url string, settings catalog.RerankSettings) *Client {+func newClient(t *testing.T, url string, settings api.RerankSettings) *Client {t.Helper()return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "nvidia/nv-rerankqa-mistral-4b-v3", Auth: api.BearerAuth("k")},@@ -38,7 +37,7 @@ func newClient(t *testing.T, url string, settings catalog.RerankSettings) *Clienfunc TestRequestBodyMatchesTheDocumentedSchema(t *testing.T) {c := newClient(t, "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking",- catalog.RerankSettings{Truncate: "END", ScoreScale: api.ScoreLogit})+ api.RerankSettings{Truncate: "END", ScoreScale: api.ScoreLogit})body, err := c.BuildRequestBody("q", []string{"d0", "d1"})require.NoError(t, err)@@ -55,7 +54,7 @@ func TestRequestBodyMatchesTheDocumentedSchema(t *testing.T) {// passage instead of cutting it. A vendor that does not set it must not have// the key invented for it either.func TestTruncateIsOmittedWhenUnset(t *testing.T) {- c := newClient(t, "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking", catalog.RerankSettings{})+ c := newClient(t, "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking", api.RerankSettings{})body, err := c.BuildRequestBody("q", []string{"d0"})require.NoError(t, err)assert.NotContains(t, body, "truncate")@@ -69,7 +68,7 @@ func TestDecodesTheDocumentedResponse(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{ScoreScale: api.ScoreLogit})+ c := newClient(t, server.URL, api.RerankSettings{ScoreScale: api.ScoreLogit})got, err := c.Rerank(context.Background(), "q", []string{"d0", "d1", "d2"})require.NoError(t, err)@@ -89,7 +88,7 @@ func TestRejectsAnOutOfRangeIndex(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d0"})require.Error(t, err)assert.Contains(t, err.Error(), "out of range")@@ -103,7 +102,7 @@ func TestSurfacesTheVendorErrorBody(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL, catalog.RerankSettings{})+ c := newClient(t, server.URL, api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d0"})require.Error(t, err)assert.Contains(t, err.Error(), "input too long")@@ -120,7 +119,7 @@ func TestRequestReachesTheConfiguredURL(t *testing.T) {}))defer server.Close()- c := newClient(t, server.URL+"/v1/retrieval/nvidia/reranking", catalog.RerankSettings{})+ c := newClient(t, server.URL+"/v1/retrieval/nvidia/reranking", api.RerankSettings{})_, err := c.Rerank(context.Background(), "q", []string{"d0"})require.NoError(t, err)assert.Equal(t, "/v1/retrieval/nvidia/reranking", gotPath, "the base URL already names the endpoint")diff --git a/internal/models/api/openaichataudio/client.go b/internal/models/api/openaichataudio/client.goindex 1e71ddbda..be45425ee 100644--- a/internal/models/api/openaichataudio/client.go+++ b/internal/models/api/openaichataudio/client.go@@ -21,13 +21,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.TranscriptionsSettings+ Settings api.TranscriptionsSettingsRetry api.RetryPolicy}@@ -104,7 +103,7 @@ func (c *Client) BuildRequestBody(req api.TranscriptionRequest) (map[string]any,}},}},}- if req.Language != "" && c.cfg.Settings.LanguageParam == catalog.LanguageASROptions {+ if req.Language != "" && c.cfg.Settings.LanguageParam == api.LanguageASROptions {body["asr_options"] = map[string]any{"language": req.Language}}return body, nildiff --git a/internal/models/api/openaichataudio/golden_test.go b/internal/models/api/openaichataudio/golden_test.goindex 8515a02ff..e9d1b29f7 100644--- a/internal/models/api/openaichataudio/golden_test.go+++ b/internal/models/api/openaichataudio/golden_test.go@@ -8,7 +8,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -38,10 +37,10 @@ const qwenASRResponse = `{const withSeconds = `{"choices":[{"message":{"role":"assistant","content":"x"}}],"usage":{"seconds":3}}`func newClient(url, model string) *Client {- return newClientWith(url, model, catalog.TranscriptionsSettings{})+ return newClientWith(url, model, api.TranscriptionsSettings{})}-func newClientWith(url, model string, settings catalog.TranscriptionsSettings) *Client {+func newClientWith(url, model string, settings api.TranscriptionsSettings) *Client {return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: model, Auth: api.BearerAuth("k")},Settings: settings,@@ -80,7 +79,7 @@ func TestDataURIMediaTypeFollowsTheExtension(t *testing.T) {// sized to exactly the encoded budget without the prefix goes over it.func TestEncodedCeilingCountsTheWholeDataURI(t *testing.T) {const limit = 1024- c := newClientWith("https://example.invalid", "m", catalog.TranscriptionsSettings{MaxEncodedBytes: limit})+ c := newClientWith("https://example.invalid", "m", api.TranscriptionsSettings{MaxEncodedBytes: limit})audio := make([]byte, limit*3/4) // base64 of this is exactly limit bytes_, err := c.BuildRequestBody(api.TranscriptionRequest{Audio: audio, FileName: "a.wav"})require.Error(t, err)@@ -99,7 +98,7 @@ func TestLanguageGoesInASROptionsWhereDeclared(t *testing.T) {assert.NotContains(t, body, "asr_options", "undeclared, so not sent")body, err = newClientWith("https://example.invalid", "m",- catalog.TranscriptionsSettings{LanguageParam: catalog.LanguageASROptions}).BuildRequestBody(req)+ api.TranscriptionsSettings{LanguageParam: api.LanguageASROptions}).BuildRequestBody(req)require.NoError(t, err)assert.Equal(t, map[string]any{"language": "zh"}, body["asr_options"])}diff --git a/internal/models/api/openaicompletions/golden_test.go b/internal/models/api/openaicompletions/golden_test.goindex 21cea7394..a4f65cf2e 100644--- a/internal/models/api/openaicompletions/golden_test.go+++ b/internal/models/api/openaicompletions/golden_test.go@@ -9,7 +9,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -21,7 +20,7 @@ func newClient(t *testing.T, mutate func(*Config)) *Client {Endpoint: api.Endpoint{BaseURL: "https://example.com/v1", Model: "m", ModelID: "id", Auth: api.BearerAuth("k"),},- Settings: catalog.DefaultOpenAICompletions(),+ Settings: api.DefaultOpenAICompletions(),ThinkingLevels: api.ThinkingLevelMap{},}if mutate != nil {@@ -76,7 +75,7 @@ func TestGolden(t *testing.T) {mutate: func(c *Config) {c.Settings.SupportsStore = truec.Settings.SupportsDeveloperRole = true- c.Settings.ThinkingFormat = catalog.ThinkingFormatOpenAI+ c.Settings.ThinkingFormat = api.ThinkingFormatOpenAIc.Settings.SupportsReasoningEffort = true},opts: toolOpts,@@ -94,7 +93,7 @@ func TestGolden(t *testing.T) {c.Reasoning = truec.Settings.SupportsDeveloperRole = truec.Settings.SupportsTemperature = false- c.Settings.ThinkingFormat = catalog.ThinkingFormatOpenAI+ c.Settings.ThinkingFormat = api.ThinkingFormatOpenAIc.Settings.SupportsReasoningEffort = true},opts: &api.Options{Temperature: 0.7, MaxTokens: 10, ReasoningEffort: api.ReasoningMedium},@@ -105,7 +104,7 @@ func TestGolden(t *testing.T) {{name: "openai gpt-5.1 off maps to reasoning_effort none",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatOpenAI+ c.Settings.ThinkingFormat = api.ThinkingFormatOpenAIc.Settings.SupportsReasoningEffort = truec.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningOff: api.StringPtr("none")}},@@ -116,7 +115,7 @@ func TestGolden(t *testing.T) {name: "deepseek: max_tokens, thinking.type + effort clamp, tool_choice required dropped",mutate: func(c *Config) {c.Settings.MaxTokensField = "max_tokens"- c.Settings.ThinkingFormat = catalog.ThinkingFormatThinkingType+ c.Settings.ThinkingFormat = api.ThinkingFormatThinkingTypec.Settings.SupportsReasoningEffort = truec.Settings.ToolChoiceModes = []string{"none", "auto"}c.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningMedium: api.StringPtr("high")}@@ -131,7 +130,7 @@ func TestGolden(t *testing.T) {{name: "deepseek reasoner: always-on, off request sends nothing",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatThinkingType+ c.Settings.ThinkingFormat = api.ThinkingFormatThinkingTypec.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningOff: nil}},opts: &api.Options{Thinking: ptrBool(false)},@@ -140,7 +139,7 @@ func TestGolden(t *testing.T) {{name: "zhipu: thinking disabled explicitly",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatThinkingType+ c.Settings.ThinkingFormat = api.ThinkingFormatThinkingType},opts: &api.Options{Thinking: ptrBool(false)},want: map[string]any{"thinking": map[string]any{"type": "disabled"}},@@ -148,7 +147,7 @@ func TestGolden(t *testing.T) {{name: "minimax m3: adaptive thinking value",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatThinkingType+ c.Settings.ThinkingFormat = api.ThinkingFormatThinkingTypec.Settings.ThinkingEnabledValue = "adaptive"},opts: &api.Options{Thinking: ptrBool(true)},@@ -158,7 +157,7 @@ func TestGolden(t *testing.T) {name: "dashscope hybrid: enable_thinking always sent, budget, non-stream forces off",mutate: func(c *Config) {c.Settings.MaxTokensField = "max_tokens"- c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking+ c.Settings.ThinkingFormat = api.ThinkingFormatEnableThinkingc.Settings.ThinkingBudgetField = "thinking_budget"c.Settings.ThinkingAlwaysSend = truec.Settings.ThinkingDisableOnNonStream = true@@ -170,7 +169,7 @@ func TestGolden(t *testing.T) {{name: "dashscope qwen3.8: effort and budget are mutually exclusive, budget yields",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking+ c.Settings.ThinkingFormat = api.ThinkingFormatEnableThinkingc.Settings.ThinkingBudgetField = "thinking_budget"c.Settings.ThinkingBudgetExcludesEffort = truec.Settings.SupportsReasoningEffort = true@@ -187,7 +186,7 @@ func TestGolden(t *testing.T) {{name: "dashscope qwen3.8: budget still rides along when no effort is graded",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking+ c.Settings.ThinkingFormat = api.ThinkingFormatEnableThinkingc.Settings.ThinkingBudgetField = "thinking_budget"c.Settings.ThinkingBudgetExcludesEffort = true},@@ -200,7 +199,7 @@ func TestGolden(t *testing.T) {{name: "dashscope hybrid streaming: enable_thinking true with budget",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking+ c.Settings.ThinkingFormat = api.ThinkingFormatEnableThinkingc.Settings.ThinkingBudgetField = "thinking_budget"c.Settings.ThinkingAlwaysSend = truec.Settings.ThinkingDisableOnNonStream = true@@ -212,7 +211,7 @@ func TestGolden(t *testing.T) {{name: "dashscope: no preference still pins enable_thinking false",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking+ c.Settings.ThinkingFormat = api.ThinkingFormatEnableThinkingc.Settings.ThinkingAlwaysSend = true},opts: &api.Options{Temperature: 0.1},@@ -221,7 +220,7 @@ func TestGolden(t *testing.T) {{name: "vllm: chat_template_kwargs",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatChatTemplateKwargs+ c.Settings.ThinkingFormat = api.ThinkingFormatChatTemplateKwargs},opts: &api.Options{Thinking: ptrBool(true)},want: map[string]any{"chat_template_kwargs": map[string]any{"enable_thinking": true}},@@ -229,7 +228,7 @@ func TestGolden(t *testing.T) {{name: "openrouter: reasoning effort object and enabled=false",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatOpenRouter+ c.Settings.ThinkingFormat = api.ThinkingFormatOpenRouterc.Settings.SupportsReasoningEffort = true},opts: &api.Options{ReasoningEffort: api.ReasoningHigh},@@ -238,7 +237,7 @@ func TestGolden(t *testing.T) {{name: "openrouter: auto enables without effort",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatOpenRouter+ c.Settings.ThinkingFormat = api.ThinkingFormatOpenRouterc.Settings.SupportsReasoningEffort = true},opts: &api.Options{ReasoningEffort: api.ReasoningAuto},@@ -256,7 +255,7 @@ func TestGolden(t *testing.T) {{name: "no thinking preference on a plain vendor sends no thinking fields",mutate: func(c *Config) {- c.Settings.ThinkingFormat = catalog.ThinkingFormatThinkingType+ c.Settings.ThinkingFormat = api.ThinkingFormatThinkingType},opts: &api.Options{Temperature: 0.2},want: map[string]any{"thinking": nil, "reasoning_effort": nil, "enable_thinking": nil},@@ -277,6 +276,35 @@ func TestGolden(t *testing.T) {opts: &api.Options{Temperature: 0.2},want: map[string]any{"enable_search": true, "temperature": 0.2},},+ {+ name: "both caller budget aliases produce only the configured wire field",+ opts: &api.Options{MaxTokens: 100, MaxCompletionTokens: 200},+ want: map[string]any{"max_completion_tokens": float64(200), "max_tokens": nil},+ },+ {+ name: "extra_body cannot add the legacy budget beside the caller completion budget",+ mutate: func(c *Config) {+ c.Settings.ExtraBody = map[string]any{"max_tokens": 900, "max_completion_tokens": 800}+ },+ opts: &api.Options{MaxTokens: 100},+ want: map[string]any{"max_completion_tokens": float64(100), "max_tokens": nil},+ },+ {+ name: "conflicting extra_body budgets follow the configured field without caller options",+ mutate: func(c *Config) {+ c.Settings.ExtraBody = map[string]any{"max_tokens": 900, "max_completion_tokens": 800}+ },+ want: map[string]any{"max_completion_tokens": float64(800), "max_tokens": nil},+ },+ {+ name: "legacy budget vendors discard the conflicting completion budget",+ mutate: func(c *Config) {+ c.Settings.MaxTokensField = "max_tokens"+ c.Settings.ExtraBody = map[string]any{"max_completion_tokens": 800}+ },+ opts: &api.Options{MaxTokens: 100},+ want: map[string]any{"max_tokens": float64(100), "max_completion_tokens": nil},+ },}for _, tc := range cases {t.Run(tc.name, func(t *testing.T) {@@ -383,8 +411,8 @@ func TestChat_NonStreamDecoding(t *testing.T) {BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk"),Headers: map[string]string{"X-Custom": "1", "Authorization": "Bearer evil"},},- Settings: func() catalog.OpenAICompletionsSettings {- s := catalog.DefaultOpenAICompletions()+ Settings: func() api.OpenAICompletionsSettings {+ s := api.DefaultOpenAICompletions()s.PromptCacheAccounting = truereturn s}(),@@ -409,7 +437,7 @@ func TestChat_HTTPErrorSurfacesBody(t *testing.T) {}))defer server.Close()c := New(Config{- Endpoint: api.Endpoint{BaseURL: server.URL, Model: "m"}, Settings: catalog.DefaultOpenAICompletions(),+ Endpoint: api.Endpoint{BaseURL: server.URL, Model: "m"}, Settings: api.DefaultOpenAICompletions(),})_, err := c.Chat(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.Error(t, err)@@ -451,7 +479,7 @@ func TestChatStream_Sequence(t *testing.T) {defer server.Close()c := New(Config{- Endpoint: api.Endpoint{BaseURL: server.URL, Model: "m"}, Settings: catalog.DefaultOpenAICompletions(),+ Endpoint: api.Endpoint{BaseURL: server.URL, Model: "m"}, Settings: api.DefaultOpenAICompletions(),})ch, err := c.ChatStream(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.NoError(t, err)@@ -527,8 +555,8 @@ func TestChat_ClassifiesCacheStatusWithoutUsageBlock(t *testing.T) {t.Run(tc.name, func(t *testing.T) {c := New(Config{Endpoint: api.Endpoint{BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk")},- Settings: func() catalog.OpenAICompletionsSettings {- s := catalog.DefaultOpenAICompletions()+ Settings: func() api.OpenAICompletionsSettings {+ s := api.DefaultOpenAICompletions()s.PromptCacheAccounting = tc.accountingreturn s}(),@@ -554,7 +582,7 @@ func TestChatStream_TolerantDoneSentinel(t *testing.T) {c := New(Config{Endpoint: api.Endpoint{BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk")},- Settings: catalog.DefaultOpenAICompletions(),+ Settings: api.DefaultOpenAICompletions(),})ch, err := c.ChatStream(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.NoError(t, err)@@ -586,7 +614,7 @@ func TestChatStream_UndecodableChunkFailsTheStream(t *testing.T) {c := New(Config{Endpoint: api.Endpoint{BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk")},- Settings: catalog.DefaultOpenAICompletions(),+ Settings: api.DefaultOpenAICompletions(),})ch, err := c.ChatStream(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.NoError(t, err)@@ -619,7 +647,7 @@ func TestChat_MalformedToolCallIsAnError(t *testing.T) {c := New(Config{Endpoint: api.Endpoint{BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk")},- Settings: catalog.DefaultOpenAICompletions(),+ Settings: api.DefaultOpenAICompletions(),})_, err := c.Chat(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.Error(t, err, "a tool call that will not decode must not pass as a plain answer")@@ -642,7 +670,7 @@ func TestChatStream_MalformedToolCallFailsTheStream(t *testing.T) {c := New(Config{Endpoint: api.Endpoint{BaseURL: server.URL + "/v1", Model: "m", Auth: api.BearerAuth("sk")},- Settings: catalog.DefaultOpenAICompletions(),+ Settings: api.DefaultOpenAICompletions(),})ch, err := c.ChatStream(context.Background(), []api.Message{{Role: "user", Content: "hi"}}, nil)require.NoError(t, err)diff --git a/internal/models/api/openaicompletions/request.go b/internal/models/api/openaicompletions/request.goindex 69f2b2a2b..a949891f5 100644--- a/internal/models/api/openaicompletions/request.go+++ b/internal/models/api/openaicompletions/request.go@@ -1,6 +1,6 @@// Package openaicompletions implements the OpenAI Chat Completions wire// protocol. Every vendor-specific deviation is driven by-// catalog.OpenAICompletionsSettings; this package contains no vendor names.+// api.OpenAICompletionsSettings; this package contains no vendor names.package openaicompletionsimport (@@ -9,13 +9,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.OpenAICompletionsSettings+ Settings api.OpenAICompletionsSettings// ThinkingLevels maps neutral levels to the vendor vocabulary.ThinkingLevels api.ThinkingLevelMap// Reasoning marks a reasoning model (developer role, no sampling params@@ -157,7 +156,7 @@ func (c *Client) convertMessages(messages []api.Message) []wireMessage {}// reasoning_details is OpenRouter's format; other vendors reject it.raw, ok := msg.ReasoningMetadata[metadataReasoningDetails]- if ok && len(raw) > 0 && s.ThinkingFormat == catalog.ThinkingFormatOpenRouter {+ if ok && len(raw) > 0 && s.ThinkingFormat == api.ThinkingFormatOpenRouter {wm.ReasoningDetails = raw}}@@ -242,6 +241,18 @@ func (c *Client) buildBody(messages []api.Message, opts *api.Options, stream boobody[k] = v}}+ // These names are mutually exclusive, including when extra_body supplies+ // one or both. Keep the protocol's configured field; an explicit caller+ // budget already takes precedence over extra_body above.+ if _, legacy := body["max_tokens"]; legacy {+ if _, completion := body["max_completion_tokens"]; completion {+ if s.MaxTokensField == "max_tokens" {+ delete(body, "max_completion_tokens")+ } else {+ delete(body, "max_tokens")+ }+ }+ }return body, nil}@@ -310,10 +321,10 @@ func (c *Client) applyTools(body map[string]any, opts *api.Options) {}// applyThinking encodes the requested reasoning level in the vendor's-// dialect. See catalog.ThinkingFormat for the dialects.+// dialect. See api.ThinkingFormat for the dialects.func (c *Client) applyThinking(body map[string]any, opts *api.Options, stream bool) {s := c.cfg.Settings- if s.ThinkingFormat == catalog.ThinkingFormatNone || s.ThinkingFormat == "" {+ if s.ThinkingFormat == api.ThinkingFormatNone || s.ThinkingFormat == "" {return}levels := c.cfg.ThinkingLevels@@ -357,7 +368,7 @@ func (c *Client) applyThinking(body map[string]any, opts *api.Options, stream bo}switch s.ThinkingFormat {- case catalog.ThinkingFormatOpenAI:+ case api.ThinkingFormatOpenAI:if enabled {if effort != "" {body[effortField] = effort@@ -365,7 +376,7 @@ func (c *Client) applyThinking(body map[string]any, opts *api.Options, stream bo} else if v, ok := levels[api.ReasoningOff]; ok && v != nil && *v != "" {body[effortField] = *v}- case catalog.ThinkingFormatThinkingType:+ case api.ThinkingFormatThinkingType:if enabled {body["thinking"] = map[string]any{"type": orDefault(s.ThinkingEnabledValue, "enabled")}if effort != "" {@@ -374,14 +385,14 @@ func (c *Client) applyThinking(body map[string]any, opts *api.Options, stream bo} else {body["thinking"] = map[string]any{"type": "disabled"}}- case catalog.ThinkingFormatEnableThinking:+ case api.ThinkingFormatEnableThinking:body["enable_thinking"] = enabledif effort != "" {body[effortField] = effort}- case catalog.ThinkingFormatChatTemplateKwargs:+ case api.ThinkingFormatChatTemplateKwargs:body["chat_template_kwargs"] = map[string]any{"enable_thinking": enabled}- case catalog.ThinkingFormatOpenRouter:+ case api.ThinkingFormatOpenRouter:if enabled {reasoning := map[string]any{}if effort != "" {diff --git a/internal/models/api/openaiembeddings/client.go b/internal/models/api/openaiembeddings/client.goindex 94de9b606..49233359a 100644--- a/internal/models/api/openaiembeddings/client.go+++ b/internal/models/api/openaiembeddings/client.go@@ -3,7 +3,7 @@// answering {data: [{embedding, index}]}.//// The vendors that speak it disagree about everything optional, so nothing-// optional is sent unless catalog.EmbeddingsSettings says the vendor+// optional is sent unless api.EmbeddingsSettings says the vendor// documents it://// - `dimensions` does not exist on NVIDIA NIM or Volcengine's text endpoint;@@ -21,13 +21,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.EmbeddingsSettings+ Settings api.EmbeddingsSettings// Dimensions is the width the row asked for; it is sent only when the// vendor names a field for it.Dimensions intdiff --git a/internal/models/api/openaiembeddings/golden_test.go b/internal/models/api/openaiembeddings/golden_test.goindex 723984271..57a1e0e22 100644--- a/internal/models/api/openaiembeddings/golden_test.go+++ b/internal/models/api/openaiembeddings/golden_test.go@@ -8,7 +8,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -41,7 +40,7 @@ const nimResponse = `{"usage": {"prompt_tokens": 4, "total_tokens": 4}}`-func newClient(url string, settings catalog.EmbeddingsSettings, dims int) *Client {+func newClient(url string, settings api.EmbeddingsSettings, dims int) *Client {return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: "m", Auth: api.BearerAuth("k")},Settings: settings,@@ -66,7 +65,7 @@ func serve(t *testing.T, payload string) (*httptest.Server, *string, *map[string// The baseline sends model and input and nothing else: those are the only two// fields every vendor in the catalog documents.func TestBaselineSendsOnlyModelAndInput(t *testing.T) {- c := newClient("https://example.invalid/v1", catalog.EmbeddingsSettings{}, 1024)+ c := newClient("https://example.invalid/v1", api.EmbeddingsSettings{}, 1024)body := c.BuildRequestBody([]string{"a"}, api.EmbedDocument)assert.Equal(t, map[string]any{"model": "m", "input": []string{"a"}}, body,"a width the row asked for must not be sent to a vendor that names no field for it")@@ -75,7 +74,7 @@ func TestBaselineSendsOnlyModelAndInput(t *testing.T) {// NIM documents no `dimensions`, requires `input_type` and defaults// `truncate` to NONE, which fails a request on over-long input.func TestNIMRequestMatchesItsReference(t *testing.T) {- c := newClient("https://integrate.api.nvidia.com/v1", catalog.EmbeddingsSettings{+ c := newClient("https://integrate.api.nvidia.com/v1", api.EmbeddingsSettings{SendEncodingFormat: true,InputTypeField: "input_type",InputTypeValues: map[string]string{"document": "passage", "query": "query"},@@ -94,7 +93,7 @@ func TestNIMRequestMatchesItsReference(t *testing.T) {// Jina spells the same idea `task`, and its truncate is a boolean.func TestJinaRequestMatchesItsReference(t *testing.T) {- c := newClient("https://api.jina.ai/v1", catalog.EmbeddingsSettings{+ c := newClient("https://api.jina.ai/v1", api.EmbeddingsSettings{DimensionsField: "dimensions",InputTypeField: "task",InputTypeValues: map[string]string{"document": "retrieval.passage", "query": "retrieval.query"},@@ -112,12 +111,12 @@ func TestJinaRequestMatchesItsReference(t *testing.T) {// truncate_prompt_tokens is a vLLM extension. It appears in no managed// vendor's schema and used to be sent to every one of them, hardcoded to 511.func TestTruncatePromptTokensReachesOnlyVLLMClassRuntimes(t *testing.T) {- managed := newClient("https://api.openai.com/v1", catalog.EmbeddingsSettings{+ managed := newClient("https://api.openai.com/v1", api.EmbeddingsSettings{TruncatePromptTokens: 511,}, 0)assert.NotContains(t, managed.BuildRequestBody([]string{"a"}, api.EmbedDocument), "truncate_prompt_tokens")- vllm := newClient("http://vllm.internal/v1", catalog.EmbeddingsSettings{+ vllm := newClient("http://vllm.internal/v1", api.EmbeddingsSettings{AcceptsTruncatePromptTokens: true, TruncatePromptTokens: 512,}, 0)assert.Equal(t, 512, vllm.BuildRequestBody([]string{"a"}, api.EmbedDocument)["truncate_prompt_tokens"])@@ -127,7 +126,7 @@ func TestDecodesArkTextResponse(t *testing.T) {server, path, body := serve(t, arkTextResponse)defer server.Close()- c := newClient(server.URL+"/api/v3", catalog.EmbeddingsSettings{SendEncodingFormat: true}, 0)+ c := newClient(server.URL+"/api/v3", api.EmbeddingsSettings{SendEncodingFormat: true}, 0)got, err := c.Embed(context.Background(), []string{"天很蓝", "海很深"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, [][]float32{{0.11, 0.12}, {0.21, 0.22}}, got)@@ -139,7 +138,7 @@ func TestDecodesNIMResponse(t *testing.T) {server, _, _ := serve(t, nimResponse)defer server.Close()- c := newClient(server.URL+"/v1", catalog.EmbeddingsSettings{}, 0)+ c := newClient(server.URL+"/v1", api.EmbeddingsSettings{}, 0)got, err := c.Embed(context.Background(), []string{"a"}, api.EmbedQuery)require.NoError(t, err)assert.Equal(t, [][]float32{{0.5, 0.6}}, got)@@ -153,7 +152,7 @@ func TestOutOfOrderIndicesArePlacedByIndex(t *testing.T) {]}`)defer server.Close()- got, err := newClient(server.URL, catalog.EmbeddingsSettings{}, 0).+ got, err := newClient(server.URL, api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, [][]float32{{1}, {2}}, got)@@ -165,7 +164,7 @@ func TestReplyWithoutIndicesIsReadInOrder(t *testing.T) {server, _, _ := serve(t, `{"data":[{"embedding":[1]},{"embedding":[2]},{"embedding":[3]}]}`)defer server.Close()- got, err := newClient(server.URL, catalog.EmbeddingsSettings{}, 0).+ got, err := newClient(server.URL, api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a", "b", "c"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, [][]float32{{1}, {2}, {3}}, got)@@ -177,7 +176,7 @@ func TestRepeatedIndexIsStillAnError(t *testing.T) {server, _, _ := serve(t, `{"data":[{"embedding":[1],"index":0},{"embedding":[2],"index":0}]}`)defer server.Close()- _, err := newClient(server.URL, catalog.EmbeddingsSettings{}, 0).+ _, err := newClient(server.URL, api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)assert.Error(t, err)}@@ -187,7 +186,7 @@ func TestShortReplyIsAnError(t *testing.T) {server, _, _ := serve(t, `{"data":[{"embedding":[1],"index":0}]}`)defer server.Close()- _, err := newClient(server.URL, catalog.EmbeddingsSettings{}, 0).+ _, err := newClient(server.URL, api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a", "b"}, api.EmbedDocument)require.Error(t, err)assert.Contains(t, err.Error(), "no embedding returned for input 1")@@ -197,7 +196,7 @@ func TestDoesNotDoubleTheEmbeddingsPath(t *testing.T) {server, path, _ := serve(t, `{"data":[{"embedding":[1],"index":0}]}`)defer server.Close()- _, err := newClient(server.URL+"/openai/v1/embeddings", catalog.EmbeddingsSettings{}, 0).+ _, err := newClient(server.URL+"/openai/v1/embeddings", api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a"}, api.EmbedDocument)require.NoError(t, err)assert.Equal(t, "/openai/v1/embeddings", *path)@@ -211,7 +210,7 @@ func TestSurfacesTheVendorErrorBody(t *testing.T) {}))defer server.Close()- _, err := newClient(server.URL, catalog.EmbeddingsSettings{}, 0).+ _, err := newClient(server.URL, api.EmbeddingsSettings{}, 0).Embed(context.Background(), []string{"a"}, api.EmbedDocument)require.Error(t, err)assert.Contains(t, err.Error(), "input exceeds 4096 characters")diff --git a/internal/models/api/openairesponses/openairesponses_test.go b/internal/models/api/openairesponses/openairesponses_test.goindex 97908f553..1a3b8fd61 100644--- a/internal/models/api/openairesponses/openairesponses_test.go+++ b/internal/models/api/openairesponses/openairesponses_test.go@@ -11,7 +11,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")@@ -30,7 +29,7 @@ func newTestClient(t *testing.T, server *httptest.Server, reasoning bool) *Clien}return New(Config{Endpoint: ep,- Settings: catalog.DefaultOpenAIResponses(),+ Settings: api.DefaultOpenAIResponses(),Reasoning: reasoning,SessionID: "session-fallback",})diff --git a/internal/models/api/openairesponses/request.go b/internal/models/api/openairesponses/request.goindex aaf8cd802..b5e82de11 100644--- a/internal/models/api/openairesponses/request.go+++ b/internal/models/api/openairesponses/request.go@@ -1,6 +1,6 @@// Package openairesponses implements the OpenAI Responses wire protocol// (POST /responses). Every vendor-specific deviation is driven by-// catalog.OpenAIResponsesSettings; this package contains no vendor names.+// api.OpenAIResponsesSettings; this package contains no vendor names.package openairesponsesimport (@@ -9,13 +9,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.OpenAIResponsesSettings+ Settings api.OpenAIResponsesSettings// ThinkingLevels maps neutral levels to the vendor vocabulary.ThinkingLevels api.ThinkingLevelMap// Reasoning marks a reasoning model: sampling parameters are dropped anddiff --git a/internal/models/api/openaitranscriptions/client.go b/internal/models/api/openaitranscriptions/client.goindex b09762cac..fcecc5688 100644--- a/internal/models/api/openaitranscriptions/client.go+++ b/internal/models/api/openaitranscriptions/client.go@@ -7,7 +7,7 @@// model: gpt-4o-transcribe and gpt-4o-mini-transcribe accept only json,// whisper-1 also serves verbose_json, SiliconFlow documents no such field at// all. json is the default everywhere it is documented, so nothing is sent-// unless catalog.TranscriptionsSettings names a format.+// unless api.TranscriptionsSettings names a format.//// https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/createpackage openaitranscriptions@@ -18,13 +18,12 @@ import ("strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog")-// Config is everything the client needs, already resolved by the catalog.+// Config is everything the client needs, already resolved by the api.type Config struct {Endpoint api.Endpoint- Settings catalog.TranscriptionsSettings+ Settings api.TranscriptionsSettingsRetry api.RetryPolicy}@@ -54,7 +53,7 @@ func (c *Client) FormFields(language string) []api.FormField {if format := c.cfg.Settings.ResponseFormat; format != "" {fields = append(fields, api.FormField{Name: "response_format", Value: format})}- if language != "" && c.cfg.Settings.LanguageParam == catalog.LanguageForm {+ if language != "" && c.cfg.Settings.LanguageParam == api.LanguageForm {fields = append(fields, api.FormField{Name: "language", Value: language})}return fields@@ -94,7 +93,7 @@ func (c *Client) Transcribe(ctx context.Context, req api.TranscriptionRequest) (return nil, err}endpoint := c.cfg.Endpoint- if req.Language != "" && c.cfg.Settings.LanguageParam == catalog.LanguageHeader {+ if req.Language != "" && c.cfg.Settings.LanguageParam == api.LanguageHeader {headers := make(map[string]string, len(endpoint.Headers)+1)for k, v := range endpoint.Headers {headers[k] = vdiff --git a/internal/models/api/openaitranscriptions/golden_test.go b/internal/models/api/openaitranscriptions/golden_test.goindex 2e2252b77..6c8f42a2b 100644--- a/internal/models/api/openaitranscriptions/golden_test.go+++ b/internal/models/api/openaitranscriptions/golden_test.go@@ -10,7 +10,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -93,9 +92,9 @@ func serve(t *testing.T, status int, reply string) (*httptest.Server, *captured)return server, got}-func newClient(url, model string, settings catalog.TranscriptionsSettings) *Client {+func newClient(url, model string, settings api.TranscriptionsSettings) *Client {if settings.Path == "" {- settings.Path = catalog.DefaultTranscriptions().Path+ settings.Path = api.DefaultTranscriptions().Path}return New(Config{Endpoint: api.Endpoint{BaseURL: url, Model: model, Auth: api.BearerAuth("k")},@@ -107,7 +106,7 @@ func newClient(url, model string, settings catalog.TranscriptionsSettings) *Clie// which is the default, so no response_format is sent.func TestBaselineFormIsFileAndModel(t *testing.T) {server, got := serve(t, http.StatusOK, jsonResponse)- out, err := newClient(server.URL+"/v1", "gpt-4o-transcribe", catalog.TranscriptionsSettings{}).+ out, err := newClient(server.URL+"/v1", "gpt-4o-transcribe", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("RIFF"), FileName: "meeting.wav"})require.NoError(t, err)@@ -129,12 +128,12 @@ func TestLanguageGoesWhereTheVendorDeclares(t *testing.T) {wantHeader string}{{param: "", wantField: "", wantHeader: ""},- {param: catalog.LanguageForm, wantField: "zh", wantHeader: ""},- {param: catalog.LanguageHeader, wantField: "", wantHeader: "zh"},+ {param: api.LanguageForm, wantField: "zh", wantHeader: ""},+ {param: api.LanguageHeader, wantField: "", wantHeader: "zh"},} {t.Run("param="+tc.param, func(t *testing.T) {server, got := serve(t, http.StatusOK, jsonResponse)- _, err := newClient(server.URL, "m", catalog.TranscriptionsSettings{LanguageParam: tc.param}).+ _, err := newClient(server.URL, "m", api.TranscriptionsSettings{LanguageParam: tc.param}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav", Language: "zh",})@@ -157,7 +156,7 @@ func TestDurationIsReadFromTheReply(t *testing.T) {} {t.Run(name, func(t *testing.T) {server, _ := serve(t, http.StatusOK, reply)- out, err := newClient(server.URL, "m", catalog.TranscriptionsSettings{}).+ out, err := newClient(server.URL, "m", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav"})require.NoError(t, err)assert.NotZero(t, out.Duration)@@ -167,7 +166,7 @@ func TestDurationIsReadFromTheReply(t *testing.T) {func TestVerboseJSONCarriesSegments(t *testing.T) {server, got := serve(t, http.StatusOK, verboseResponse)- settings := catalog.TranscriptionsSettings{ResponseFormat: "verbose_json"}+ settings := api.TranscriptionsSettings{ResponseFormat: "verbose_json"}out, err := newClient(server.URL+"/v1", "whisper-1", settings).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("ID3"), FileName: "a.mp3"})require.NoError(t, err)@@ -182,7 +181,7 @@ func TestVerboseJSONCarriesSegments(t *testing.T) {// Silence is an empty transcript, and that is a valid answer.func TestEmptyTextIsSilence(t *testing.T) {server, _ := serve(t, http.StatusOK, `{"text": ""}`)- out, err := newClient(server.URL, "m", catalog.TranscriptionsSettings{}).+ out, err := newClient(server.URL, "m", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav"})require.NoError(t, err)assert.Equal(t, "", out.Text)@@ -195,7 +194,7 @@ func TestEmptyTextIsSilence(t *testing.T) {func TestReplyWithoutTextIsAnError(t *testing.T) {server, _ := serve(t, http.StatusOK,`{"status_code": 500, "detail": "Failed to transcribe audio, boom", "headers": null}`)- _, err := newClient(server.URL, "m", catalog.TranscriptionsSettings{}).+ _, err := newClient(server.URL, "m", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav"})require.Error(t, err)assert.Contains(t, err.Error(), "Failed to transcribe audio")@@ -204,7 +203,7 @@ func TestReplyWithoutTextIsAnError(t *testing.T) {func TestSurfacesTheVendorErrorBody(t *testing.T) {// A stand-in rejection in OpenAI's error envelope.server, _ := serve(t, http.StatusBadRequest, `{"error":{"message":"stand-in rejection"}}`)- _, err := newClient(server.URL, "gpt-4o-transcribe", catalog.TranscriptionsSettings{}).+ _, err := newClient(server.URL, "gpt-4o-transcribe", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav"})require.Error(t, err)assert.Contains(t, err.Error(), "stand-in rejection")@@ -212,7 +211,7 @@ func TestSurfacesTheVendorErrorBody(t *testing.T) {func TestDoesNotDoubleThePath(t *testing.T) {server, got := serve(t, http.StatusOK, jsonResponse)- _, err := newClient(server.URL+"/v1/audio/transcriptions", "m", catalog.TranscriptionsSettings{}).+ _, err := newClient(server.URL+"/v1/audio/transcriptions", "m", api.TranscriptionsSettings{}).Transcribe(context.Background(), api.TranscriptionRequest{Audio: []byte("x"), FileName: "a.wav"})require.NoError(t, err)assert.Equal(t, "/v1/audio/transcriptions", got.path)diff --git a/internal/models/catalog/rerank.go b/internal/models/api/rerank_settings.gosimilarity index 75%rename from internal/models/catalog/rerank.gorename to internal/models/api/rerank_settings.goindex dec19f6d4..48bf64c78 100644--- a/internal/models/catalog/rerank.go+++ b/internal/models/api/rerank_settings.go@@ -1,22 +1,20 @@-package catalog--import "github.com/Tencent/WeKnora/internal/models/api"+package api// RerankCompat is the overlay form (every field optional) of the rerank// settings. JSON keys are the documented names used in models.json and// config/models.json.type RerankCompat struct {- Path *string `json:"path,omitempty"`- SendTopN *bool `json:"send_top_n,omitempty"`- SendReturnDocs *bool `json:"send_return_documents,omitempty"`- ScoreScale *api.ScoreScale `json:"score_scale,omitempty"`- Truncate *string `json:"truncate,omitempty"`- MaxDocuments *int `json:"max_documents,omitempty"`- MaxQueryChars *int `json:"max_query_chars,omitempty"`- MaxDocumentChars *int `json:"max_document_chars,omitempty"`- MaxRequestChars *int `json:"max_request_chars,omitempty"`- MaxConcurrency *int `json:"max_concurrency,omitempty"`- RequestTimeout *int `json:"request_timeout_seconds,omitempty"`+ Path *string `json:"path,omitempty"`+ SendTopN *bool `json:"send_top_n,omitempty"`+ SendReturnDocs *bool `json:"send_return_documents,omitempty"`+ ScoreScale *ScoreScale `json:"score_scale,omitempty"`+ Truncate *string `json:"truncate,omitempty"`+ MaxDocuments *int `json:"max_documents,omitempty"`+ MaxQueryChars *int `json:"max_query_chars,omitempty"`+ MaxDocumentChars *int `json:"max_document_chars,omitempty"`+ MaxRequestChars *int `json:"max_request_chars,omitempty"`+ MaxConcurrency *int `json:"max_concurrency,omitempty"`+ RequestTimeout *int `json:"request_timeout_seconds,omitempty"`// AcceptsTruncatePromptTokens marks a vLLM-class runtime.AcceptsTruncatePromptTokens *bool `json:"accepts_truncate_prompt_tokens,omitempty"`// UnsupportedReason marks a model this build cannot call.@@ -35,9 +33,9 @@ type RerankSettings struct {// SendReturnDocs asks the vendor to echo the document text. Callers index// into their own slice, so this is off unless a vendor needs it.SendReturnDocs bool- // ScoreScale says what the returned numbers mean. See api.ScoreScale:+ // ScoreScale says what the returned numbers mean. See ScoreScale:// getting this wrong makes a relevance threshold meaningless.- ScoreScale api.ScoreScale+ ScoreScale ScoreScale// Truncate is the vendor's server-side truncation setting for// over-long input ("END" on NIM). Empty sends nothing.Truncate string@@ -74,9 +72,9 @@ type RerankSettings struct {ExtraBody map[string]any}-// BatchLimits renders the documented ceilings for api.SplitBatches.-func (s RerankSettings) BatchLimits() api.BatchLimits {- return api.BatchLimits{+// BatchLimits renders the documented ceilings for SplitBatches.+func (s RerankSettings) BatchLimits() BatchLimits {+ return BatchLimits{MaxItems: s.MaxDocuments,MaxItemRunes: s.MaxDocumentChars,MaxTotalRunes: s.MaxRequestChars,@@ -87,6 +85,6 @@ func (s RerankSettings) BatchLimits() api.BatchLimits {// 0..1 relevance score, enforce no ceiling the vendor did not state.func DefaultRerank() RerankSettings {return RerankSettings{- ScoreScale: api.ScoreProbability,+ ScoreScale: ScoreProbability,}}diff --git a/internal/models/api/tencentlkeap/client.go b/internal/models/api/tencentlkeap/client.gonew file mode 100644index 000000000..373586dc2--- /dev/null+++ b/internal/models/api/tencentlkeap/client.go@@ -0,0 +1,103 @@+// Package tencentlkeap implements Tencent RunRerank through its official SDK.+package tencentlkeap++import (+ "context"+ "fmt"+ "strings"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"+ "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"+ lkeap "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lkeap/v20240522"+)++// SDK defaults follow the managed rerank service.+const (+ // LKEAPRerankEndpoint 腾讯云知识引擎原子能力 Rerank API 域名+ LKEAPRerankEndpoint = "lkeap.tencentcloudapi.com"+ // LKEAPDefaultRegion RunRerank 支持的地域,默认广州+ LKEAPDefaultRegion = "ap-guangzhou"+ // LKEAPDefaultRerankModel 默认 rerank 模型名+ LKEAPDefaultRerankModel = "lke-reranker-base"+)++// Config contains resolved connection parameters for the SDK client.+type Config struct{ SecretID, SecretKey, Region, Model, Endpoint, Scheme string }++// lkeapClient calls Tencent Cloud's RunRerank action through the official+// SDK, which owns the TC3 signing this API requires. It implements+// api.Reranker and nothing else: the per-request ceilings (60 documents,+// 2000 characters for Query plus Docs together) are declared on the vendor+// and enforced by protocolReranker, like every other vendor's.+type lkeapClient struct {+ modelName string+ client *lkeap.Client+}++// New creates an authenticated rerank protocol client.+func New(config Config) (api.Reranker, error) {+ secretID, secretKey := strings.TrimSpace(config.SecretID), strings.TrimSpace(config.SecretKey)+ if secretID == "" || secretKey == "" {+ return nil, fmt.Errorf("secret_id and secret_key are required for LKEAP rerank (set API Key and Secret Key)")+ }+ region := strings.TrimSpace(config.Region)+ if region == "" {+ region = LKEAPDefaultRegion+ }+ if config.Endpoint == "" {+ config.Endpoint = LKEAPRerankEndpoint+ }+ if config.Scheme == "" {+ config.Scheme = "HTTPS"+ }++ credential := common.NewCredential(secretID, secretKey)+ cpf := profile.NewClientProfile()+ cpf.HttpProfile.Endpoint = config.Endpoint+ cpf.HttpProfile.Scheme = config.Scheme++ client, err := lkeap.NewClient(credential, region, cpf)+ if err != nil {+ return nil, fmt.Errorf("create LKEAP client: %w", err)+ }++ modelName := strings.TrimSpace(config.Model)+ if modelName == "" {+ modelName = LKEAPDefaultRerankModel+ }+ return &lkeapClient{modelName: modelName, client: client}, nil+}++// Rerank scores one batch. RunRerank answers a bare score list in input+// order rather than an indexed, sorted result set.+func (r *lkeapClient) Rerank(+ ctx context.Context, query string, documents []string,+) ([]api.RerankResult, error) {+ req := lkeap.NewRunRerankRequest()+ req.Query = common.StringPtr(query)+ req.Docs = common.StringPtrs(documents)+ req.Model = common.StringPtr(r.modelName)++ resp, err := r.client.RunRerankWithContext(ctx, req)+ if err != nil {+ return nil, fmt.Errorf("LKEAP RunRerank: %w", err)+ }+ if resp == nil || resp.Response == nil || len(resp.Response.ScoreList) == 0 {+ return nil, fmt.Errorf("LKEAP rerank API returned empty score list")+ }+ scores := resp.Response.ScoreList+ if len(scores) != len(documents) {+ return nil, fmt.Errorf("LKEAP rerank score count mismatch: got %d scores for %d documents",+ len(scores), len(documents))+ }++ results := make([]api.RerankResult, len(documents))+ for i, score := range scores {+ results[i] = api.RerankResult{Index: i, Text: documents[i]}+ if score != nil {+ results[i].Score = *score+ }+ }+ return results, nil+}diff --git a/internal/models/catalog/transcriptions.go b/internal/models/api/transcriptions_settings.gosimilarity index 93%rename from internal/models/catalog/transcriptions.gorename to internal/models/api/transcriptions_settings.goindex 0a7b74ce6..2ce538f29 100644--- a/internal/models/catalog/transcriptions.go+++ b/internal/models/api/transcriptions_settings.go@@ -1,6 +1,4 @@-package catalog--import "github.com/Tencent/WeKnora/internal/models/api"+package api// Where a transcription protocol puts the operator's language hint. Each// vendor documents one place, or none.@@ -19,8 +17,8 @@ const (// TranscriptionsCompat is the overlay form (every field optional) of the// speech-to-text settings. JSON keys are the names used in models.json.type TranscriptionsCompat struct {- API *api.TranscriptionAPI `json:"api,omitempty"`- Path *string `json:"path,omitempty"`+ API *TranscriptionAPI `json:"api,omitempty"`+ Path *string `json:"path,omitempty"`// ResponseFormat is sent as response_format when non-empty. OpenAI's// gpt-4o-transcribe and gpt-4o-mini-transcribe accept only json, which is// also the default, so most models leave it unset.@@ -43,7 +41,7 @@ type TranscriptionsCompat struct {// TranscriptionsSettings is the resolved (fully defaulted) form.type TranscriptionsSettings struct {- API api.TranscriptionAPI+ API TranscriptionAPIPath stringResponseFormat stringLanguageParam stringdiff --git a/internal/models/api/types.go b/internal/models/api/types.goindex ae37d9ec9..7050e422b 100644--- a/internal/models/api/types.go+++ b/internal/models/api/types.go@@ -5,7 +5,7 @@// tool-call assembly, prompt-cache bookkeeping and usage logging.//// Protocol packages live under api/<protocol>; vendor facts live in-// internal/models/catalog and internal/models/vendors. This package must not+// internal/models/catalog and internal/models/providers. This package must not// import either of them.package apidiff --git a/internal/models/api/volcengineknowledge/client.go b/internal/models/api/volcengineknowledge/client.gonew file mode 100644index 000000000..7f6d48171--- /dev/null+++ b/internal/models/api/volcengineknowledge/client.go@@ -0,0 +1,116 @@+// Package volcengineknowledge implements Volcengine Knowledge Service rerank through its official SDK.+package volcengineknowledge++import (+ "context"+ "fmt"+ "net/http"+ "strings"+ "time"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/volcengine/vikingdb-go-sdk/knowledge"+ knowledgemodel "github.com/volcengine/vikingdb-go-sdk/knowledge/model"+)++// SDK defaults follow the managed rerank service.+const (+ DefaultModel = "doubao-seed-rerank"+ DefaultRegion = "cn-beijing"+ // DefaultInstruction is the console's default instruction, verbatim: "如需对齐控制台效果,请使用+ // 相同指令" (https://docs.volcengine.com/docs/vector_database_vikingdb/Rerank).+ DefaultInstruction = "Whether the document answers the query " ++ "or matches the content retrieval intent"+)++// volcengineClient calls the managed Knowledge Service rerank through the+// vikingdb SDK, which owns the AK/SK signing. It implements api.Reranker and+// nothing else: the 200-document ceiling and the batch concurrency are+// declared on the vendor and enforced by protocolReranker.+type volcengineClient struct {+ modelName string+ instruction string+ client *knowledge.Client+}++// Config contains resolved connection parameters for the SDK client.+type Config struct {+ AccessKey, SecretKey, BaseURL, Model, Region, Instruction string+ Client *http.Client+}++// New creates an authenticated rerank protocol client.+func New(config Config) (api.Reranker, error) {+ accessKey, secretKey := strings.TrimSpace(config.AccessKey), strings.TrimSpace(config.SecretKey)+ if accessKey == "" || secretKey == "" {+ return nil, fmt.Errorf("access key and secret key are required for Volcengine rerank")+ }+ baseURL := config.BaseURL+ modelName := strings.TrimSpace(config.Model)+ if modelName == "" {+ modelName = DefaultModel+ }+ region := strings.TrimSpace(config.Region)+ if region == "" {+ region = DefaultRegion+ }+ instruction := strings.TrimSpace(config.Instruction)+ if instruction == "" {+ instruction = DefaultInstruction+ }+ if config.Client == nil {+ config.Client = api.HTTPClient+ }++ client, err := knowledge.New(+ knowledge.AuthIAM(accessKey, secretKey),+ knowledge.WithEndpoint(baseURL),+ knowledge.WithRegion(region),+ knowledge.WithTimeout(30*time.Second),+ knowledge.WithHTTPClient(config.Client),+ knowledge.WithMaxRetries(1),+ )+ if err != nil {+ return nil, fmt.Errorf("create Volcengine rerank client: %w", err)+ }+ return &volcengineClient{modelName: modelName, instruction: instruction, client: client}, nil+}++// Rerank scores one batch. Every document is paired with the same query and+// instruction, and the reply is a score list in input order.+func (r *volcengineClient) Rerank(+ ctx context.Context, query string, documents []string,+) ([]api.RerankResult, error) {+ data := make([]knowledgemodel.RerankDataItem, len(documents))+ for i := range documents {+ data[i] = knowledgemodel.RerankDataItem{Query: query, Content: &documents[i]}+ }+ request := knowledgemodel.RerankRequest{+ Datas: data,+ RerankModel: &r.modelName,+ RerankInstruction: &r.instruction,+ }++ response, err := r.client.Rerank(ctx, request)+ if err != nil {+ return nil, fmt.Errorf("call Volcengine rerank: %w", err)+ }+ if response == nil || response.Data == nil {+ return nil, fmt.Errorf("volcengine rerank returned an empty response")+ }+ if response.Code != 0 {+ return nil, fmt.Errorf("volcengine rerank API error %d: %s", response.Code, response.Message)+ }+ if len(response.Data.Scores) != len(documents) {+ return nil, fmt.Errorf(+ "volcengine rerank score count mismatch: got %d scores for %d documents",+ len(response.Data.Scores), len(documents),+ )+ }++ results := make([]api.RerankResult, len(documents))+ for i, score := range response.Data.Scores {+ results[i] = api.RerankResult{Index: i, Score: score, Text: documents[i]}+ }+ return results, nil+}diff --git a/internal/models/asr/asr.go b/internal/models/asr/asr.goindex 913e5e22a..ead7efb94 100644--- a/internal/models/asr/asr.go+++ b/internal/models/asr/asr.go@@ -60,6 +60,7 @@ type Config struct {// Provider is the vendor id stored on the row; empty detects it from// BaseURL.Provider string+ Spec *types.ModelSpecOverride `json:"spec,omitempty"`ExtraConfig map[string]string// CustomHeaders 允许在调用远程 API 时附加自定义 HTTP 请求头(类似 OpenAI Python SDK 的 extra_headers)。CustomHeaders map[string]string@@ -79,6 +80,7 @@ func ConfigFromModel(m *types.Model) *Config {ModelName: m.Name,Source: m.Source,Provider: m.Parameters.Provider,+ Spec: m.Parameters.Spec,ExtraConfig: m.Parameters.ExtraConfig,CustomHeaders: m.Parameters.CustomHeaders,}diff --git a/internal/models/asr/catalog_matrix_test.go b/internal/models/asr/catalog_matrix_test.gonew file mode 100644index 000000000..36daa0992--- /dev/null+++ b/internal/models/asr/catalog_matrix_test.go@@ -0,0 +1,95 @@+package asr++import (+ "context"+ "net/url"+ "strings"+ "testing"++ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++func TestEveryCatalogASRTransport(t *testing.T) {+ for _, v := range modelruntime.List() {+ for _, m := range v.Models() {+ if m.Type != types.ModelTypeASR {+ continue+ }+ names := append([]string{m.ID}, m.Aliases...)+ if m.ID == "" {+ names[0] = strings.ReplaceAll(m.Match, "*", "snapshot")+ }+ for _, name := range names {+ t.Run(v.ID+"/"+name, func(t *testing.T) {+ address, _, calls := upstream(t)+ base, err := url.Parse(v.GetDefaultURL(types.ModelTypeASR))+ require.NoError(t, err)+ client, err := newASR(+ &Config{+ Source: types.ModelSourceRemote,+ Provider: v.ID,+ ModelName: name,+ ModelID: "row-id",+ BaseURL: address + base.Path,+ APIKey: "row-key",+ },+ )+ if strings.Contains(string(m.Compat), "unsupported_reason") {+ require.Error(t, err)+ require.Zero(t, calls.Load())+ return+ }+ require.NoError(t, err)+ result, err := client.Transcribe(+ WithLanguage(+ context.Background(),+ "zh",+ ),+ []byte(+ "RIFF",+ ),+ "sample.wav",+ )+ require.NoError(t, err)+ require.Equal(t, "hello", strings.TrimSpace(result.Text))+ require.EqualValues(t, 1, calls.Load())+ require.Equal(t, "row-id", client.GetModelID())+ })+ }+ }+ }+}++func TestStoredASRSpecReachesWire(t *testing.T) {+ address, got, _ := upstream(t)+ row := &types.Model{+ ID: "stable-id",+ Name: "custom",+ Source: types.ModelSourceRemote,+ Parameters: types.ModelParameters{+ Provider: "generic",+ BaseURL: address,+ APIKey: "model-key",+ Spec: &types.ModelSpecOverride{+ Compat: map[string]any{+ "path": "/custom-transcriptions",+ "response_format": "verbose_json",+ "language_param": "header",+ },+ },+ },+ }+ client, err := newASR(ConfigFromModel(row))+ require.NoError(t, err)+ result, err := client.Transcribe(WithLanguage(context.Background(), "zh"), []byte("RIFF"), "sample.wav")+ require.NoError(t, err)+ require.Equal(t, "/custom-transcriptions", got.path)+ require.Equal(t, "verbose_json", got.fields["response_format"])+ require.Equal(t, "zh", got.language)+ require.Len(t, result.Segments, 1)+ row.Parameters.Spec.Compat = map[string]any{"misspelled_option": true}+ _, err = newASR(ConfigFromModel(row))+ require.ErrorContains(t, err, "unknown field")+}diff --git a/internal/models/asr/protocol.go b/internal/models/asr/protocol.goindex b16b56ae3..d78b62bfa 100644--- a/internal/models/asr/protocol.go+++ b/internal/models/asr/protocol.go@@ -12,10 +12,8 @@ import ("github.com/Tencent/WeKnora/internal/models/api""github.com/Tencent/WeKnora/internal/models/api/openaichataudio""github.com/Tencent/WeKnora/internal/models/api/openaitranscriptions"- "github.com/Tencent/WeKnora/internal/models/catalog"- // catalog.Resolve answers from the vendor catalog, which is empty until- // the vendor packages have run their init.- _ "github.com/Tencent/WeKnora/internal/models/vendors"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -36,12 +34,13 @@ func newASR(config *Config) (ASR, error) {if strings.TrimSpace(config.ModelName) == "" {return nil, fmt.Errorf("model name is required")}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: config.Provider,Model: config.ModelName,BaseURL: config.BaseURL,ModelType: types.ModelTypeASR,Extra: config.ExtraConfig,+ Override: config.Spec,})if err != nil {return nil, err@@ -55,12 +54,13 @@ func newASR(config *Config) (ASR, error) {if strings.TrimSpace(config.Provider) != "" {return nil, fmt.Errorf("%s does not offer speech recognition in this build", resolved.Vendor.Name)}- resolved, err = catalog.Resolve(catalog.Ref{- Provider: catalog.GenericID,+ resolved, err = modelruntime.Resolve(modelruntime.Ref{+ Provider: providers.GenericID,Model: config.ModelName,BaseURL: config.BaseURL,ModelType: types.ModelTypeASR,Extra: config.ExtraConfig,+ Override: config.Spec,})if err != nil {return nil, err@@ -71,42 +71,22 @@ func newASR(config *Config) (ASR, error) {}vendor := resolved.Vendor- creds := catalog.Credentials{APIKey: config.APIKey}- if creds.APIKey == "" {- creds.APIKey = vendor.DefaultAPIKey- }- // Vendor headers first so a user header cannot silently replace a vendor- // beta flag, matching chat.NewRemoteChat.- headers := make(map[string]string, len(vendor.Headers)+len(config.CustomHeaders))- for k, v := range vendor.Headers {- headers[k] = v- }- for k, v := range config.CustomHeaders {- headers[k] = v- }- settings := resolved.Transcriptions- endpoint := api.Endpoint{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelID: config.ModelID,- Auth: vendor.AuthFunc(vendor.API, creds),- Headers: headers,- Client: newASRHTTPClient(time.Duration(settings.RequestTimeout) * time.Second),+ endpoint, err := resolved.Endpoint(types.ModelTypeASR, modelruntime.Connection{+ ModelID: config.ModelID,+ Credentials: api.Credentials{APIKey: config.APIKey},+ Headers: config.CustomHeaders,+ Extra: config.ExtraConfig,+ Client: newASRHTTPClient(time.Duration(resolved.Transcriptions.RequestTimeout) * time.Second),+ })+ if err != nil {+ return nil, err}- if vendor.Endpoint != nil {- if url, query := vendor.Endpoint(catalog.EndpointRequest{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelType: types.ModelTypeASR,- API: vendor.API,- Extra: config.ExtraConfig,- }); url != "" {- if err := validateASRBaseURL(url); err != nil {- return nil, err- }- endpoint.URL, endpoint.Query = url, query+ if endpoint.URL != "" {+ if err := validateASRBaseURL(endpoint.URL); err != nil {+ return nil, err}}+ settings := resolved.Transcriptionsvar client api.Transcriberswitch resolved.TranscriptionAPI {@@ -136,7 +116,7 @@ func newASR(config *Config) (ASR, error) {// upload the vendor has documented it will not take, before sending it.type protocolASR struct {inner api.Transcriber- settings catalog.TranscriptionsSettings+ settings api.TranscriptionsSettingsvendor stringendpoint stringmodelName stringdiff --git a/internal/models/asr/wire_test.go b/internal/models/asr/wire_test.goindex 503921fab..05e0c5dbe 100644--- a/internal/models/asr/wire_test.go+++ b/internal/models/asr/wire_test.go@@ -11,7 +11,7 @@ import ("sync/atomic""testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types"secutils "github.com/Tencent/WeKnora/internal/utils""github.com/stretchr/testify/assert"@@ -260,7 +260,7 @@ func TestVendorsWithoutASRAreNotRoutedThroughTheirHooks(t *testing.T) {// host detects as Azure while the request still reaches the test server.url, got, _ := upstream(t)base := url + "/openai.azure.com/v1"- require.Equal(t, "azure_openai", catalog.DetectByURL(base))+ require.Equal(t, "azure_openai", modelruntime.DetectByURL(base))a, err := NewASR(&Config{Source: types.ModelSourceRemote, BaseURL: base, ModelName: "whisper", APIKey: "k",})diff --git a/internal/models/capabilities.go b/internal/models/capabilities.gonew file mode 100644index 000000000..bdde0f4c3--- /dev/null+++ b/internal/models/capabilities.go@@ -0,0 +1,17 @@+package models++import "github.com/Tencent/WeKnora/internal/models/api"++// Capabilities is the UI-facing summary of a resolved model.+type Capabilities struct {+ Provider string `json:"provider"`+ API api.API `json:"api"`+ Cataloged bool `json:"cataloged"`+ Reasoning bool `json:"reasoning"`+ ThinkingLevels []api.ReasoningEffort `json:"thinking_levels"`+ ThinkingFormat string `json:"thinking_format"`+ Input []string `json:"input,omitempty"`+ ContextWindow int `json:"context_window,omitempty"`+ MaxOutputTokens int `json:"max_output_tokens,omitempty"`+ MaxTokensField string `json:"max_tokens_field,omitempty"`+}diff --git a/internal/models/catalog/catalog.go b/internal/models/catalog/catalog.gonew file mode 100644index 000000000..8ae280dfc--- /dev/null+++ b/internal/models/catalog/catalog.go@@ -0,0 +1,128 @@+// Package catalog loads and queries model metadata. It has no provider behavior or global registry.+package catalog++import (+ "strings"++ "github.com/Tencent/WeKnora/internal/models"+ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+ "github.com/Tencent/WeKnora/internal/types"+)++// Catalog is an immutable model index for one provider. Queries return owned copies.+type Catalog struct{ entries []models.ModelSpec }++// New builds an immutable index from an owned copy of the supplied entries.+func New(entries []models.ModelSpec) *Catalog { return &Catalog{entries: configcopy.Clone(entries)} }++// Models returns independent copies of all entries, including hidden rules.+func (c *Catalog) Models() []models.ModelSpec { return configcopy.Clone(c.entries) }++// ModelsByType returns the vendor's catalog entries for a model type,+// hiding deprecated and pattern-only entries.+func (c *Catalog) ModelsByType(modelType types.ModelType) []models.ModelSpec {+ out := make([]models.ModelSpec, 0)+ for _, m := range c.entries {+ if m.Deprecated || m.ID == "" {+ continue+ }+ mt := m.Type+ if mt == "" {+ mt = types.ModelTypeKnowledgeQA+ }+ switch modelType {+ case types.ModelTypeVLLM:+ // VLM pickers list chat models that accept images.+ if mt == types.ModelTypeKnowledgeQA && m.AcceptsImages() {+ out = append(out, configcopy.Clone(m))+ }+ default:+ if mt == modelType {+ out = append(out, configcopy.Clone(m))+ }+ }+ }+ return out+}++// FindModel looks a model name up among the vendor's entries of one model+// type: exact id, then aliases, then glob patterns (longest literal prefix+// wins). Matching is case-insensitive.+//+// The type is part of the key because families share prefixes across types.+// Aliyun's qwen3* chat glob also matches qwen3.8-text-embedding, and gpt-5*+// matches gpt-5-embed; an untyped lookup would hand an embedding row the chat+// family's compat, which the embedding overlay rejects, and the row could not+// be built at all. A VLM row is a chat model that accepts images, so it looks+// among the chat entries.+func (c *Catalog) FindModel(name string, modelType types.ModelType) (models.ModelSpec, bool) {+ needle := strings.ToLower(strings.TrimSpace(name))+ if needle == "" {+ return models.ModelSpec{}, false+ }+ want := EntryType(modelType)+ var candidates []models.ModelSpec+ for _, m := range c.entries {+ if EntryType(m.Type) == want {+ candidates = append(candidates, m)+ }+ }+ for _, m := range candidates {+ if strings.ToLower(m.ID) == needle {+ return configcopy.Clone(m), true+ }+ }+ for _, m := range candidates {+ for _, alias := range m.Aliases {+ if strings.ToLower(alias) == needle {+ return configcopy.Clone(m), true+ }+ }+ }+ var best models.ModelSpec+ bestScore := -1+ for _, m := range candidates {+ if m.Match == "" {+ continue+ }+ if globMatch(strings.ToLower(m.Match), needle) {+ score := len(strings.TrimRight(strings.SplitN(m.Match, "*", 2)[0], "*"))+ if score > bestScore {+ best, bestScore = m, score+ }+ }+ }+ if bestScore >= 0 {+ return configcopy.Clone(best), true+ }+ return models.ModelSpec{}, false+}++// EntryType folds a model type onto the catalog entries that describe it:+// chat entries leave Type empty, and VLM rows use them too.+func EntryType(t types.ModelType) types.ModelType {+ if t == "" || t == types.ModelTypeVLLM {+ return types.ModelTypeKnowledgeQA+ }+ return t+}++// globMatch supports '*' wildcards only.+func globMatch(pattern, s string) bool {+ parts := strings.Split(pattern, "*")+ if len(parts) == 1 {+ return pattern == s+ }+ if !strings.HasPrefix(s, parts[0]) {+ return false+ }+ s = s[len(parts[0]):]+ for i := 1; i < len(parts)-1; i++ {+ idx := strings.Index(s, parts[i])+ if idx < 0 {+ return false+ }+ s = s[idx+len(parts[i]):]+ }+ return strings.HasSuffix(s, parts[len(parts)-1])+}diff --git a/internal/models/catalog/data/models.generated.json b/internal/models/catalog/data/models.generated.jsonnew file mode 100644index 000000000..1b8959821--- /dev/null+++ b/internal/models/catalog/data/models.generated.json@@ -0,0 +1,5797 @@+{+ "version": 1,+ "providers": {+ "aliyun": [+ {+ "name": "Qwen3 family (hybrid thinking)",+ "match": "qwen3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "Qwen3.5 family (hybrid thinking)",+ "match": "qwen3.5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "Qwen3.6 family (hybrid thinking)",+ "match": "qwen3.6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "Qwen3.7 family (hybrid thinking)",+ "match": "qwen3.7*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "Qwen3.8 family (hybrid thinking)",+ "match": "qwen3.8*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "name": "qwen-plus family (hybrid thinking)",+ "match": "qwen-plus*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "qwen-max family (hybrid thinking)",+ "match": "qwen-max*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "qwen-turbo family (hybrid thinking)",+ "match": "qwen-turbo*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "qwen-flash family (hybrid thinking)",+ "match": "qwen-flash*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "DeepSeek V3 family on DashScope (hybrid thinking)",+ "match": "deepseek-v3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "DeepSeek V4 family on DashScope (hybrid thinking)",+ "match": "deepseek-v4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "Kimi K2 family on DashScope (hybrid thinking)",+ "match": "kimi-k2*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "name": "GLM-5 family on DashScope (hybrid thinking)",+ "match": "glm-5*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.8-max",+ "name": "Qwen3.8 Max",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.77744,+ "output": 5.33231,+ "cache_read": 0.22218,+ "cache_write": 2.22179+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "qwen3.8-flash",+ "name": "Qwen3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.11875,+ "output": 0.40073,+ "cache_read": 0.01187,+ "cache_write": 0.14844+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2.5,+ "output": 7.5,+ "cache_read": 0.5,+ "cache_write": 3.125+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.7-plus",+ "name": "Qwen3.7 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05,+ "cache_write": 0.625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.7-flash",+ "name": "Qwen3.7 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.02962,+ "output": 0.1185,+ "cache_read": 0.002962,+ "cache_write": 0.03703+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.6-plus",+ "name": "Qwen3.6 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05,+ "cache_write": 0.625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.6-flash",+ "name": "Qwen3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.1875,+ "output": 1.125,+ "cache_write": 0.234375+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.5-plus",+ "name": "Qwen3.5 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.287,+ "output": 1.722+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.5-flash",+ "name": "Qwen3.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.172,+ "output": 1.033+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3-max",+ "name": "Qwen3 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.291,+ "output": 7.749+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3-vl-plus",+ "name": "Qwen3 VL Plus",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.143353,+ "output": 1.433525+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-plus",+ "name": "Qwen Plus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.115,+ "output": 0.287,+ "cache_read": 0.012,+ "cache_write": 0.144+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-max",+ "name": "Qwen Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.345,+ "output": 1.377+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-turbo",+ "name": "Qwen Turbo",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.044,+ "output": 0.087+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-flash",+ "name": "Qwen Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.022,+ "output": 0.216+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-vl-max",+ "name": "Qwen VL Max",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.23,+ "output": 0.574+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-vl-plus",+ "name": "Qwen VL Plus",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.115,+ "output": 0.287+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwq-plus",+ "name": "QwQ Plus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.23,+ "output": 0.574+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "qwq-32b",+ "name": "QwQ 32B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.287,+ "output": 0.861+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.003625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.574,+ "output": 2.294+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1048576,+ "max_output_tokens": 1048576,+ "cost": {+ "input": 2.827,+ "output": 14.133,+ "cache_read": 0.283+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.929,+ "output": 3.858+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.1,+ "output": 3.851,+ "cache_read": 0.275+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "qwen3.7-text-embedding",+ "name": "Qwen3.7 Text Embedding",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding",+ "compat": {+ "max_batch_size": 20+ }+ },+ {+ "id": "qwen3.7-text-embedding-flash",+ "name": "Qwen3.7 Text Embedding Flash",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding",+ "compat": {+ "max_batch_size": 20+ }+ },+ {+ "id": "text-embedding-v4",+ "name": "Tongyi text-embedding-v4",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding",+ "compat": {+ "max_batch_size": 10+ }+ },+ {+ "id": "text-embedding-v3",+ "name": "Tongyi text-embedding-v3",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding",+ "compat": {+ "max_batch_size": 10+ }+ },+ {+ "name": "text-embedding-v2 (fixed 1536 dimensions)",+ "match": "text-embedding-v2",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai",+ "compat": {+ "dimensions_field": "",+ "max_batch_size": 25+ }+ },+ {+ "name": "text-embedding-v1 (fixed 1536 dimensions)",+ "match": "text-embedding-v1",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai",+ "compat": {+ "dimensions_field": "",+ "max_batch_size": 25+ }+ },+ {+ "id": "tongyi-embedding-vision-plus",+ "name": "Tongyi Embedding Vision Plus",+ "type": "Embedding",+ "dimension": 1152,+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": ""+ }+ },+ {+ "name": "tongyi-embedding-vision-flash (fixed 768 dimensions)",+ "match": "tongyi-embedding-vision-flash",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": ""+ }+ },+ {+ "name": "tongyi-embedding-vision snapshots",+ "match": "tongyi-embedding-vision*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 20+ }+ },+ {+ "name": "qwen3-vl-embedding (independent vectors by default)",+ "match": "qwen3-vl-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 20+ }+ },+ {+ "name": "qwen2.5-vl-embedding (fused vectors only)",+ "match": "qwen2.5-vl-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 1+ }+ },+ {+ "name": "multimodal-embedding-v1",+ "match": "multimodal-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "",+ "max_batch_size": 20+ }+ },+ {+ "id": "qwen3-rerank",+ "name": "Qwen3 Rerank (separate endpoint, not implemented)",+ "type": "Rerank",+ "deprecated": true,+ "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api",+ "compat": {+ "unsupported_reason": "qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet"+ }+ },+ {+ "id": "gte-rerank-v2",+ "name": "GTE Rerank v2",+ "type": "Rerank",+ "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"+ },+ {+ "id": "qwen3-asr-flash",+ "name": "Qwen3 ASR Flash",+ "type": "ASR",+ "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference",+ "compat": {+ "api": "openai-chat-audio",+ "max_encoded_bytes": 10485760,+ "language_param": "asr_options"+ }+ },+ {+ "name": "Other Alibaba recognition models (not callable with the audio in the request)",+ "match": "*",+ "type": "ASR",+ "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference",+ "compat": {+ "unsupported_reason": "Alibaba's other recognition models take a public file URL or run as asynchronous tasks; only qwen3-asr-flash accepts the audio in the request"+ }+ }+ ],+ "anthropic": [+ {+ "id": "claude-fable-5-1",+ "name": "Claude Fable 5.1",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 0.25,+ "cache_write": 12.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 10,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-fable-5",+ "name": "Claude Fable 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 1,+ "cache_write": 12.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-8",+ "name": "Claude Opus 4.8",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-7",+ "name": "Claude Opus 4.7",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-sonnet-4-6",+ "name": "Claude Sonnet 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-6",+ "name": "Claude Opus 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-5",+ "name": "Claude Opus 4.5",+ "aliases": [+ "claude-opus-4-5-20251101"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/effort",+ "api": "anthropic-messages",+ "compat": {+ "supports_effort": true+ }+ },+ {+ "id": "claude-sonnet-4-5",+ "name": "Claude Sonnet 4.5",+ "aliases": [+ "claude-sonnet-4-5-20250929"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://platform.claude.com/docs/en/models/sonnet-4-5/overview",+ "api": "anthropic-messages"+ },+ {+ "id": "claude-haiku-4-5",+ "name": "Claude Haiku 4.5",+ "aliases": [+ "claude-haiku-4-5-20251001"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 1,+ "output": 5,+ "cache_read": 0.1,+ "cache_write": 1.25+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models",+ "api": "anthropic-messages"+ }+ ],+ "azure_openai": [+ {+ "name": "GPT-6 deployments (reasoning, thinking always on)",+ "match": "gpt-6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "name": "GPT-5 deployments (reasoning, no sampling parameters)",+ "match": "gpt-5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low"+ }+ },+ {+ "id": "gpt-5",+ "name": "GPT-5 deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-mini",+ "name": "GPT-5 Mini deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5-mini",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-nano",+ "name": "GPT-5 Nano deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5-nano",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "o1 deployments (always-on reasoning)",+ "match": "o1*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "o3 deployments (always-on reasoning)",+ "match": "o3*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "o4 deployments (always-on reasoning)",+ "match": "o4*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "GPT-4o deployments",+ "match": "gpt-4o*",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "GPT-4.1 deployments",+ "match": "gpt-4.1*",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "text-embedding-3 deployments",+ "match": "text-embedding-3*",+ "type": "Embedding",+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ }+ ],+ "deepseek": [+ {+ "id": "deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.66,+ "output": 1.98,+ "cache_read": 0.022+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-flash",+ "name": "DeepSeek V4.1 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.003+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing"+ },+ {+ "id": "deepseek-v4-flash",+ "name": "DeepSeek V4 Flash (retired name, served by V4.1 Flash)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.003+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing"+ },+ {+ "id": "deepseek-chat",+ "name": "DeepSeek Chat (retired 2026-07-24, non-thinking alias)",+ "deprecated": true,+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 8192,+ "source": "https://api-docs.deepseek.com/news/news260424/"+ },+ {+ "id": "deepseek-reasoner",+ "name": "DeepSeek Reasoner (retired 2026-07-24, thinking alias)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 65536,+ "source": "https://api-docs.deepseek.com/news/news260424/",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "gemini": [+ {+ "name": "Gemini 3 family (thinkingLevel)",+ "match": "gemini-3*",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.8-flash",+ "name": "Gemini 3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.7-flash",+ "name": "Gemini 3.7 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.6-flash",+ "name": "Gemini 3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.5-flash",+ "name": "Gemini 3.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.5,+ "output": 9,+ "cache_read": 0.15+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.5-flash-lite",+ "name": "Gemini 3.5 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.3,+ "output": 2.5,+ "cache_read": 0.03+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.1-flash-lite",+ "name": "Gemini 3.1 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.25,+ "output": 1.5,+ "cache_read": 0.025+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3-flash-preview",+ "name": "Gemini 3 Flash Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-2.5-pro",+ "name": "Gemini 2.5 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "gemini-2.5-flash",+ "name": "Gemini 2.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.3,+ "output": 2.5,+ "cache_read": 0.03+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ }+ },+ {+ "id": "gemini-2.5-flash-lite",+ "name": "Gemini 2.5 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.1,+ "output": 0.4,+ "cache_read": 0.01+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ }+ },+ {+ "id": "gemini-embedding-001",+ "name": "Gemini Embedding 001",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 2048,+ "cost": {+ "input": 0.15,+ "output": 0+ },+ "source": "https://ai.google.dev/gemini-api/docs/embeddings"+ },+ {+ "id": "gemini-embedding-2",+ "name": "Gemini Embedding 2",+ "aliases": [+ "gemini-embedding-2-preview"+ ],+ "type": "Embedding",+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "dimension": 3072,+ "context_window": 8192,+ "cost": {+ "input": 0.2,+ "output": 0+ },+ "source": "https://ai.google.dev/gemini-api/docs/embeddings"+ }+ ],+ "generic": [+ {+ "match": "gpt-5*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ }+ },+ {+ "match": "o1*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o3*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o4*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ }+ ],+ "gpustack": [],+ "hunyuan": [+ {+ "name": "Hunyuan T1 family (always-on reasoning)",+ "match": "hunyuan-t1*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/104753",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "hunyuan-t1-latest",+ "name": "Hunyuan T1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "source": "https://cloud.tencent.com/document/product/1729/104753",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "hunyuan-t1-vision-20250916",+ "name": "Hunyuan T1 Vision (deep thinking)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 28000,+ "max_output_tokens": 20000,+ "source": "https://cloud.tencent.com/document/product/1729/104753",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "hunyuan-turbos-latest",+ "name": "Hunyuan TurboS",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "max_output_tokens": 8000,+ "cost": {+ "input": 0.11,+ "output": 0.28+ },+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-a13b",+ "name": "Hunyuan A13B (hybrid thinking)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 224000,+ "max_output_tokens": 32000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-2.0-thinking-20251109",+ "name": "Hunyuan 2.0 Thinking",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/127293"+ },+ {+ "id": "hunyuan-2.0-instruct-20251111",+ "name": "Hunyuan 2.0 Instruct",+ "reasoning": false,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/127293"+ },+ {+ "id": "hunyuan-vision-1.5-instruct",+ "name": "Hunyuan Vision 1.5 Instruct (fast thinking)",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 24000,+ "max_output_tokens": 16000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-turbos-vision-video",+ "name": "Hunyuan TurboS Vision Video",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 24000,+ "max_output_tokens": 8000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-turbos-vision",+ "name": "Hunyuan TurboS Vision",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 32000,+ "max_output_tokens": 8000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-lite",+ "name": "Hunyuan Lite",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 6000,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-embedding",+ "name": "Hunyuan Embedding",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.tencent.com/document/product/1729/111007"+ }+ ],+ "jina": [+ {+ "id": "jina-embeddings-v5-omni-small",+ "name": "Jina Embeddings v5 Omni Small (multimodal)",+ "type": "Embedding",+ "input": [+ "text",+ "image"+ ],+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-omni-nano",+ "name": "Jina Embeddings v5 Omni Nano (multimodal)",+ "type": "Embedding",+ "input": [+ "text",+ "image"+ ],+ "dimension": 768,+ "context_window": 8192,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-text-small",+ "name": "Jina Embeddings v5 Text Small",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-text-nano",+ "name": "Jina Embeddings v5 Text Nano",+ "type": "Embedding",+ "dimension": 768,+ "context_window": 8192,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v4",+ "name": "Jina Embeddings v4",+ "type": "Embedding",+ "dimension": 2048,+ "context_window": 32768,+ "source": "https://jina.ai/models/jina-embeddings-v4/"+ },+ {+ "id": "jina-embeddings-v3",+ "name": "Jina Embeddings v3",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 8192,+ "source": "https://jina.ai/models/jina-embeddings-v3/"+ },+ {+ "id": "jina-code-embeddings-1.5b",+ "name": "Jina Code Embeddings 1.5B",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-code-embeddings-0.5b",+ "name": "Jina Code Embeddings 0.5B",+ "type": "Embedding",+ "dimension": 896,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-reranker-v3.5",+ "name": "Jina Reranker v3.5",+ "type": "Rerank",+ "context_window": 131072,+ "source": "https://jina.ai/reranker/"+ },+ {+ "id": "jina-reranker-v3",+ "name": "Jina Reranker v3",+ "type": "Rerank",+ "context_window": 131072,+ "source": "https://jina.ai/models/jina-reranker-v3/"+ },+ {+ "id": "jina-reranker-m0",+ "name": "Jina Reranker m0 (multimodal)",+ "type": "Rerank",+ "context_window": 10000,+ "source": "https://jina.ai/reranker/"+ },+ {+ "id": "jina-reranker-v2-base-multilingual",+ "name": "Jina Reranker v2 Base Multilingual",+ "type": "Rerank",+ "context_window": 1024,+ "source": "https://jina.ai/reranker/"+ }+ ],+ "litellm": [],+ "lkeap": [+ {+ "name": "DeepSeek R1 family (always-on reasoning)",+ "match": "*deepseek-r1*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1772/115963",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "name": "DeepSeek V3 family (thinking switch)",+ "match": "*deepseek-v3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.2",+ "name": "DeepSeek V3.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.1-terminus",+ "name": "DeepSeek V3.1 Terminus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-r1-0528",+ "name": "DeepSeek R1 (0528)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v3-0324",+ "name": "DeepSeek V3 (0324)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 65536,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v3",+ "name": "DeepSeek V3",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 65536,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.1",+ "name": "DeepSeek V3.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "lke-reranker-base",+ "name": "LKE Reranker Base",+ "type": "Rerank",+ "source": "https://cloud.tencent.com/document/product/1772/115339"+ }+ ],+ "longcat": [+ {+ "id": "LongCat-2.0",+ "name": "LongCat 2.0",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.75,+ "output": 2.95,+ "cache_read": 0.015+ },+ "source": "https://longcat.chat/platform/docs/zh/api/chat.html"+ },+ {+ "id": "LongCat-Flash-Chat",+ "name": "LongCat Flash Chat (retired 2026-05-29)",+ "deprecated": true,+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 8192,+ "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html"+ },+ {+ "id": "LongCat-Flash-Thinking",+ "name": "LongCat Flash Thinking (retired 2026-05-29)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 65536,+ "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "mimo": [+ {+ "id": "mimo-v2.5-pro",+ "name": "MiMo V2.5 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.0036+ },+ "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"+ },+ {+ "id": "mimo-v2.5",+ "name": "MiMo V2.5",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"+ },+ {+ "id": "mimo-v2.5-pro-ultraspeed",+ "name": "MiMo V2.5 Pro Ultraspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.305,+ "output": 2.61,+ "cache_read": 0.0108+ },+ "source": "https://mimo.mi.com/static/docs/news/latest/beta-extended.md"+ },+ {+ "id": "mimo-v2-flash",+ "name": "MiMo V2 Flash (retired 2026-06-30)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.1,+ "output": 0.3,+ "cache_read": 0.01+ },+ "deprecated": true,+ "source": "https://mimo.mi.com/static/docs/updates/deprecate.md"+ },+ {+ "id": "mimo-v2.5-asr",+ "name": "MiMo V2.5 ASR",+ "type": "ASR",+ "source": "https://mimo.mi.com/docs/en-US/quick-start/usage-guide/audio/Speech-Recognition"+ }+ ],+ "minimax": [+ {+ "id": "MiniMax-M3",+ "name": "MiniMax M3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 512000,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://platform.minimax.io/docs/guides/text-generation"+ },+ {+ "id": "MiniMax-M2.7",+ "name": "MiniMax M2.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.7-highspeed",+ "name": "MiniMax M2.7 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.4,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.5",+ "name": "MiniMax M2.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.03,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.5-highspeed",+ "name": "MiniMax M2.5 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.4,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.1",+ "name": "MiniMax M2.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.03,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.1-highspeed",+ "name": "MiniMax M2.1 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "source": "https://platform.minimax.io/docs/guides/text-generation",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2",+ "name": "MiniMax M2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "asr-1.0",+ "name": "MiniMax ASR 1.0",+ "type": "ASR",+ "source": "https://platform.minimax.io/docs/api-reference/speech-to-text"+ }+ ],+ "modelscope": [+ {+ "id": "ZhipuAI/GLM-4.6",+ "name": "GLM-4.6",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 202752,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.6"+ },+ {+ "id": "ZhipuAI/GLM-4.5",+ "name": "GLM-4.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.5"+ },+ {+ "id": "Qwen/Qwen3-235B-A22B-Instruct-2507",+ "name": "Qwen3 235B-A22B Instruct 2507",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Instruct-2507"+ },+ {+ "id": "Qwen/Qwen3-235B-A22B-Thinking-2507",+ "name": "Qwen3 235B-A22B Thinking 2507",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Thinking-2507",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "Qwen/Qwen3-30B-A3B-Instruct-2507",+ "name": "Qwen3 30B-A3B Instruct 2507",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Instruct-2507"+ },+ {+ "id": "Qwen/Qwen3-30B-A3B-Thinking-2507",+ "name": "Qwen3 30B-A3B Thinking 2507",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Thinking-2507",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "Qwen/Qwen3-Coder-30B-A3B-Instruct",+ "name": "Qwen3 Coder 30B-A3B Instruct",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Coder-30B-A3B-Instruct"+ },+ {+ "id": "Qwen/Qwen3-8B",+ "name": "Qwen3 8B (hybrid thinking)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-8B"+ },+ {+ "id": "Qwen/Qwen3-VL-235B-A22B-Instruct",+ "name": "Qwen3 VL 235B-A22B Instruct",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-VL-235B-A22B-Instruct"+ },+ {+ "id": "Qwen/Qwen3-Embedding-8B",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-8B"+ },+ {+ "id": "Qwen/Qwen3-Embedding-0.6B",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-0.6B"+ }+ ],+ "moonshot": [+ {+ "id": "kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k3-quickstart",+ "compat": {+ "thinking_format": "openai",+ "supports_reasoning_effort": true,+ "supports_temperature": false,+ "tool_choice_modes": [+ "none",+ "auto",+ "required"+ ]+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "kimi-k2.7-code",+ "name": "Kimi K2.7 Code",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.19+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.7-code-highspeed",+ "name": "Kimi K2.7 Code Highspeed",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 1.9,+ "output": 8,+ "cache_read": 0.38+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.16+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-6-quickstart",+ "compat": {+ "supports_temperature": false+ }+ },+ {+ "name": "moonshot-v1 family (retired 2026-08-31)",+ "match": "moonshot-v1*",+ "reasoning": false,+ "input": [+ "text"+ ],+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "kimi-k2.5",+ "name": "Kimi K2.5 (retired 2026-08-31)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.6,+ "output": 3,+ "cache_read": 0.1+ },+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "supports_temperature": false+ }+ },+ {+ "id": "kimi-k2-thinking",+ "name": "Kimi K2 Thinking (retired 2026-08-31)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.574,+ "output": 2.294+ },+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2-turbo-preview",+ "name": "Kimi K2 Turbo (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "moonshot-v1-8k",+ "name": "Moonshot v1 8K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 8192,+ "max_output_tokens": 8192,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-32k",+ "name": "Moonshot v1 32K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 32768,+ "max_output_tokens": 32768,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-128k",+ "name": "Moonshot v1 128K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 131072,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-8k-vision-preview",+ "name": "Moonshot v1 8K Vision (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 8192,+ "max_output_tokens": 8192,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models",+ "compat": {+ "fixed_temperature": 1+ }+ }+ ],+ "novita": [+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 1048576,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "zai-org/glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "zai-org/glm-5.1",+ "name": "GLM-5.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.38,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "deepseek/deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 1.6,+ "output": 3.2,+ "cache_read": 0.135+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "deepseek/deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.028+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "moonshotai/kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.8,+ "output": 3.4,+ "cache_read": 0.16+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "moonshotai/kimi-k2.7-code",+ "name": "Kimi K2.7 Code",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.19+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.25,+ "output": 3.75,+ "cache_read": 0.25,+ "cache_write": 1.5625+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3.5-397b-a17b",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.6,+ "output": 3.6+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "minimax/minimax-m2.7",+ "name": "MiniMax M2.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "xiaomimimo/mimo-v2.5-pro",+ "name": "MiMo V2.5 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.522,+ "output": 1.044,+ "cache_read": 0.0043+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "google/gemma-4-31b-it",+ "name": "Gemma 4 31B IT",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.14,+ "output": 0.4+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3-embedding-0.6b",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3-embedding-8b",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "context_window": 32768,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "baai/bge-m3",+ "name": "BGE-M3",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 8192,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ }+ ],+ "nvidia": [+ {+ "id": "nvidia/nemotron-3-ultra-550b-a55b",+ "name": "Nemotron 3 Ultra 550B-A55B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 2.5,+ "cache_read": 0.15+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nemotron-3-super-120b-a12b",+ "name": "Nemotron 3 Super 120B-A12B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.2,+ "output": 0.8+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nemotron-3.5-lightning-30b-a3b",+ "name": "Nemotron 3.5 Lightning 30B-A3B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "z-ai/glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com",+ "compat": {+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-ai/deepseek-v4-pro-0813",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.003625+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "deepseek-ai/deepseek-v4-flash-0731",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "moonshotai/kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "google/gemma-4-31b-it",+ "name": "Gemma 4 31B IT",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "thinking_format": "none"+ }+ },+ {+ "id": "nvidia/nemotron-3-embed-1b",+ "name": "Nemotron 3 Embed 1B",+ "type": "Embedding",+ "dimension": 2048,+ "context_window": 4096,+ "source": "https://docs.api.nvidia.com/nim/reference/nvidia-nemotron-3-embed-1b-infer"+ },+ {+ "id": "nvidia/llama-nemotron-rerank-vl-1b-v2",+ "name": "Llama Nemotron Rerank VL 1B v2",+ "type": "Rerank",+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nv-rerankqa-mistral-4b-v3",+ "name": "NV-RerankQA Mistral 4B v3",+ "type": "Rerank",+ "source": "https://build.nvidia.com"+ }+ ],+ "openai": [+ {+ "name": "GPT-6 family (reasoning, no sampling parameters, thinking always on)",+ "match": "gpt-6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/guides/latest-model",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "name": "GPT-5 family (reasoning, no sampling parameters)",+ "match": "gpt-5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/guides/reasoning",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low"+ }+ },+ {+ "name": "o1 family (always-on reasoning)",+ "match": "o1*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "o3 family (always-on reasoning)",+ "match": "o3*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "name": "o4 family (always-on reasoning)",+ "match": "o4*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-6-astra",+ "name": "GPT-6 Astra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 1,+ "cache_write": 12.5+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-terra",+ "name": "GPT-5.6 Terra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-sol",+ "name": "GPT-5.6 Sol",+ "aliases": [+ "gpt-5.6"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 4,+ "output": 20,+ "cache_read": 0.4,+ "cache_write": 5+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-luna",+ "name": "GPT-5.6 Luna",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.2,+ "output": 1.2,+ "cache_read": 0.02,+ "cache_write": 0.25+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 30,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2.5,+ "output": 15,+ "cache_read": 0.25+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4-mini",+ "name": "GPT-5.4 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.75,+ "output": 4.5,+ "cache_read": 0.075+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4-nano",+ "name": "GPT-5.4 Nano",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.2,+ "output": 1.25,+ "cache_read": 0.02+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.2",+ "name": "GPT-5.2",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.75,+ "output": 14,+ "cache_read": 0.175+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.1",+ "name": "GPT-5.1",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5",+ "name": "GPT-5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-mini",+ "name": "GPT-5 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.25,+ "output": 2,+ "cache_read": 0.025+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-nano",+ "name": "GPT-5 Nano",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.05,+ "output": 0.4,+ "cache_read": 0.005+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "o3",+ "name": "o3",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 100000,+ "cost": {+ "input": 2,+ "output": 8,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-4.1",+ "name": "GPT-4.1",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1047576,+ "max_output_tokens": 32768,+ "cost": {+ "input": 2,+ "output": 8,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4.1-mini",+ "name": "GPT-4.1 Mini",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1047576,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.4,+ "output": 1.6,+ "cache_read": 0.1+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4o",+ "name": "GPT-4o",+ "aliases": [+ "gpt-4o-2024-11-20",+ "gpt-4o-2024-08-06"+ ],+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 2.5,+ "output": 10,+ "cache_read": 1.25+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4o-mini",+ "name": "GPT-4o Mini",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.075+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "text-embedding-3-small",+ "name": "text-embedding-3-small",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8191,+ "cost": {+ "input": 0.02,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "text-embedding-3-large",+ "name": "text-embedding-3-large",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 8191,+ "cost": {+ "input": 0.13,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "whisper-1",+ "name": "Whisper",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create",+ "compat": {+ "response_format": "verbose_json"+ }+ },+ {+ "id": "gpt-transcribe",+ "name": "GPT Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "gpt-4o-transcribe",+ "name": "GPT-4o Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "gpt-4o-mini-transcribe",+ "name": "GPT-4o mini Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "text-embedding-ada-002",+ "name": "text-embedding-ada-002",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8192,+ "cost": {+ "input": 0.1,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models",+ "compat": {+ "dimensions_field": ""+ }+ }+ ],+ "openrouter": [+ {+ "name": "Anthropic models (cache_control breakpoints, thinking always on)",+ "match": "anthropic/*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "openai/gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 30,+ "cache_read": 0.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2.5,+ "output": 15,+ "cache_read": 0.25+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "anthropic/claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 10,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-4.6",+ "name": "Claude Sonnet 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "google/gemini-3.8-flash",+ "name": "Gemini 3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075,+ "cache_write": 0.041667+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2,+ "cache_write": 0.375+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "deepseek/deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 384000,+ "cost": {+ "input": 1.6,+ "output": 3.2,+ "cache_read": 0.135+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "deepseek/deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.07,+ "output": 0.14,+ "cache_read": 0.014+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "z-ai/glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1310720,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 943718,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "qwen/qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.475,+ "output": 4.425,+ "cache_read": 0.295,+ "cache_write": 1.84375+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "minimax/minimax-m3",+ "name": "MiniMax M3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 512000,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "x-ai/grok-4.6",+ "name": "Grok 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 500000,+ "max_output_tokens": 450000,+ "cost": {+ "input": 2,+ "output": 6,+ "cache_read": 0.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/text-embedding-3-small",+ "name": "text-embedding-3-small",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8192,+ "source": "https://openrouter.ai/docs/api_reference/embeddings"+ },+ {+ "id": "openai/text-embedding-3-large",+ "name": "text-embedding-3-large",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 8192,+ "source": "https://openrouter.ai/docs/api_reference/embeddings"+ },+ {+ "id": "cohere/rerank-v3.5",+ "name": "Cohere Rerank v3.5",+ "type": "Rerank",+ "source": "https://openrouter.ai/docs/api/api-reference/rerank/submit-a-rerank-request"+ },+ {+ "id": "openai/whisper-large-v3",+ "name": "Whisper Large v3",+ "type": "ASR",+ "source": "https://openrouter.ai/docs/api/api-reference/stt/create-transcription"+ }+ ],+ "qianfan": [+ {+ "id": "ernie-5.0-thinking-preview",+ "name": "ERNIE 5.0 Thinking Preview",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 65536,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv"+ },+ {+ "id": "ernie-4.5-turbo-128k",+ "name": "ERNIE 4.5 Turbo 128K",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 12288,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ },+ {+ "id": "ernie-4.5-turbo-vl-32k",+ "name": "ERNIE 4.5 Turbo VL 32K",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 32000,+ "max_output_tokens": 12288,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ },+ {+ "id": "ernie-x1-turbo-32k",+ "name": "ERNIE X1 Turbo 32K",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "max_output_tokens": 16000,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v3.2",+ "name": "DeepSeek V3.2 (Qianfan)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv",+ "compat": {+ "thinking_format": "thinking-type"+ }+ },+ {+ "id": "embedding-v1",+ "name": "Embedding-V1",+ "type": "Embedding",+ "dimension": 384,+ "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"+ },+ {+ "id": "bge-large-zh",+ "name": "BGE Large ZH",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"+ },+ {+ "id": "tao-8k",+ "name": "Tao-8K",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.baidu.com/doc/qianfan/s/rmh4stp0j",+ "compat": {+ "max_batch_size": 1+ }+ },+ {+ "id": "bce-reranker-base",+ "name": "BCE Reranker Base",+ "type": "Rerank",+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ }+ ],+ "qiniu": [+ {+ "id": "qwen3.5-397b-a17b",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 64000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "z-ai/glm-5",+ "name": "GLM-5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "z-ai/glm-4.7",+ "name": "GLM-4.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 200000,+ "source": "https://api.qnaigc.com/v1/market/models"+ },+ {+ "id": "minimax/minimax-m2.5",+ "name": "MiniMax M2.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "doubao-seed-2.0-pro",+ "name": "Doubao Seed 2.0 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "moonshotai/kimi-k2.5",+ "name": "Kimi K2.5",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "xiaomi/mimo-v2-flash",+ "name": "MiMo V2 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.1,+ "output": 0.3,+ "cache_read": 0.01+ },+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "deepseek/deepseek-v3.2-251201",+ "name": "DeepSeek V3.2 (251201)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://apidocs.qnaigc.com/397639742e0"+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://api.qnaigc.com/v1/market/models",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v3",+ "name": "DeepSeek V3",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 16000,+ "source": "https://www.qiniu.com/ai/models"+ }+ ],+ "requesty": [+ {+ "id": "openai/gpt-6-astra",+ "name": "GPT-6 Astra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "anthropic/claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "vertex/gemini-3.8-flash",+ "name": "Gemini 3.8 Flash (Vertex)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.6-flash",+ "name": "Gemini 3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "deepseek/deepseek-v4-pro-0813",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "zai/glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "moonshot/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 262144,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "openai/gpt-4o-transcribe",+ "name": "GPT-4o Transcribe",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"+ },+ {+ "id": "openai/gpt-4o-mini-transcribe",+ "name": "GPT-4o mini Transcribe",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"+ },+ {+ "id": "openai/whisper-1",+ "name": "Whisper",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create",+ "compat": {+ "response_format": "verbose_json"+ }+ }+ ],+ "siliconflow": [+ {+ "name": "DeepSeek V4 family (reasoning_effort high | max)",+ "match": "deepseek-ai/DeepSeek-V4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "name": "DeepSeek V4 Pro-tier family (reasoning_effort high | max)",+ "match": "Pro/deepseek-ai/DeepSeek-V4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1049000,+ "max_output_tokens": 393000,+ "cost": {+ "input": 1.74,+ "output": 3.48,+ "cache_read": 0.145+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.003+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "zai-org/GLM-5.2",+ "name": "GLM-5.2",+ "aliases": [+ "Pro/zai-org/GLM-5.2"+ ],+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1049000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "Pro/zai-org/GLM-5.1",+ "name": "GLM-5.1 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 205000,+ "max_output_tokens": 205000,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/zai-org/GLM-5",+ "name": "GLM-5 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 205000,+ "max_output_tokens": 205000,+ "cost": {+ "input": 1,+ "output": 3.2+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.6",+ "name": "Kimi K2.6 (Pro)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.16+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.5",+ "name": "Kimi K2.5 (Pro)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.45,+ "output": 2.25,+ "cache_read": 0.07+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-397B-A17B",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.29,+ "output": 1.74+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-122B-A10B",+ "name": "Qwen3.5 122B-A10B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.29,+ "output": 2.32+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-35B-A3B",+ "name": "Qwen3.5 35B-A3B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.23,+ "output": 1.86+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.6-35B-A3B",+ "name": "Qwen3.6 35B-A3B",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.23,+ "output": 1.86+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "deepseek-ai/DeepSeek-V3.2",+ "name": "DeepSeek V3.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 164000,+ "max_output_tokens": 164000,+ "cost": {+ "input": 0.27,+ "output": 0.42+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/MiniMaxAI/MiniMax-M2.5",+ "name": "MiniMax M2.5 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131000,+ "cost": {+ "input": 0.3,+ "output": 1.22+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3-VL-32B-Instruct",+ "name": "Qwen3 VL 32B Instruct",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.2,+ "output": 0.6+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "BAAI/bge-m3",+ "name": "BGE-M3",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post",+ "compat": {+ "dimensions_field": ""+ }+ },+ {+ "id": "Qwen/Qwen3-Embedding-8B",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "Qwen/Qwen3-Embedding-4B",+ "name": "Qwen3 Embedding 4B",+ "type": "Embedding",+ "dimension": 2560,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "Qwen/Qwen3-Embedding-0.6B",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "BAAI/bge-reranker-v2-m3",+ "name": "BGE Reranker v2 M3",+ "type": "Rerank",+ "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"+ },+ {+ "id": "Qwen/Qwen3-Reranker-8B",+ "name": "Qwen3 Reranker 8B",+ "type": "Rerank",+ "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"+ },+ {+ "id": "FunAudioLLM/SenseVoiceSmall",+ "name": "SenseVoice Small",+ "type": "ASR",+ "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"+ },+ {+ "id": "TeleAI/TeleSpeechASR",+ "name": "TeleSpeechASR",+ "type": "ASR",+ "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"+ }+ ],+ "volcengine": [+ {+ "id": "doubao-seed-2-1-pro-260915",+ "name": "Doubao Seed 2.1 Pro (260915)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1024000,+ "max_output_tokens": 256000,+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-2-1-pro-260628",+ "name": "Doubao Seed 2.1 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.8906,+ "output": 4.45301,+ "cache_read": 0.17812+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-1-turbo-260628",+ "name": "Doubao Seed 2.1 Turbo",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.4453,+ "output": 2.22651,+ "cache_read": 0.08906+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-pro-260215",+ "name": "Doubao Seed 2.0 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.47499,+ "output": 2.37494,+ "cache_read": 0.095+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "doubao-seed-2-0-lite-260428",+ "name": "Doubao Seed 2.0 Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.08906,+ "output": 0.53436,+ "cache_read": 0.01781+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-mini-260428",+ "name": "Doubao Seed 2.0 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.02969,+ "output": 0.29687,+ "cache_read": 0.00594+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-code-preview-260215",+ "name": "Doubao Seed 2.0 Code Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.47499,+ "output": 2.37494,+ "cache_read": 0.095+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-1-8-251228",+ "name": "Doubao Seed 1.8 (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-1-6-251015",+ "name": "Doubao Seed 1.6 (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-1-6-flash-250828",+ "name": "Doubao Seed 1.6 Flash (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.02227,+ "output": 0.22265,+ "cache_read": 0.00445+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "doubao-seed-1-6-vision-250815",+ "name": "Doubao Seed 1.6 Vision (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "deepseek-v4-1-flash-260910",+ "name": "DeepSeek V4.1 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "deepseek-v4-pro-ga-260813",+ "name": "DeepSeek V4 Pro (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 1.3359,+ "output": 4.00771,+ "cache_read": 0.04453+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "deepseek-v4-flash-ga-260731",+ "name": "DeepSeek V4 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.4453,+ "output": 1.3359,+ "cache_read": 0.01484+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "glm-5-3-flash-260828",+ "name": "GLM-5.3 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.11875,+ "output": 0.41563,+ "cache_read": 0.03414+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5-2-260617",+ "name": "GLM-5.2 (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.18747,+ "output": 4.15615,+ "cache_read": 0.29687+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "name": "Retired doubao-embedding text models",+ "match": "doubao-embedding-text*",+ "type": "Embedding",+ "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh",+ "compat": {+ "api": "openai-embeddings",+ "dimensions_field": "",+ "max_batch_size": 4+ }+ },+ {+ "name": "Retired doubao-embedding-large text models",+ "match": "doubao-embedding-large-text*",+ "type": "Embedding",+ "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh",+ "compat": {+ "api": "openai-embeddings",+ "dimensions_field": "",+ "max_batch_size": 4+ }+ },+ {+ "id": "doubao-embedding-vision-251215",+ "name": "Doubao Embedding Vision (251215)",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"+ },+ {+ "id": "doubao-embedding-vision-250615",+ "name": "Doubao Embedding Vision",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"+ },+ {+ "id": "doubao-seed-rerank",+ "name": "Doubao Seed Rerank",+ "type": "Rerank",+ "source": "https://www.volcengine.com/docs/84313/1254474"+ },+ {+ "id": "base-multilingual-rerank",+ "name": "Base Multilingual Rerank",+ "type": "Rerank",+ "source": "https://www.volcengine.com/docs/84313/1254474"+ }+ ],+ "weknoracloud": [],+ "zhipu": [+ {+ "id": "glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.3-flash",+ "name": "GLM-5.3 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.075,+ "output": 0.25,+ "cache_read": 0.015+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/vlm/glm-5.3-flash",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.2",+ "thinking_levels": {+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.1",+ "name": "GLM-5.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-5",+ "name": "GLM-5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1,+ "output": 3.2,+ "cache_read": 0.2+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-5v-turbo",+ "name": "GLM-5V Turbo",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 5,+ "output": 22,+ "cache_read": 1.2+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.7",+ "name": "GLM-4.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.2,+ "cache_read": 0.11+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.7-flash",+ "name": "GLM-4.7 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.6v",+ "name": "GLM-4.6V",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 128000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.3,+ "output": 0.9+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.6",+ "name": "GLM-4.6",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.2,+ "cache_read": 0.11+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.5-air",+ "name": "GLM-4.5 Air",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0.2,+ "output": 1.1,+ "cache_read": 0.03+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "embedding-3",+ "name": "Embedding-3",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入",+ "compat": {+ "max_batch_size": 64+ }+ },+ {+ "id": "embedding-2",+ "name": "Embedding-2",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入",+ "compat": {+ "dimensions_field": ""+ }+ },+ {+ "id": "rerank",+ "name": "Rerank",+ "type": "Rerank",+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本重排序"+ },+ {+ "id": "glm-asr-2512",+ "name": "GLM-ASR-2512 (at most 30 s per file)",+ "type": "ASR",+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/语音转文本"+ }+ ]+ }+}diff --git a/internal/models/catalog/data/overrides.json b/internal/models/catalog/data/overrides.jsonnew file mode 100644index 000000000..45a44d6c5--- /dev/null+++ b/internal/models/catalog/data/overrides.json@@ -0,0 +1,1931 @@+{+ "version": 1,+ "providers": {+ "aliyun": [+ {+ "match": "qwen3*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen3.5*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen3.6*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen3.7*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen3.8*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "match": "qwen-plus*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen-max*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen-turbo*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "qwen-flash*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "deepseek-v3*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "deepseek-v4*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "kimi-k2*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "match": "glm-5*",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.8-max",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "qwen3.8-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true,+ "thinking_budget_excludes_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "medium",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "qwen3.7-max",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.7-plus",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.7-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.6-plus",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.6-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.5-plus",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3.5-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3-max",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen3-vl-plus",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-plus",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-max",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-turbo",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwen-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "qwq-plus",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "qwq-32b",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v4-pro",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-v4-flash",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-r1",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k3",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.6",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true+ }+ },+ {+ "id": "glm-5.3",+ "compat": {+ "thinking_always_send": true,+ "thinking_disable_on_non_stream": true,+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "qwen3.7-text-embedding",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 20+ }+ },+ {+ "id": "qwen3.7-text-embedding-flash",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 20+ }+ },+ {+ "id": "text-embedding-v4",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 10+ }+ },+ {+ "id": "text-embedding-v3",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 10+ }+ },+ {+ "match": "text-embedding-v2",+ "type": "Embedding",+ "compat": {+ "dimensions_field": "",+ "max_batch_size": 25+ }+ },+ {+ "match": "text-embedding-v1",+ "type": "Embedding",+ "compat": {+ "dimensions_field": "",+ "max_batch_size": 25+ }+ },+ {+ "id": "tongyi-embedding-vision-plus",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": ""+ }+ },+ {+ "match": "tongyi-embedding-vision-flash",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": ""+ }+ },+ {+ "match": "tongyi-embedding-vision*",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 20+ }+ },+ {+ "match": "qwen3-vl-embedding*",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 20+ }+ },+ {+ "match": "qwen2.5-vl-embedding*",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "dimension",+ "max_batch_size": 1+ }+ },+ {+ "match": "multimodal-embedding*",+ "type": "Embedding",+ "compat": {+ "api": "dashscope-embeddings",+ "dimensions_field": "",+ "max_batch_size": 20+ }+ },+ {+ "id": "qwen3-rerank",+ "type": "Rerank",+ "compat": {+ "unsupported_reason": "qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet"+ }+ },+ {+ "id": "qwen3-asr-flash",+ "type": "ASR",+ "compat": {+ "api": "openai-chat-audio",+ "max_encoded_bytes": 10485760,+ "language_param": "asr_options"+ }+ },+ {+ "match": "*",+ "type": "ASR",+ "compat": {+ "unsupported_reason": "Alibaba's other recognition models take a public file URL or run as asynchronous tasks; only qwen3-asr-flash accepts the audio in the request"+ }+ }+ ],+ "anthropic": [+ {+ "id": "claude-fable-5-1",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-5",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-sonnet-5",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-fable-5",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-8",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-7",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "claude-sonnet-4-6",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-6",+ "api": "anthropic-messages",+ "compat": {+ "thinking_mode": "adaptive",+ "supports_effort": true+ },+ "thinking_levels": {+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "claude-opus-4-5",+ "api": "anthropic-messages",+ "compat": {+ "supports_effort": true+ }+ },+ {+ "id": "claude-sonnet-4-5",+ "api": "anthropic-messages"+ },+ {+ "id": "claude-haiku-4-5",+ "api": "anthropic-messages"+ }+ ],+ "azure_openai": [+ {+ "match": "gpt-6*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "match": "gpt-5*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low"+ }+ },+ {+ "id": "gpt-5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-mini",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-nano",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o1*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o3*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o4*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ }+ ],+ "deepseek": [+ {+ "id": "deepseek-v4-pro",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-reasoner",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "gemini": [+ {+ "match": "gemini-3*",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.8-flash",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.7-flash",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.6-flash",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.5-flash",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.5-flash-lite",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.1-pro-preview",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3.1-flash-lite",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-3-flash-preview",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "level"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "minimal",+ "low": "low",+ "medium": "medium",+ "high": "high",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gemini-2.5-pro",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "gemini-2.5-flash",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ }+ },+ {+ "id": "gemini-2.5-flash-lite",+ "api": "google-generative-ai",+ "compat": {+ "thinking_mode": "budget"+ }+ }+ ],+ "generic": [+ {+ "match": "gpt-5*",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ }+ },+ {+ "match": "o1*",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o3*",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o4*",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "supports_temperature": false,+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ }+ ],+ "hunyuan": [+ {+ "match": "hunyuan-t1*",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "hunyuan-t1-latest",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "hunyuan-t1-vision-20250916",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "lkeap": [+ {+ "match": "*deepseek-r1*",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-r1-0528",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-r1",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "longcat": [+ {+ "id": "LongCat-Flash-Thinking",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "minimax": [+ {+ "id": "MiniMax-M2.7",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.7-highspeed",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.5",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.5-highspeed",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.1",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2.1-highspeed",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "MiniMax-M2",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "modelscope": [+ {+ "id": "Qwen/Qwen3-235B-A22B-Thinking-2507",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "Qwen/Qwen3-30B-A3B-Thinking-2507",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "moonshot": [+ {+ "id": "kimi-k3",+ "compat": {+ "thinking_format": "openai",+ "supports_reasoning_effort": true,+ "supports_temperature": false,+ "tool_choice_modes": [+ "none",+ "auto",+ "required"+ ]+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "kimi-k2.7-code",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.7-code-highspeed",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "kimi-k2.6",+ "compat": {+ "supports_temperature": false+ }+ },+ {+ "match": "moonshot-v1*",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "kimi-k2.5",+ "compat": {+ "supports_temperature": false+ }+ },+ {+ "id": "kimi-k2-thinking",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "moonshot-v1-8k",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-32k",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-128k",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "moonshot-v1-8k-vision-preview",+ "compat": {+ "fixed_temperature": 1+ }+ }+ ],+ "novita": [+ {+ "id": "minimax/minimax-m2.7",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "xiaomimimo/mimo-v2.5-pro",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "nvidia": [+ {+ "id": "z-ai/glm-5.3",+ "compat": {+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "moonshotai/kimi-k3",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "thinking_format": "openai",+ "supports_reasoning_effort": true+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "google/gemma-4-31b-it",+ "compat": {+ "max_tokens_field": "max_completion_tokens",+ "thinking_format": "none"+ }+ }+ ],+ "openai": [+ {+ "match": "gpt-6*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "match": "gpt-5*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low"+ }+ },+ {+ "match": "o1*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o3*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "match": "o4*",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-6-astra",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-terra",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-sol",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.6-luna",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "gpt-5.5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4-mini",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.4-nano",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.2",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "gpt-5.1",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-mini",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "gpt-5-nano",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "o3",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "whisper-1",+ "type": "ASR",+ "compat": {+ "response_format": "verbose_json"+ }+ },+ {+ "id": "text-embedding-ada-002",+ "type": "Embedding",+ "compat": {+ "dimensions_field": ""+ }+ }+ ],+ "openrouter": [+ {+ "match": "anthropic/*",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "openai/gpt-5.5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.4",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "anthropic/claude-opus-5",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-4.6",+ "compat": {+ "cache_control_format": "anthropic"+ },+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "google/gemini-3.8-flash",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "deepseek/deepseek-v4-pro",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "deepseek/deepseek-v4-flash",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "z-ai/glm-5.3",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "moonshotai/kimi-k3",+ "thinking_levels": {+ "minimal": "low",+ "medium": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "x-ai/grok-4.6",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ }+ ],+ "qianfan": [+ {+ "id": "ernie-x1-turbo-32k",+ "thinking_levels": {+ "off": null+ }+ },+ {+ "id": "deepseek-v3.2",+ "compat": {+ "thinking_format": "thinking-type"+ }+ },+ {+ "id": "tao-8k",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 1+ }+ }+ ],+ "qiniu": [+ {+ "id": "deepseek-r1",+ "thinking_levels": {+ "off": null+ }+ }+ ],+ "requesty": [+ {+ "id": "openai/gpt-6-astra",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.5",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "openai/gpt-5.4",+ "compat": {+ "supports_temperature": false+ },+ "thinking_levels": {+ "off": "none",+ "minimal": "min",+ "xhigh": "xhigh",+ "max": "xhigh"+ }+ },+ {+ "id": "anthropic/claude-opus-5",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "xhigh": "xhigh",+ "max": "max"+ }+ },+ {+ "id": "vertex/gemini-3.8-flash",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "google/gemini-3.6-flash",+ "thinking_levels": {+ "off": null,+ "minimal": "min",+ "xhigh": "high",+ "max": "high"+ }+ },+ {+ "id": "openai/whisper-1",+ "type": "ASR",+ "compat": {+ "response_format": "verbose_json"+ }+ }+ ],+ "siliconflow": [+ {+ "match": "deepseek-ai/DeepSeek-V4*",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "match": "Pro/deepseek-ai/DeepSeek-V4*",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Pro",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Flash",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "zai-org/GLM-5.2",+ "thinking_levels": {+ "minimal": "high",+ "low": "high",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "Pro/zai-org/GLM-5.1",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/zai-org/GLM-5",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.6",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.5",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-397B-A17B",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-122B-A10B",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Qwen/Qwen3.5-35B-A3B",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "deepseek-ai/DeepSeek-V3.2",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "Pro/MiniMaxAI/MiniMax-M2.5",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "BAAI/bge-m3",+ "type": "Embedding",+ "compat": {+ "dimensions_field": ""+ }+ }+ ],+ "volcengine": [+ {+ "id": "doubao-seed-2-0-pro-260215",+ "compat": {+ "fixed_temperature": 1+ }+ },+ {+ "id": "doubao-seed-1-6-flash-250828",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "doubao-seed-1-6-vision-250815",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-5-3-flash-260828",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "match": "doubao-embedding-text*",+ "type": "Embedding",+ "compat": {+ "api": "openai-embeddings",+ "dimensions_field": "",+ "max_batch_size": 4+ }+ },+ {+ "match": "doubao-embedding-large-text*",+ "type": "Embedding",+ "compat": {+ "api": "openai-embeddings",+ "dimensions_field": "",+ "max_batch_size": 4+ }+ }+ ],+ "zhipu": [+ {+ "id": "glm-5.3",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.3-flash",+ "thinking_levels": {+ "off": null,+ "minimal": "low",+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.2",+ "thinking_levels": {+ "low": "low",+ "medium": "high",+ "high": "high",+ "xhigh": "max",+ "max": "max"+ }+ },+ {+ "id": "glm-5.1",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-5",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-5v-turbo",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.7",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.7-flash",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.6v",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.6",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "glm-4.5-air",+ "compat": {+ "supports_reasoning_effort": false+ }+ },+ {+ "id": "embedding-3",+ "type": "Embedding",+ "compat": {+ "max_batch_size": 64+ }+ },+ {+ "id": "embedding-2",+ "type": "Embedding",+ "compat": {+ "dimensions_field": ""+ }+ }+ ]+ }+}diff --git a/internal/models/catalog/data/seed.json b/internal/models/catalog/data/seed.jsonnew file mode 100644index 000000000..0ba5aaa47--- /dev/null+++ b/internal/models/catalog/data/seed.json@@ -0,0 +1,4542 @@+{+ "version": 1,+ "providers": {+ "aliyun": [+ {+ "name": "Qwen3 family (hybrid thinking)",+ "match": "qwen3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "Qwen3.5 family (hybrid thinking)",+ "match": "qwen3.5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "Qwen3.6 family (hybrid thinking)",+ "match": "qwen3.6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "Qwen3.7 family (hybrid thinking)",+ "match": "qwen3.7*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "Qwen3.8 family (hybrid thinking)",+ "match": "qwen3.8*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "qwen-plus family (hybrid thinking)",+ "match": "qwen-plus*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "qwen-max family (hybrid thinking)",+ "match": "qwen-max*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "qwen-turbo family (hybrid thinking)",+ "match": "qwen-turbo*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "qwen-flash family (hybrid thinking)",+ "match": "qwen-flash*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "DeepSeek V3 family on DashScope (hybrid thinking)",+ "match": "deepseek-v3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "DeepSeek V4 family on DashScope (hybrid thinking)",+ "match": "deepseek-v4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "Kimi K2 family on DashScope (hybrid thinking)",+ "match": "kimi-k2*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "name": "GLM-5 family on DashScope (hybrid thinking)",+ "match": "glm-5*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.8-max",+ "name": "Qwen3.8 Max",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.77744,+ "output": 5.33231,+ "cache_read": 0.22218,+ "cache_write": 2.22179+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.8-flash",+ "name": "Qwen3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.11875,+ "output": 0.40073,+ "cache_read": 0.01187,+ "cache_write": 0.14844+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2.5,+ "output": 7.5,+ "cache_read": 0.5,+ "cache_write": 3.125+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.7-plus",+ "name": "Qwen3.7 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05,+ "cache_write": 0.625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.7-flash",+ "name": "Qwen3.7 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.02962,+ "output": 0.1185,+ "cache_read": 0.002962,+ "cache_write": 0.03703+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.6-plus",+ "name": "Qwen3.6 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05,+ "cache_write": 0.625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.6-flash",+ "name": "Qwen3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.1875,+ "output": 1.125,+ "cache_write": 0.234375+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.5-plus",+ "name": "Qwen3.5 Plus",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.287,+ "output": 1.722+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3.5-flash",+ "name": "Qwen3.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.172,+ "output": 1.033+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3-max",+ "name": "Qwen3 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.291,+ "output": 7.749+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen3-vl-plus",+ "name": "Qwen3 VL Plus",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.143353,+ "output": 1.433525+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-plus",+ "name": "Qwen Plus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.115,+ "output": 0.287,+ "cache_read": 0.012,+ "cache_write": 0.144+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-max",+ "name": "Qwen Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.345,+ "output": 1.377+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-turbo",+ "name": "Qwen Turbo",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.044,+ "output": 0.087+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-flash",+ "name": "Qwen Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.022,+ "output": 0.216+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-vl-max",+ "name": "Qwen VL Max",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.23,+ "output": 0.574+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwen-vl-plus",+ "name": "Qwen VL Plus",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.115,+ "output": 0.287+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwq-plus",+ "name": "QwQ Plus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.23,+ "output": 0.574+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "qwq-32b",+ "name": "QwQ 32B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 8192,+ "cost": {+ "input": 0.287,+ "output": 0.861+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.003625+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"+ },+ {+ "id": "deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.574,+ "output": 2.294+ },+ "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"+ },+ {+ "id": "kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1048576,+ "max_output_tokens": 1048576,+ "cost": {+ "input": 2.827,+ "output": 14.133,+ "cache_read": 0.283+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.929,+ "output": 3.858+ },+ "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"+ },+ {+ "id": "glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.1,+ "output": 3.851,+ "cache_read": 0.275+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3"+ },+ {+ "id": "qwen3.7-text-embedding",+ "name": "Qwen3.7 Text Embedding",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding"+ },+ {+ "id": "qwen3.7-text-embedding-flash",+ "name": "Qwen3.7 Text Embedding Flash",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding"+ },+ {+ "id": "text-embedding-v4",+ "name": "Tongyi text-embedding-v4",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding"+ },+ {+ "id": "text-embedding-v3",+ "name": "Tongyi text-embedding-v3",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://help.aliyun.com/zh/model-studio/embedding"+ },+ {+ "name": "text-embedding-v2 (fixed 1536 dimensions)",+ "match": "text-embedding-v2",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai"+ },+ {+ "name": "text-embedding-v1 (fixed 1536 dimensions)",+ "match": "text-embedding-v1",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai"+ },+ {+ "id": "tongyi-embedding-vision-plus",+ "name": "Tongyi Embedding Vision Plus",+ "type": "Embedding",+ "dimension": 1152,+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "name": "tongyi-embedding-vision-flash (fixed 768 dimensions)",+ "match": "tongyi-embedding-vision-flash",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "name": "tongyi-embedding-vision snapshots",+ "match": "tongyi-embedding-vision*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "name": "qwen3-vl-embedding (independent vectors by default)",+ "match": "qwen3-vl-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "name": "qwen2.5-vl-embedding (fused vectors only)",+ "match": "qwen2.5-vl-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "name": "multimodal-embedding-v1",+ "match": "multimodal-embedding*",+ "type": "Embedding",+ "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"+ },+ {+ "id": "qwen3-rerank",+ "name": "Qwen3 Rerank (separate endpoint, not implemented)",+ "type": "Rerank",+ "deprecated": true,+ "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"+ },+ {+ "id": "gte-rerank-v2",+ "name": "GTE Rerank v2",+ "type": "Rerank",+ "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"+ },+ {+ "id": "qwen3-asr-flash",+ "name": "Qwen3 ASR Flash",+ "type": "ASR",+ "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference"+ },+ {+ "name": "Other Alibaba recognition models (not callable with the audio in the request)",+ "match": "*",+ "type": "ASR",+ "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference"+ }+ ],+ "anthropic": [+ {+ "id": "claude-fable-5-1",+ "name": "Claude Fable 5.1",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 0.25,+ "cache_write": 12.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ },+ {+ "id": "claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models"+ },+ {+ "id": "claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 10,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ },+ {+ "id": "claude-fable-5",+ "name": "Claude Fable 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 1,+ "cache_write": 12.5+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ },+ {+ "id": "claude-opus-4-8",+ "name": "Claude Opus 4.8",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models"+ },+ {+ "id": "claude-opus-4-7",+ "name": "Claude Opus 4.7",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models"+ },+ {+ "id": "claude-sonnet-4-6",+ "name": "Claude Sonnet 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ },+ {+ "id": "claude-opus-4-6",+ "name": "Claude Opus 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ },+ {+ "id": "claude-opus-4-5",+ "name": "Claude Opus 4.5",+ "aliases": [+ "claude-opus-4-5-20251101"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://platform.claude.com/docs/en/build-with-claude/effort"+ },+ {+ "id": "claude-sonnet-4-5",+ "name": "Claude Sonnet 4.5",+ "aliases": [+ "claude-sonnet-4-5-20250929"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://platform.claude.com/docs/en/models/sonnet-4-5/overview"+ },+ {+ "id": "claude-haiku-4-5",+ "name": "Claude Haiku 4.5",+ "aliases": [+ "claude-haiku-4-5-20251001"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 64000,+ "cost": {+ "input": 1,+ "output": 5,+ "cache_read": 0.1,+ "cache_write": 1.25+ },+ "source": "https://docs.anthropic.com/en/docs/about-claude/models"+ }+ ],+ "azure_openai": [+ {+ "name": "GPT-6 deployments (reasoning, thinking always on)",+ "match": "gpt-6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "GPT-5 deployments (reasoning, no sampling parameters)",+ "match": "gpt-5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "id": "gpt-5",+ "name": "GPT-5 deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5"+ },+ {+ "id": "gpt-5-mini",+ "name": "GPT-5 Mini deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5-mini"+ },+ {+ "id": "gpt-5-nano",+ "name": "GPT-5 Nano deployment (thinking cannot be disabled)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models/gpt-5-nano"+ },+ {+ "name": "o1 deployments (always-on reasoning)",+ "match": "o1*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "o3 deployments (always-on reasoning)",+ "match": "o3*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "o4 deployments (always-on reasoning)",+ "match": "o4*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "GPT-4o deployments",+ "match": "gpt-4o*",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "GPT-4.1 deployments",+ "match": "gpt-4.1*",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ },+ {+ "name": "text-embedding-3 deployments",+ "match": "text-embedding-3*",+ "type": "Embedding",+ "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning"+ }+ ],+ "deepseek": [+ {+ "id": "deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.66,+ "output": 1.98,+ "cache_read": 0.022+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing"+ },+ {+ "id": "deepseek-flash",+ "name": "DeepSeek V4.1 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.003+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing"+ },+ {+ "id": "deepseek-v4-flash",+ "name": "DeepSeek V4 Flash (retired name, served by V4.1 Flash)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.003+ },+ "source": "https://api-docs.deepseek.com/quick_start/pricing"+ },+ {+ "id": "deepseek-chat",+ "name": "DeepSeek Chat (retired 2026-07-24, non-thinking alias)",+ "deprecated": true,+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 8192,+ "source": "https://api-docs.deepseek.com/news/news260424/"+ },+ {+ "id": "deepseek-reasoner",+ "name": "DeepSeek Reasoner (retired 2026-07-24, thinking alias)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 65536,+ "source": "https://api-docs.deepseek.com/news/news260424/"+ }+ ],+ "gemini": [+ {+ "name": "Gemini 3 family (thinkingLevel)",+ "match": "gemini-3*",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.8-flash",+ "name": "Gemini 3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.7-flash",+ "name": "Gemini 3.7 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.6-flash",+ "name": "Gemini 3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.5-flash",+ "name": "Gemini 3.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.5,+ "output": 9,+ "cache_read": 0.15+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.5-flash-lite",+ "name": "Gemini 3.5 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.3,+ "output": 2.5,+ "cache_read": 0.03+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3.1-flash-lite",+ "name": "Gemini 3.1 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.25,+ "output": 1.5,+ "cache_read": 0.025+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-3-flash-preview",+ "name": "Gemini 3 Flash Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 3,+ "cache_read": 0.05+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-2.5-pro",+ "name": "Gemini 2.5 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-2.5-flash",+ "name": "Gemini 2.5 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.3,+ "output": 2.5,+ "cache_read": 0.03+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-2.5-flash-lite",+ "name": "Gemini 2.5 Flash Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.1,+ "output": 0.4,+ "cache_read": 0.01+ },+ "source": "https://ai.google.dev/gemini-api/docs/thinking"+ },+ {+ "id": "gemini-embedding-001",+ "name": "Gemini Embedding 001",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 2048,+ "cost": {+ "input": 0.15,+ "output": 0+ },+ "source": "https://ai.google.dev/gemini-api/docs/embeddings"+ },+ {+ "id": "gemini-embedding-2",+ "name": "Gemini Embedding 2",+ "aliases": [+ "gemini-embedding-2-preview"+ ],+ "type": "Embedding",+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "dimension": 3072,+ "context_window": 8192,+ "cost": {+ "input": 0.2,+ "output": 0+ },+ "source": "https://ai.google.dev/gemini-api/docs/embeddings"+ }+ ],+ "generic": [+ {+ "match": "gpt-5*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning"+ },+ {+ "match": "o1*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning"+ },+ {+ "match": "o3*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning"+ },+ {+ "match": "o4*",+ "reasoning": true,+ "source": "https://platform.openai.com/docs/guides/reasoning"+ }+ ],+ "gpustack": [],+ "hunyuan": [+ {+ "name": "Hunyuan T1 family (always-on reasoning)",+ "match": "hunyuan-t1*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-t1-latest",+ "name": "Hunyuan T1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-t1-vision-20250916",+ "name": "Hunyuan T1 Vision (deep thinking)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 28000,+ "max_output_tokens": 20000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-turbos-latest",+ "name": "Hunyuan TurboS",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "max_output_tokens": 8000,+ "cost": {+ "input": 0.11,+ "output": 0.28+ },+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-a13b",+ "name": "Hunyuan A13B (hybrid thinking)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 224000,+ "max_output_tokens": 32000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-2.0-thinking-20251109",+ "name": "Hunyuan 2.0 Thinking",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/127293"+ },+ {+ "id": "hunyuan-2.0-instruct-20251111",+ "name": "Hunyuan 2.0 Instruct",+ "reasoning": false,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1729/127293"+ },+ {+ "id": "hunyuan-vision-1.5-instruct",+ "name": "Hunyuan Vision 1.5 Instruct (fast thinking)",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 24000,+ "max_output_tokens": 16000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-turbos-vision-video",+ "name": "Hunyuan TurboS Vision Video",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 24000,+ "max_output_tokens": 8000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-turbos-vision",+ "name": "Hunyuan TurboS Vision",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 32000,+ "max_output_tokens": 8000,+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-lite",+ "name": "Hunyuan Lite",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 6000,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://cloud.tencent.com/document/product/1729/104753"+ },+ {+ "id": "hunyuan-embedding",+ "name": "Hunyuan Embedding",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.tencent.com/document/product/1729/111007"+ }+ ],+ "jina": [+ {+ "id": "jina-embeddings-v5-omni-small",+ "name": "Jina Embeddings v5 Omni Small (multimodal)",+ "type": "Embedding",+ "input": [+ "text",+ "image"+ ],+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-omni-nano",+ "name": "Jina Embeddings v5 Omni Nano (multimodal)",+ "type": "Embedding",+ "input": [+ "text",+ "image"+ ],+ "dimension": 768,+ "context_window": 8192,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-text-small",+ "name": "Jina Embeddings v5 Text Small",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v5-text-nano",+ "name": "Jina Embeddings v5 Text Nano",+ "type": "Embedding",+ "dimension": 768,+ "context_window": 8192,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-embeddings-v4",+ "name": "Jina Embeddings v4",+ "type": "Embedding",+ "dimension": 2048,+ "context_window": 32768,+ "source": "https://jina.ai/models/jina-embeddings-v4/"+ },+ {+ "id": "jina-embeddings-v3",+ "name": "Jina Embeddings v3",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 8192,+ "source": "https://jina.ai/models/jina-embeddings-v3/"+ },+ {+ "id": "jina-code-embeddings-1.5b",+ "name": "Jina Code Embeddings 1.5B",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-code-embeddings-0.5b",+ "name": "Jina Code Embeddings 0.5B",+ "type": "Embedding",+ "dimension": 896,+ "context_window": 32768,+ "source": "https://jina.ai/models/"+ },+ {+ "id": "jina-reranker-v3.5",+ "name": "Jina Reranker v3.5",+ "type": "Rerank",+ "context_window": 131072,+ "source": "https://jina.ai/reranker/"+ },+ {+ "id": "jina-reranker-v3",+ "name": "Jina Reranker v3",+ "type": "Rerank",+ "context_window": 131072,+ "source": "https://jina.ai/models/jina-reranker-v3/"+ },+ {+ "id": "jina-reranker-m0",+ "name": "Jina Reranker m0 (multimodal)",+ "type": "Rerank",+ "context_window": 10000,+ "source": "https://jina.ai/reranker/"+ },+ {+ "id": "jina-reranker-v2-base-multilingual",+ "name": "Jina Reranker v2 Base Multilingual",+ "type": "Rerank",+ "context_window": 1024,+ "source": "https://jina.ai/reranker/"+ }+ ],+ "litellm": [],+ "lkeap": [+ {+ "name": "DeepSeek R1 family (always-on reasoning)",+ "match": "*deepseek-r1*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "name": "DeepSeek V3 family (thinking switch)",+ "match": "*deepseek-v3*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.2",+ "name": "DeepSeek V3.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.1-terminus",+ "name": "DeepSeek V3.1 Terminus",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-r1-0528",+ "name": "DeepSeek R1 (0528)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3-0324",+ "name": "DeepSeek V3 (0324)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 65536,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3",+ "name": "DeepSeek V3",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 65536,+ "max_output_tokens": 16384,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "deepseek-v3.1",+ "name": "DeepSeek V3.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "source": "https://cloud.tencent.com/document/product/1772/115963"+ },+ {+ "id": "lke-reranker-base",+ "name": "LKE Reranker Base",+ "type": "Rerank",+ "source": "https://cloud.tencent.com/document/product/1772/115339"+ }+ ],+ "longcat": [+ {+ "id": "LongCat-2.0",+ "name": "LongCat 2.0",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.75,+ "output": 2.95,+ "cache_read": 0.015+ },+ "source": "https://longcat.chat/platform/docs/zh/api/chat.html"+ },+ {+ "id": "LongCat-Flash-Chat",+ "name": "LongCat Flash Chat (retired 2026-05-29)",+ "deprecated": true,+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 8192,+ "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html"+ },+ {+ "id": "LongCat-Flash-Thinking",+ "name": "LongCat Flash Thinking (retired 2026-05-29)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 65536,+ "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html"+ }+ ],+ "mimo": [+ {+ "id": "mimo-v2.5-pro",+ "name": "MiMo V2.5 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.0036+ },+ "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"+ },+ {+ "id": "mimo-v2.5",+ "name": "MiMo V2.5",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"+ },+ {+ "id": "mimo-v2.5-pro-ultraspeed",+ "name": "MiMo V2.5 Pro Ultraspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.305,+ "output": 2.61,+ "cache_read": 0.0108+ },+ "source": "https://mimo.mi.com/static/docs/news/latest/beta-extended.md"+ },+ {+ "id": "mimo-v2-flash",+ "name": "MiMo V2 Flash (retired 2026-06-30)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.1,+ "output": 0.3,+ "cache_read": 0.01+ },+ "deprecated": true,+ "source": "https://mimo.mi.com/static/docs/updates/deprecate.md"+ },+ {+ "id": "mimo-v2.5-asr",+ "name": "MiMo V2.5 ASR",+ "type": "ASR",+ "source": "https://mimo.mi.com/docs/en-US/quick-start/usage-guide/audio/Speech-Recognition"+ }+ ],+ "minimax": [+ {+ "id": "MiniMax-M3",+ "name": "MiniMax M3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 512000,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://platform.minimax.io/docs/guides/text-generation"+ },+ {+ "id": "MiniMax-M2.7",+ "name": "MiniMax M2.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "MiniMax-M2.7-highspeed",+ "name": "MiniMax M2.7 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.4,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "MiniMax-M2.5",+ "name": "MiniMax M2.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.03,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "MiniMax-M2.5-highspeed",+ "name": "MiniMax M2.5 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.4,+ "cache_read": 0.06,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "MiniMax-M2.1",+ "name": "MiniMax M2.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.03,+ "cache_write": 0.375+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "MiniMax-M2.1-highspeed",+ "name": "MiniMax M2.1 Highspeed",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "source": "https://platform.minimax.io/docs/guides/text-generation"+ },+ {+ "id": "MiniMax-M2",+ "name": "MiniMax M2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "asr-1.0",+ "name": "MiniMax ASR 1.0",+ "type": "ASR",+ "source": "https://platform.minimax.io/docs/api-reference/speech-to-text"+ }+ ],+ "modelscope": [+ {+ "id": "ZhipuAI/GLM-4.6",+ "name": "GLM-4.6",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 202752,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.6"+ },+ {+ "id": "ZhipuAI/GLM-4.5",+ "name": "GLM-4.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.5"+ },+ {+ "id": "Qwen/Qwen3-235B-A22B-Instruct-2507",+ "name": "Qwen3 235B-A22B Instruct 2507",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Instruct-2507"+ },+ {+ "id": "Qwen/Qwen3-235B-A22B-Thinking-2507",+ "name": "Qwen3 235B-A22B Thinking 2507",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Thinking-2507"+ },+ {+ "id": "Qwen/Qwen3-30B-A3B-Instruct-2507",+ "name": "Qwen3 30B-A3B Instruct 2507",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Instruct-2507"+ },+ {+ "id": "Qwen/Qwen3-30B-A3B-Thinking-2507",+ "name": "Qwen3 30B-A3B Thinking 2507",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Thinking-2507"+ },+ {+ "id": "Qwen/Qwen3-Coder-30B-A3B-Instruct",+ "name": "Qwen3 Coder 30B-A3B Instruct",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Coder-30B-A3B-Instruct"+ },+ {+ "id": "Qwen/Qwen3-8B",+ "name": "Qwen3 8B (hybrid thinking)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-8B"+ },+ {+ "id": "Qwen/Qwen3-VL-235B-A22B-Instruct",+ "name": "Qwen3 VL 235B-A22B Instruct",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://modelscope.cn/models/Qwen/Qwen3-VL-235B-A22B-Instruct"+ },+ {+ "id": "Qwen/Qwen3-Embedding-8B",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-8B"+ },+ {+ "id": "Qwen/Qwen3-Embedding-0.6B",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-0.6B"+ }+ ],+ "moonshot": [+ {+ "id": "kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k3-quickstart"+ },+ {+ "id": "kimi-k2.7-code",+ "name": "Kimi K2.7 Code",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.19+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart"+ },+ {+ "id": "kimi-k2.7-code-highspeed",+ "name": "Kimi K2.7 Code Highspeed",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 1.9,+ "output": 8,+ "cache_read": 0.38+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart"+ },+ {+ "id": "kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.16+ },+ "source": "https://platform.kimi.com/docs/guide/kimi-k2-6-quickstart"+ },+ {+ "name": "moonshot-v1 family (retired 2026-08-31)",+ "match": "moonshot-v1*",+ "reasoning": false,+ "input": [+ "text"+ ],+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "kimi-k2.5",+ "name": "Kimi K2.5 (retired 2026-08-31)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.6,+ "output": 3,+ "cache_read": 0.1+ },+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "kimi-k2-thinking",+ "name": "Kimi K2 Thinking (retired 2026-08-31)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.574,+ "output": 2.294+ },+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "kimi-k2-turbo-preview",+ "name": "Kimi K2 Turbo (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 16384,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "moonshot-v1-8k",+ "name": "Moonshot v1 8K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 8192,+ "max_output_tokens": 8192,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "moonshot-v1-32k",+ "name": "Moonshot v1 32K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 32768,+ "max_output_tokens": 32768,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "moonshot-v1-128k",+ "name": "Moonshot v1 128K (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 131072,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ },+ {+ "id": "moonshot-v1-8k-vision-preview",+ "name": "Moonshot v1 8K Vision (retired 2026-08-31)",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 8192,+ "max_output_tokens": 8192,+ "deprecated": true,+ "source": "https://platform.kimi.com/docs/models"+ }+ ],+ "novita": [+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 1048576,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "zai-org/glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "zai-org/glm-5.1",+ "name": "GLM-5.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.38,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "deepseek/deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 1.6,+ "output": 3.2,+ "cache_read": 0.135+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "deepseek/deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.028+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "moonshotai/kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.8,+ "output": 3.4,+ "cache_read": 0.16+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "moonshotai/kimi-k2.7-code",+ "name": "Kimi K2.7 Code",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.19+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 1.25,+ "output": 3.75,+ "cache_read": 0.25,+ "cache_write": 1.5625+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3.5-397b-a17b",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.6,+ "output": 3.6+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "minimax/minimax-m2.7",+ "name": "MiniMax M2.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "xiaomimimo/mimo-v2.5-pro",+ "name": "MiMo V2.5 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.522,+ "output": 1.044,+ "cache_read": 0.0043+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "google/gemma-4-31b-it",+ "name": "Gemma 4 31B IT",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.14,+ "output": 0.4+ },+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3-embedding-0.6b",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 32768,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "qwen/qwen3-embedding-8b",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "context_window": 32768,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ },+ {+ "id": "baai/bge-m3",+ "name": "BGE-M3",+ "type": "Embedding",+ "dimension": 1024,+ "context_window": 8192,+ "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api"+ }+ ],+ "nvidia": [+ {+ "id": "nvidia/nemotron-3-ultra-550b-a55b",+ "name": "Nemotron 3 Ultra 550B-A55B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.5,+ "output": 2.5,+ "cache_read": 0.15+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nemotron-3-super-120b-a12b",+ "name": "Nemotron 3 Super 120B-A12B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0.2,+ "output": 0.8+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nemotron-3.5-lightning-30b-a3b",+ "name": "Nemotron 3.5 Lightning 30B-A3B",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "z-ai/glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "deepseek-ai/deepseek-v4-pro-0813",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.435,+ "output": 0.87,+ "cache_read": 0.003625+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "deepseek-ai/deepseek-v4-flash-0731",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.0028+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "moonshotai/kimi-k2.6",+ "name": "Kimi K2.6",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 262144,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "google/gemma-4-31b-it",+ "name": "Gemma 4 31B IT",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nemotron-3-embed-1b",+ "name": "Nemotron 3 Embed 1B",+ "type": "Embedding",+ "dimension": 2048,+ "context_window": 4096,+ "source": "https://docs.api.nvidia.com/nim/reference/nvidia-nemotron-3-embed-1b-infer"+ },+ {+ "id": "nvidia/llama-nemotron-rerank-vl-1b-v2",+ "name": "Llama Nemotron Rerank VL 1B v2",+ "type": "Rerank",+ "source": "https://build.nvidia.com"+ },+ {+ "id": "nvidia/nv-rerankqa-mistral-4b-v3",+ "name": "NV-RerankQA Mistral 4B v3",+ "type": "Rerank",+ "source": "https://build.nvidia.com"+ }+ ],+ "openai": [+ {+ "name": "GPT-6 family (reasoning, no sampling parameters, thinking always on)",+ "match": "gpt-6*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/guides/latest-model"+ },+ {+ "name": "GPT-5 family (reasoning, no sampling parameters)",+ "match": "gpt-5*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/guides/reasoning"+ },+ {+ "name": "o1 family (always-on reasoning)",+ "match": "o1*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "name": "o3 family (always-on reasoning)",+ "match": "o3*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "name": "o4 family (always-on reasoning)",+ "match": "o4*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-6-astra",+ "name": "GPT-6 Astra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 10,+ "output": 50,+ "cache_read": 1,+ "cache_write": 12.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.6-terra",+ "name": "GPT-5.6 Terra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.6-sol",+ "name": "GPT-5.6 Sol",+ "aliases": [+ "gpt-5.6"+ ],+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 4,+ "output": 20,+ "cache_read": 0.4,+ "cache_write": 5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.6-luna",+ "name": "GPT-5.6 Luna",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.2,+ "output": 1.2,+ "cache_read": 0.02,+ "cache_write": 0.25+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 30,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2.5,+ "output": 15,+ "cache_read": 0.25+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.4-mini",+ "name": "GPT-5.4 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.75,+ "output": 4.5,+ "cache_read": 0.075+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.4-nano",+ "name": "GPT-5.4 Nano",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.2,+ "output": 1.25,+ "cache_read": 0.02+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.2",+ "name": "GPT-5.2",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.75,+ "output": 14,+ "cache_read": 0.175+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5.1",+ "name": "GPT-5.1",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5",+ "name": "GPT-5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 1.25,+ "output": 10,+ "cache_read": 0.125+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5-mini",+ "name": "GPT-5 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.25,+ "output": 2,+ "cache_read": 0.025+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-5-nano",+ "name": "GPT-5 Nano",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 400000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 0.05,+ "output": 0.4,+ "cache_read": 0.005+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "o3",+ "name": "o3",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 200000,+ "max_output_tokens": 100000,+ "cost": {+ "input": 2,+ "output": 8,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4.1",+ "name": "GPT-4.1",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1047576,+ "max_output_tokens": 32768,+ "cost": {+ "input": 2,+ "output": 8,+ "cache_read": 0.5+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4.1-mini",+ "name": "GPT-4.1 Mini",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1047576,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.4,+ "output": 1.6,+ "cache_read": 0.1+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4o",+ "name": "GPT-4o",+ "aliases": [+ "gpt-4o-2024-11-20",+ "gpt-4o-2024-08-06"+ ],+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 2.5,+ "output": 10,+ "cache_read": 1.25+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "gpt-4o-mini",+ "name": "GPT-4o Mini",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 16384,+ "cost": {+ "input": 0.15,+ "output": 0.6,+ "cache_read": 0.075+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "text-embedding-3-small",+ "name": "text-embedding-3-small",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8191,+ "cost": {+ "input": 0.02,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "text-embedding-3-large",+ "name": "text-embedding-3-large",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 8191,+ "cost": {+ "input": 0.13,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models"+ },+ {+ "id": "whisper-1",+ "name": "Whisper",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "gpt-transcribe",+ "name": "GPT Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "gpt-4o-transcribe",+ "name": "GPT-4o Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "gpt-4o-mini-transcribe",+ "name": "GPT-4o mini Transcribe",+ "type": "ASR",+ "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"+ },+ {+ "id": "text-embedding-ada-002",+ "name": "text-embedding-ada-002",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8192,+ "cost": {+ "input": 0.1,+ "output": 0+ },+ "source": "https://developers.openai.com/api/docs/models"+ }+ ],+ "openrouter": [+ {+ "name": "Anthropic models (cache_control breakpoints, thinking always on)",+ "match": "anthropic/*",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "openai/gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 30,+ "cache_read": 0.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "openai/gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2.5,+ "output": 15,+ "cache_read": 0.25+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "anthropic/claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 5,+ "output": 25,+ "cache_read": 0.5,+ "cache_write": 6.25+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 2,+ "output": 10,+ "cache_read": 0.2,+ "cache_write": 2.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "anthropic/claude-sonnet-4.6",+ "name": "Claude Sonnet 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3,+ "cache_write": 3.75+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "google/gemini-3.8-flash",+ "name": "Gemini 3.8 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.75,+ "output": 3.75,+ "cache_read": 0.075,+ "cache_write": 0.041667+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "cost": {+ "input": 2,+ "output": 12,+ "cache_read": 0.2,+ "cache_write": 0.375+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "deepseek/deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 384000,+ "cost": {+ "input": 1.6,+ "output": 3.2,+ "cache_read": 0.135+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "deepseek/deepseek-v4-flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.07,+ "output": 0.14,+ "cache_read": 0.014+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "z-ai/glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1310720,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "moonshotai/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 943718,+ "cost": {+ "input": 3,+ "output": 15,+ "cache_read": 0.3+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "qwen/qwen3.7-max",+ "name": "Qwen3.7 Max",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.475,+ "output": 4.425,+ "cache_read": 0.295,+ "cache_write": 1.84375+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "minimax/minimax-m3",+ "name": "MiniMax M3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 512000,+ "cost": {+ "input": 0.3,+ "output": 1.2,+ "cache_read": 0.06+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "x-ai/grok-4.6",+ "name": "Grok 4.6",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 500000,+ "max_output_tokens": 450000,+ "cost": {+ "input": 2,+ "output": 6,+ "cache_read": 0.5+ },+ "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens"+ },+ {+ "id": "openai/text-embedding-3-small",+ "name": "text-embedding-3-small",+ "type": "Embedding",+ "dimension": 1536,+ "context_window": 8192,+ "source": "https://openrouter.ai/docs/api_reference/embeddings"+ },+ {+ "id": "openai/text-embedding-3-large",+ "name": "text-embedding-3-large",+ "type": "Embedding",+ "dimension": 3072,+ "context_window": 8192,+ "source": "https://openrouter.ai/docs/api_reference/embeddings"+ },+ {+ "id": "cohere/rerank-v3.5",+ "name": "Cohere Rerank v3.5",+ "type": "Rerank",+ "source": "https://openrouter.ai/docs/api/api-reference/rerank/submit-a-rerank-request"+ },+ {+ "id": "openai/whisper-large-v3",+ "name": "Whisper Large v3",+ "type": "ASR",+ "source": "https://openrouter.ai/docs/api/api-reference/stt/create-transcription"+ }+ ],+ "qianfan": [+ {+ "id": "ernie-5.0-thinking-preview",+ "name": "ERNIE 5.0 Thinking Preview",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 128000,+ "max_output_tokens": 65536,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv"+ },+ {+ "id": "ernie-4.5-turbo-128k",+ "name": "ERNIE 4.5 Turbo 128K",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 12288,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ },+ {+ "id": "ernie-4.5-turbo-vl-32k",+ "name": "ERNIE 4.5 Turbo VL 32K",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 32000,+ "max_output_tokens": 12288,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ },+ {+ "id": "ernie-x1-turbo-32k",+ "name": "ERNIE X1 Turbo 32K",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 32000,+ "max_output_tokens": 16000,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ },+ {+ "id": "deepseek-v3.2",+ "name": "DeepSeek V3.2 (Qianfan)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv"+ },+ {+ "id": "embedding-v1",+ "name": "Embedding-V1",+ "type": "Embedding",+ "dimension": 384,+ "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"+ },+ {+ "id": "bge-large-zh",+ "name": "BGE Large ZH",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"+ },+ {+ "id": "tao-8k",+ "name": "Tao-8K",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://cloud.baidu.com/doc/qianfan/s/rmh4stp0j"+ },+ {+ "id": "bce-reranker-base",+ "name": "BCE Reranker Base",+ "type": "Rerank",+ "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43"+ }+ ],+ "qiniu": [+ {+ "id": "qwen3.5-397b-a17b",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 64000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "z-ai/glm-5",+ "name": "GLM-5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "z-ai/glm-4.7",+ "name": "GLM-4.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 200000,+ "source": "https://api.qnaigc.com/v1/market/models"+ },+ {+ "id": "minimax/minimax-m2.5",+ "name": "MiniMax M2.5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "doubao-seed-2.0-pro",+ "name": "Doubao Seed 2.0 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 128000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "moonshotai/kimi-k2.5",+ "name": "Kimi K2.5",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "xiaomi/mimo-v2-flash",+ "name": "MiMo V2 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.1,+ "output": 0.3,+ "cache_read": 0.01+ },+ "source": "https://www.qiniu.com/ai/models"+ },+ {+ "id": "deepseek/deepseek-v3.2-251201",+ "name": "DeepSeek V3.2 (251201)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://apidocs.qnaigc.com/397639742e0"+ },+ {+ "id": "deepseek-r1",+ "name": "DeepSeek R1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 32000,+ "source": "https://api.qnaigc.com/v1/market/models"+ },+ {+ "id": "deepseek-v3",+ "name": "DeepSeek V3",+ "reasoning": false,+ "input": [+ "text"+ ],+ "context_window": 128000,+ "max_output_tokens": 16000,+ "source": "https://www.qiniu.com/ai/models"+ }+ ],+ "requesty": [+ {+ "id": "openai/gpt-6-astra",+ "name": "GPT-6 Astra",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "openai/gpt-5.5",+ "name": "GPT-5.5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "openai/gpt-5.4",+ "name": "GPT-5.4",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1050000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "anthropic/claude-opus-5",+ "name": "Claude Opus 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "anthropic/claude-sonnet-5",+ "name": "Claude Sonnet 5",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 128000,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "vertex/gemini-3.8-flash",+ "name": "Gemini 3.8 Flash (Vertex)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "google/gemini-3.1-pro-preview",+ "name": "Gemini 3.1 Pro Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "google/gemini-3.6-flash",+ "name": "Gemini 3.6 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "audio",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 65536,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "deepseek/deepseek-v4-pro-0813",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "zai/glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1048576,+ "max_output_tokens": 131072,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "moonshot/kimi-k3",+ "name": "Kimi K3",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1048576,+ "max_output_tokens": 262144,+ "source": "https://docs.requesty.ai/frameworks/openai"+ },+ {+ "id": "openai/gpt-4o-transcribe",+ "name": "GPT-4o Transcribe",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"+ },+ {+ "id": "openai/gpt-4o-mini-transcribe",+ "name": "GPT-4o mini Transcribe",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"+ },+ {+ "id": "openai/whisper-1",+ "name": "Whisper",+ "type": "ASR",+ "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"+ }+ ],+ "siliconflow": [+ {+ "name": "DeepSeek V4 family (reasoning_effort high | max)",+ "match": "deepseek-ai/DeepSeek-V4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "name": "DeepSeek V4 Pro-tier family (reasoning_effort high | max)",+ "match": "Pro/deepseek-ai/DeepSeek-V4*",+ "reasoning": true,+ "input": [+ "text"+ ],+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Pro",+ "name": "DeepSeek V4 Pro",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1049000,+ "max_output_tokens": 393000,+ "cost": {+ "input": 1.74,+ "output": 3.48,+ "cache_read": 0.145+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "deepseek-ai/DeepSeek-V4-Flash",+ "name": "DeepSeek V4 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 384000,+ "cost": {+ "input": 0.14,+ "output": 0.28,+ "cache_read": 0.003+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "zai-org/GLM-5.2",+ "name": "GLM-5.2",+ "aliases": [+ "Pro/zai-org/GLM-5.2"+ ],+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1049000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Pro/zai-org/GLM-5.1",+ "name": "GLM-5.1 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 205000,+ "max_output_tokens": 205000,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Pro/zai-org/GLM-5",+ "name": "GLM-5 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 205000,+ "max_output_tokens": 205000,+ "cost": {+ "input": 1,+ "output": 3.2+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.6",+ "name": "Kimi K2.6 (Pro)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.95,+ "output": 4,+ "cache_read": 0.16+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Pro/moonshotai/Kimi-K2.5",+ "name": "Kimi K2.5 (Pro)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.45,+ "output": 2.25,+ "cache_read": 0.07+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Qwen/Qwen3.5-397B-A17B",+ "name": "Qwen3.5 397B-A17B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.29,+ "output": 1.74+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Qwen/Qwen3.5-122B-A10B",+ "name": "Qwen3.5 122B-A10B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.29,+ "output": 2.32+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Qwen/Qwen3.5-35B-A3B",+ "name": "Qwen3.5 35B-A3B",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.23,+ "output": 1.86+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Qwen/Qwen3.6-35B-A3B",+ "name": "Qwen3.6 35B-A3B",+ "reasoning": false,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 65536,+ "cost": {+ "input": 0.23,+ "output": 1.86+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "deepseek-ai/DeepSeek-V3.2",+ "name": "DeepSeek V3.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 164000,+ "max_output_tokens": 164000,+ "cost": {+ "input": 0.27,+ "output": 0.42+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "Pro/MiniMaxAI/MiniMax-M2.5",+ "name": "MiniMax M2.5 (Pro)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131000,+ "cost": {+ "input": 0.3,+ "output": 1.22+ },+ "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"+ },+ {+ "id": "Qwen/Qwen3-VL-32B-Instruct",+ "name": "Qwen3 VL 32B Instruct",+ "reasoning": false,+ "input": [+ "text",+ "image"+ ],+ "context_window": 262000,+ "max_output_tokens": 262000,+ "cost": {+ "input": 0.2,+ "output": 0.6+ },+ "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions"+ },+ {+ "id": "BAAI/bge-m3",+ "name": "BGE-M3",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "Qwen/Qwen3-Embedding-8B",+ "name": "Qwen3 Embedding 8B",+ "type": "Embedding",+ "dimension": 4096,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "Qwen/Qwen3-Embedding-4B",+ "name": "Qwen3 Embedding 4B",+ "type": "Embedding",+ "dimension": 2560,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "Qwen/Qwen3-Embedding-0.6B",+ "name": "Qwen3 Embedding 0.6B",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"+ },+ {+ "id": "BAAI/bge-reranker-v2-m3",+ "name": "BGE Reranker v2 M3",+ "type": "Rerank",+ "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"+ },+ {+ "id": "Qwen/Qwen3-Reranker-8B",+ "name": "Qwen3 Reranker 8B",+ "type": "Rerank",+ "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"+ },+ {+ "id": "FunAudioLLM/SenseVoiceSmall",+ "name": "SenseVoice Small",+ "type": "ASR",+ "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"+ },+ {+ "id": "TeleAI/TeleSpeechASR",+ "name": "TeleSpeechASR",+ "type": "ASR",+ "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"+ }+ ],+ "volcengine": [+ {+ "id": "doubao-seed-2-1-pro-260915",+ "name": "Doubao Seed 2.1 Pro (260915)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1024000,+ "max_output_tokens": 256000,+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-2-1-pro-260628",+ "name": "Doubao Seed 2.1 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.8906,+ "output": 4.45301,+ "cache_read": 0.17812+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-1-turbo-260628",+ "name": "Doubao Seed 2.1 Turbo",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 256000,+ "cost": {+ "input": 0.4453,+ "output": 2.22651,+ "cache_read": 0.08906+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-pro-260215",+ "name": "Doubao Seed 2.0 Pro",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.47499,+ "output": 2.37494,+ "cache_read": 0.095+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-2-0-lite-260428",+ "name": "Doubao Seed 2.0 Lite",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.08906,+ "output": 0.53436,+ "cache_read": 0.01781+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-mini-260428",+ "name": "Doubao Seed 2.0 Mini",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 256000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.02969,+ "output": 0.29687,+ "cache_read": 0.00594+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-2-0-code-preview-260215",+ "name": "Doubao Seed 2.0 Code Preview",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 262144,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.47499,+ "output": 2.37494,+ "cache_read": 0.095+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "doubao-seed-1-8-251228",+ "name": "Doubao Seed 1.8 (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-1-6-251015",+ "name": "Doubao Seed 1.6 (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "doubao-seed-1-6-flash-250828",+ "name": "Doubao Seed 1.6 Flash (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.02227,+ "output": 0.22265,+ "cache_read": 0.00445+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"+ },+ {+ "id": "doubao-seed-1-6-vision-250815",+ "name": "Doubao Seed 1.6 Vision (retiring)",+ "deprecated": true,+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 256000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.11875,+ "output": 1.18747,+ "cache_read": 0.02375+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"+ },+ {+ "id": "deepseek-v4-1-flash-260910",+ "name": "DeepSeek V4.1 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text",+ "image"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"+ },+ {+ "id": "deepseek-v4-pro-ga-260813",+ "name": "DeepSeek V4 Pro (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 1.3359,+ "output": 4.00771,+ "cache_read": 0.04453+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "deepseek-v4-flash-ga-260731",+ "name": "DeepSeek V4 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 393216,+ "cost": {+ "input": 0.4453,+ "output": 1.3359,+ "cache_read": 0.01484+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "id": "glm-5-3-flash-260828",+ "name": "GLM-5.3 Flash (Ark)",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.11875,+ "output": 0.41563,+ "cache_read": 0.03414+ },+ "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"+ },+ {+ "id": "glm-5-2-260617",+ "name": "GLM-5.2 (Ark)",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.18747,+ "output": 4.15615,+ "cache_read": 0.29687+ },+ "source": "https://www.volcengine.com/docs/82379/1494384"+ },+ {+ "name": "Retired doubao-embedding text models",+ "match": "doubao-embedding-text*",+ "type": "Embedding",+ "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh"+ },+ {+ "name": "Retired doubao-embedding-large text models",+ "match": "doubao-embedding-large-text*",+ "type": "Embedding",+ "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh"+ },+ {+ "id": "doubao-embedding-vision-251215",+ "name": "Doubao Embedding Vision (251215)",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"+ },+ {+ "id": "doubao-embedding-vision-250615",+ "name": "Doubao Embedding Vision",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"+ },+ {+ "id": "doubao-seed-rerank",+ "name": "Doubao Seed Rerank",+ "type": "Rerank",+ "source": "https://www.volcengine.com/docs/84313/1254474"+ },+ {+ "id": "base-multilingual-rerank",+ "name": "Base Multilingual Rerank",+ "type": "Rerank",+ "source": "https://www.volcengine.com/docs/84313/1254474"+ }+ ],+ "weknoracloud": [],+ "zhipu": [+ {+ "id": "glm-5.3",+ "name": "GLM-5.3",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3"+ },+ {+ "id": "glm-5.3-flash",+ "name": "GLM-5.3 Flash",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.075,+ "output": 0.25,+ "cache_read": 0.015+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/vlm/glm-5.3-flash"+ },+ {+ "id": "glm-5.2",+ "name": "GLM-5.2",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 1000000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.2"+ },+ {+ "id": "glm-5.1",+ "name": "GLM-5.1",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1.4,+ "output": 4.4,+ "cache_read": 0.26+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-5",+ "name": "GLM-5",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 1,+ "output": 3.2,+ "cache_read": 0.2+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-5v-turbo",+ "name": "GLM-5V Turbo",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 5,+ "output": 22,+ "cache_read": 1.2+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-4.7",+ "name": "GLM-4.7",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.2,+ "cache_read": 0.11+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-4.7-flash",+ "name": "GLM-4.7 Flash",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 200000,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0,+ "output": 0+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-4.6v",+ "name": "GLM-4.6V",+ "reasoning": true,+ "input": [+ "text",+ "image",+ "video"+ ],+ "context_window": 128000,+ "max_output_tokens": 32768,+ "cost": {+ "input": 0.3,+ "output": 0.9+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-4.6",+ "name": "GLM-4.6",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 204800,+ "max_output_tokens": 131072,+ "cost": {+ "input": 0.6,+ "output": 2.2,+ "cache_read": 0.11+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "glm-4.5-air",+ "name": "GLM-4.5 Air",+ "reasoning": true,+ "input": [+ "text"+ ],+ "context_window": 131072,+ "max_output_tokens": 98304,+ "cost": {+ "input": 0.2,+ "output": 1.1,+ "cache_read": 0.03+ },+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全"+ },+ {+ "id": "embedding-3",+ "name": "Embedding-3",+ "type": "Embedding",+ "dimension": 2048,+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入"+ },+ {+ "id": "embedding-2",+ "name": "Embedding-2",+ "type": "Embedding",+ "dimension": 1024,+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入"+ },+ {+ "id": "rerank",+ "name": "Rerank",+ "type": "Rerank",+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本重排序"+ },+ {+ "id": "glm-asr-2512",+ "name": "GLM-ASR-2512 (at most 30 s per file)",+ "type": "ASR",+ "source": "https://docs.bigmodel.cn/api-reference/模型-api/语音转文本"+ }+ ]+ }+}diff --git a/internal/models/catalog/loader.go b/internal/models/catalog/loader.gonew file mode 100644index 000000000..3a038282b--- /dev/null+++ b/internal/models/catalog/loader.go@@ -0,0 +1,49 @@+package catalog++import (+ "bytes"+ _ "embed"+ "encoding/json"+ "fmt"+ "sync"++ "github.com/Tencent/WeKnora/internal/models"+ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+)++//go:embed data/models.generated.json+var builtinData []byte++var (+ builtinOnce sync.Once+ builtinEntries map[string][]models.ModelSpec+)++// BuiltinModels returns an independent copy of a provider's generated catalog.+// Provider definitions never own or embed a second model list.+func BuiltinModels(provider string) []models.ModelSpec {+ builtinOnce.Do(func() {+ var data struct {+ Version int `json:"version"`+ Providers map[string][]models.ModelSpec `json:"providers"`+ }+ dec := json.NewDecoder(bytes.NewReader(builtinData))+ dec.DisallowUnknownFields()+ if err := dec.Decode(&data); err != nil {+ panic(fmt.Sprintf("invalid generated model catalog: %v", err))+ }+ if data.Version != 1 {+ panic("unsupported generated model catalog version")+ }+ builtinEntries = data.Providers+ })+ entries, ok := builtinEntries[provider]+ if !ok {+ panic("missing generated model catalog for " + provider)+ }+ out := make([]models.ModelSpec, len(entries))+ for i, model := range entries {+ out[i] = configcopy.Clone(model)+ }+ return out+}diff --git a/internal/models/catalog/registry.go b/internal/models/catalog/registry.godeleted file mode 100644index fc132a49a..000000000--- a/internal/models/catalog/registry.go+++ /dev/null@@ -1,286 +0,0 @@-package catalog--import (- "bytes"- "fmt"- "sort"- "strings"- "sync"-- "github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/types"-)--// GenericID is the catch-all vendor for any OpenAI-compatible endpoint.-const GenericID = "generic"--var (- mu sync.RWMutex- vendors = map[string]*Vendor{}-)--// Register adds a built-in vendor. Registering the same id twice replaces-// the earlier definition (the deployment overlay relies on this).-func Register(v *Vendor) {- if v == nil || v.ID == "" {- panic("catalog: vendor without id")- }- if v.API == "" {- v.API = api.APIOpenAICompletions- }- if v.Auth == "" {- v.Auth = AuthBearer- }- if v.RerankAPI == "" && v.SupportsType(types.ModelTypeRerank) {- v.RerankAPI = api.RerankCohere- }- if v.TranscriptionAPI == "" && v.SupportsType(types.ModelTypeASR) {- v.TranscriptionAPI = api.TranscriptionOpenAI- }- if v.EmbeddingAPI == "" && v.SupportsType(types.ModelTypeEmbedding) {- v.EmbeddingAPI = api.EmbeddingOpenAI- }- for i := range v.Models {- if v.Models[i].Type == "" {- v.Models[i].Type = types.ModelTypeKnowledgeQA- }- if v.Models[i].API == "" && v.Models[i].Type == types.ModelTypeKnowledgeQA {- v.Models[i].API = v.API- }- }- mu.Lock()- defer mu.Unlock()- vendors[v.ID] = v-}--// Get returns a vendor by id.-func Get(id string) (*Vendor, bool) {- mu.RLock()- defer mu.RUnlock()- v, ok := vendors[strings.ToLower(strings.TrimSpace(id))]- return v, ok-}--// GetOrGeneric returns the vendor or the generic catch-all. When no vendor-// package is linked into the binary (unit tests of leaf packages), a-// built-in generic definition keeps resolution working.-func GetOrGeneric(id string) *Vendor {- if v, ok := Get(id); ok {- return v- }- if v, ok := Get(GenericID); ok {- return v- }- return fallbackGeneric-}--// fallbackGeneric mirrors internal/models/vendors/generic so behaviour does-// not depend on whether that package was imported.-var fallbackGeneric = &Vendor{- ID: GenericID,- Name: "Custom (OpenAI-compatible)",- API: api.APIOpenAICompletions,- DefaultBaseURLs: map[types.ModelType]string{},- ModelTypes: []types.ModelType{- types.ModelTypeKnowledgeQA, types.ModelTypeEmbedding, types.ModelTypeRerank,- types.ModelTypeVLLM, types.ModelTypeASR,- },- Auth: AuthBearer,- Compat: VendorCompat{OpenAICompletions: OpenAICompletionsCompat{- MaxTokensField: Ptr("max_tokens"),- ThinkingFormat: Ptr(ThinkingFormatChatTemplateKwargs),- }},-}--// List returns every vendor ordered by Order then id.-func List() []*Vendor {- mu.RLock()- defer mu.RUnlock()- out := make([]*Vendor, 0, len(vendors))- for _, v := range vendors {- out = append(out, v)- }- sort.SliceStable(out, func(i, j int) bool {- if out[i].Order != out[j].Order {- return out[i].Order < out[j].Order- }- return out[i].ID < out[j].ID- })- return out-}--// ListByType returns vendors that support a model type.-func ListByType(modelType types.ModelType) []*Vendor {- all := List()- out := make([]*Vendor, 0, len(all))- for _, v := range all {- if v.SupportsType(modelType) {- out = append(out, v)- }- }- return out-}--// DetectByURL finds the vendor whose URLPatterns match a base URL. Used only-// when a stored model row carries no provider id. Longer patterns win so-// "api.lkeap.cloud.tencent.com" beats "tencent".-func DetectByURL(baseURL string) string {- if baseURL == "" {- return GenericID- }- lower := strings.ToLower(baseURL)- bestID, bestLen := GenericID, 0- for _, v := range List() {- for _, p := range v.URLPatterns {- if p != "" && strings.Contains(lower, strings.ToLower(p)) && len(p) > bestLen {- bestID, bestLen = v.ID, len(p)- }- }- }- return bestID-}--// ModelsByType returns the vendor's catalog entries for a model type,-// hiding deprecated and pattern-only entries.-func (v *Vendor) ModelsByType(modelType types.ModelType) []ModelSpec {- out := make([]ModelSpec, 0)- for _, m := range v.Models {- if m.Deprecated || m.ID == "" {- continue- }- mt := m.Type- if mt == "" {- mt = types.ModelTypeKnowledgeQA- }- switch modelType {- case types.ModelTypeVLLM:- // VLM pickers list chat models that accept images.- if mt == types.ModelTypeKnowledgeQA && m.AcceptsImages() {- out = append(out, m)- }- default:- if mt == modelType {- out = append(out, m)- }- }- }- return out-}--// FindModel looks a model name up among the vendor's entries of one model-// type: exact id, then aliases, then glob patterns (longest literal prefix-// wins). Matching is case-insensitive.-//-// The type is part of the key because families share prefixes across types.-// Aliyun's qwen3* chat glob also matches qwen3.8-text-embedding, and gpt-5*-// matches gpt-5-embed; an untyped lookup would hand an embedding row the chat-// family's compat, which the embedding overlay rejects, and the row could not-// be built at all. A VLM row is a chat model that accepts images, so it looks-// among the chat entries.-func (v *Vendor) FindModel(name string, modelType types.ModelType) (ModelSpec, bool) {- needle := strings.ToLower(strings.TrimSpace(name))- if needle == "" {- return ModelSpec{}, false- }- want := entryType(modelType)- var candidates []ModelSpec- for _, m := range v.Models {- if entryType(m.Type) == want {- candidates = append(candidates, m)- }- }- for _, m := range candidates {- if strings.ToLower(m.ID) == needle {- return m, true- }- }- for _, m := range candidates {- for _, alias := range m.Aliases {- if strings.ToLower(alias) == needle {- return m, true- }- }- }- var best ModelSpec- bestScore := -1- for _, m := range candidates {- if m.Match == "" {- continue- }- if globMatch(strings.ToLower(m.Match), needle) {- score := len(strings.TrimRight(strings.SplitN(m.Match, "*", 2)[0], "*"))- if score > bestScore {- best, bestScore = m, score- }- }- }- if bestScore >= 0 {- return best, true- }- return ModelSpec{}, false-}--// entryType folds a model type onto the catalog entries that describe it:-// chat entries leave Type empty, and VLM rows use them too.-func entryType(t types.ModelType) types.ModelType {- if t == "" || t == types.ModelTypeVLLM {- return types.ModelTypeKnowledgeQA- }- return t-}--// globMatch supports '*' wildcards only.-func globMatch(pattern, s string) bool {- parts := strings.Split(pattern, "*")- if len(parts) == 1 {- return pattern == s- }- if !strings.HasPrefix(s, parts[0]) {- return false- }- s = s[len(parts[0]):]- for i := 1; i < len(parts)-1; i++ {- idx := strings.Index(s, parts[i])- if idx < 0 {- return false- }- s = s[idx+len(parts[i]):]- }- return strings.HasSuffix(s, parts[len(parts)-1])-}--func defaultValidate(v *Vendor, cfg *Config) error {- if cfg == nil {- return fmt.Errorf("config is nil")- }- if v.RequiresAuth && v.Auth != AuthSigned && strings.TrimSpace(cfg.APIKey) == "" {- return fmt.Errorf("API key is required for %s", v.Name)- }- if v.ID == GenericID && strings.TrimSpace(cfg.BaseURL) == "" {- return fmt.Errorf("base URL is required for generic provider")- }- if strings.TrimSpace(cfg.ModelName) == "" {- return fmt.Errorf("model name is required")- }- return nil-}--func bytesReader(b []byte) *bytes.Reader { return bytes.NewReader(b) }--// reset clears the registry and returns a function that puts the previous-// contents back (tests only). The registry is process-global, so a test that-// merely cleared it would leave every later test in the same binary — the-// external catalog_test package included — resolving against an empty-// catalog, which silently turns assertions about real vendors into-// assertions about the generic fallback.-func reset() func() {- mu.Lock()- defer mu.Unlock()- previous := vendors- vendors = map[string]*Vendor{}- return func() {- mu.Lock()- defer mu.Unlock()- vendors = previous- }-}diff --git a/internal/models/chat/chat.go b/internal/models/chat/chat.goindex 386db11f9..33bbe2da2 100644--- a/internal/models/chat/chat.go+++ b/internal/models/chat/chat.go@@ -15,11 +15,8 @@ import ("github.com/Tencent/WeKnora/internal/models/api/googlegenai""github.com/Tencent/WeKnora/internal/models/api/openaicompletions""github.com/Tencent/WeKnora/internal/models/api/openairesponses"- "github.com/Tencent/WeKnora/internal/models/catalog"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/models/utils/ollama"- // Built-in vendors register with the catalog through package init; the- // chat factory is the one place that must never see an empty catalog.- _ "github.com/Tencent/WeKnora/internal/models/vendors""github.com/Tencent/WeKnora/internal/types"secutils "github.com/Tencent/WeKnora/internal/utils")@@ -141,11 +138,11 @@ func NewChat(config *ChatConfig, ollamaService *ollama.OllamaService) (Chat, err// Resolve looks the configuration up in the catalog. It is exposed so the// handler layer can report the effective protocol and capabilities.-func Resolve(config *ChatConfig) (*catalog.Resolved, error) {+func Resolve(config *ChatConfig) (*modelruntime.Resolved, error) {if config == nil {return nil, fmt.Errorf("chat config is nil")}- return catalog.Resolve(catalog.Ref{+ return modelruntime.Resolve(modelruntime.Ref{Provider: config.Provider,Model: config.ModelName,BaseURL: config.BaseURL,@@ -182,47 +179,14 @@ func NewRemoteChat(config *ChatConfig) (Chat, error) {}}- creds := catalog.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret}- if creds.APIKey == "" {- creds.APIKey = vendor.DefaultAPIKey- }- if vendor.Auth == catalog.AuthSigned {- if creds.AppID == "" {- return nil, fmt.Errorf("%s provider: AppID is required", vendor.Name)- }- if creds.AppSecret == "" {- return nil, fmt.Errorf("%s provider: AppSecret is required", vendor.Name)- }- } else if vendor.RequiresAuth && resolved.API == api.APIAnthropicMessages && strings.TrimSpace(creds.APIKey) == "" {- return nil, fmt.Errorf("%s provider: API key is required", vendor.Name)- }-- headers := make(map[string]string, len(vendor.Headers)+len(config.CustomHeaders))- for k, v := range vendor.Headers {- headers[k] = v- }- for k, v := range config.CustomHeaders {- headers[k] = v- }- endpoint := api.Endpoint{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelID: config.ModelID,- Auth: vendor.AuthFunc(resolved.API, creds),- Headers: headers,- }- if vendor.Endpoint != nil {- url, query := vendor.Endpoint(catalog.EndpointRequest{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelType: types.ModelTypeKnowledgeQA,- API: resolved.API,- Extra: config.ExtraConfig,- })- if url != "" {- endpoint.URL = url- endpoint.Query = query- }+ endpoint, err := resolved.Endpoint(types.ModelTypeKnowledgeQA, modelruntime.Connection{+ ModelID: config.ModelID,+ Credentials: api.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret},+ Headers: config.CustomHeaders,+ Extra: config.ExtraConfig,+ })+ if err != nil {+ return nil, err}switch resolved.API {diff --git a/internal/models/chat/llm_debug.go b/internal/models/chat/llm_debug.goindex 1badc6326..ccf6137c9 100644--- a/internal/models/chat/llm_debug.go+++ b/internal/models/chat/llm_debug.go@@ -6,9 +6,8 @@ import ("strings""time"- "github.com/Tencent/WeKnora/internal/models/api"-"github.com/Tencent/WeKnora/internal/logger"+ "github.com/Tencent/WeKnora/internal/models/api""github.com/Tencent/WeKnora/internal/types")diff --git a/internal/models/chat/ollama.go b/internal/models/chat/ollama.goindex 9067aa377..7597863e8 100644--- a/internal/models/chat/ollama.go+++ b/internal/models/chat/ollama.go@@ -9,9 +9,8 @@ import ("strings""time"- "github.com/Tencent/WeKnora/internal/models/api"-"github.com/Tencent/WeKnora/internal/logger"+ "github.com/Tencent/WeKnora/internal/models/api""github.com/Tencent/WeKnora/internal/models/utils/ollama""github.com/Tencent/WeKnora/internal/types"secutils "github.com/Tencent/WeKnora/internal/utils"diff --git a/internal/models/embedding/catalog_matrix_test.go b/internal/models/embedding/catalog_matrix_test.gonew file mode 100644index 000000000..cf5d907ce--- /dev/null+++ b/internal/models/embedding/catalog_matrix_test.go@@ -0,0 +1,105 @@+package embedding++import (+ "context"+ "net/url"+ "strings"+ "testing"++ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++// Exercise the production factory and HTTP transport for every embedding rule,+// including aliases, pattern entries and both query/document task modes.+func TestEveryCatalogEmbeddingTransport(t *testing.T) {+ for _, v := range modelruntime.List() {+ for _, m := range v.Models() {+ if m.Type != types.ModelTypeEmbedding {+ continue+ }+ names := append([]string{m.ID}, m.Aliases...)+ if m.ID == "" {+ names[0] = strings.ReplaceAll(m.Match, "*", "snapshot")+ }+ for _, name := range names {+ t.Run(v.ID+"/"+name, func(t *testing.T) {+ u := newUpstream(t)+ base, err := url.Parse(+ strings.ReplaceAll(+ v.GetDefaultURL(+ types.ModelTypeEmbedding,+ ),+ "{resource}",+ "test-resource",+ ),+ )+ require.NoError(t, err)+ cfg := Config{+ Source: types.ModelSourceRemote,+ Provider: v.ID,+ ModelName: name,+ ModelID: "row-id",+ BaseURL: u.url + base.Path,+ APIKey: "row-key",+ AppID: "app",+ AppSecret: "secret",+ Dimensions: 256,+ SupportsDimensionOverride: true,+ }+ client, err := newRemoteEmbedder(cfg, nil)+ require.NoError(t, err)+ for _, ctx := range []context.Context{+ context.Background(),+ types.WithEmbedQuery(+ context.Background(),+ ),+ } {+ vectors, err := client.BatchEmbed(ctx, []string{"a", "中文"})+ require.NoError(t, err)+ require.Equal(t, [][]float32{{1}, {2}}, vectors)+ }+ require.NotEmpty(t, u.requests)+ require.Equal(t, "row-id", client.GetModelID())+ })+ }+ }+ }+}++func TestStoredEmbeddingSpecReachesWire(t *testing.T) {+ u := newUpstream(t)+ row := &types.Model{+ ID: "stable-id",+ Name: "custom",+ Source: types.ModelSourceRemote,+ Parameters: types.ModelParameters{+ Provider: "generic",+ BaseURL: u.url,+ APIKey: "model-key",+ Spec: &types.ModelSpecOverride{+ Compat: map[string]any{+ "path": "/custom-embeddings",+ "max_batch_size": 1,+ "extra_body": map[string]any{+ "custom_flag": true,+ },+ },+ },+ },+ }+ client, err := newRemoteEmbedder(ConfigFromModel(row, "", ""), nil)+ require.NoError(t, err)+ _, err = client.BatchEmbed(context.Background(), []string{"a", "b"})+ require.NoError(t, err)+ require.Len(t, u.requests, 2)+ for _, req := range u.requests {+ require.Equal(t, "/custom-embeddings", req.path)+ require.Equal(t, true, req.body["custom_flag"])+ require.Equal(t, "Bearer model-key", req.header.Get("Authorization"))+ }+ row.Parameters.Spec.Compat = map[string]any{"misspelled_option": true}+ _, err = newRemoteEmbedder(ConfigFromModel(row, "", ""), nil)+ require.ErrorContains(t, err, "unknown field")+}diff --git a/internal/models/embedding/embedder.go b/internal/models/embedding/embedder.goindex 4e2502cbe..4d008c4b3 100644--- a/internal/models/embedding/embedder.go+++ b/internal/models/embedding/embedder.go@@ -7,11 +7,6 @@ import ("github.com/Tencent/WeKnora/internal/logger""github.com/Tencent/WeKnora/internal/models/utils/ollama"- // catalog.Resolve answers from the vendor catalog, which is empty until- // the vendor packages have run their init. Without this import every row- // resolves to the generic vendor — silently, and only in builds that do- // not already link the container (leaf tests, future tools).- _ "github.com/Tencent/WeKnora/internal/models/vendors""github.com/Tencent/WeKnora/internal/tracing/langfuse""github.com/Tencent/WeKnora/internal/types")@@ -56,8 +51,9 @@ type Config struct {Provider string `json:"provider"`// MaxConcurrency caps concurrent background calls to this model; 0 falls// back to the process-wide default (see limiter.GateN).- MaxConcurrency int `json:"max_concurrency"`- ExtraConfig map[string]string `json:"extra_config"`+ MaxConcurrency int `json:"max_concurrency"`+ Spec *types.ModelSpecOverride `json:"spec,omitempty"`+ ExtraConfig map[string]string `json:"extra_config"`// CustomHeaders 允许在调用远程 API 时附加自定义 HTTP 请求头(类似 OpenAI Python SDK 的 extra_headers)。CustomHeaders map[string]string `json:"custom_headers"`AppID string@@ -82,6 +78,7 @@ func ConfigFromModel(m *types.Model, appID, appSecret string) Config {TruncatePromptTokens: m.Parameters.EmbeddingParameters.TruncatePromptTokens,Provider: m.Parameters.Provider,MaxConcurrency: m.Parameters.MaxConcurrency,+ Spec: m.Parameters.Spec,ExtraConfig: m.Parameters.ExtraConfig,CustomHeaders: m.Parameters.CustomHeaders,AppID: appID,diff --git a/internal/models/embedding/protocol.go b/internal/models/embedding/protocol.goindex 764e88f71..3398049bb 100644--- a/internal/models/embedding/protocol.go+++ b/internal/models/embedding/protocol.go@@ -11,7 +11,7 @@ import ("github.com/Tencent/WeKnora/internal/models/api/dashscopeembeddings""github.com/Tencent/WeKnora/internal/models/api/googleembeddings""github.com/Tencent/WeKnora/internal/models/api/openaiembeddings"- "github.com/Tencent/WeKnora/internal/models/catalog"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -26,12 +26,13 @@ func newRemoteEmbedder(config Config, pooler EmbedderPooler) (Embedder, error) {if strings.TrimSpace(config.ModelName) == "" {return nil, fmt.Errorf("model name is required")}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: config.Provider,Model: config.ModelName,BaseURL: config.BaseURL,ModelType: types.ModelTypeEmbedding,Extra: config.ExtraConfig,+ Override: config.Spec,TruncatePromptTokens: config.TruncatePromptTokens,})if err != nil {@@ -42,53 +43,22 @@ func newRemoteEmbedder(config Config, pooler EmbedderPooler) (Embedder, error) {}vendor := resolved.Vendor- creds := catalog.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret}- if creds.APIKey == "" {- creds.APIKey = vendor.DefaultAPIKey+ endpoint, err := resolved.Endpoint(types.ModelTypeEmbedding, modelruntime.Connection{+ ModelID: config.ModelID,+ Credentials: api.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret},+ Headers: config.CustomHeaders,+ Extra: config.ExtraConfig,+ Client: newEmbeddingHTTPClient(time.Duration(resolved.Embeddings.RequestTimeout) * time.Second),+ })+ if err != nil {+ return nil, err}- // A signing vendor with no identity pair would otherwise send unsigned- // requests and fail at the far end, which is a worse error than this one.- if vendor.Auth == catalog.AuthSigned {- if creds.AppID == "" {- return nil, fmt.Errorf("%s embedding: AppID is required", vendor.Name)- }- if creds.AppSecret == "" {- return nil, fmt.Errorf("%s embedding: AppSecret is required", vendor.Name)+ if endpoint.URL != "" {+ if err := validateEmbeddingBaseURL(endpoint.URL); err != nil {+ return nil, err}}- // Vendor headers first so a user header cannot silently replace a vendor- // beta flag, matching chat.NewRemoteChat.- headers := make(map[string]string, len(vendor.Headers)+len(config.CustomHeaders))- for k, v := range vendor.Headers {- headers[k] = v- }- for k, v := range config.CustomHeaders {- headers[k] = v- }settings := resolved.Embeddings- endpoint := api.Endpoint{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelID: config.ModelID,- Auth: vendor.AuthFunc(vendor.API, creds),- Headers: headers,- Client: newEmbeddingHTTPClient(time.Duration(settings.RequestTimeout) * time.Second),- }- if vendor.Endpoint != nil {- if url, query := vendor.Endpoint(catalog.EndpointRequest{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelType: types.ModelTypeEmbedding,- API: vendor.API,- EmbeddingAPI: resolved.EmbeddingAPI,- Extra: config.ExtraConfig,- }); url != "" {- if err := validateEmbeddingBaseURL(url); err != nil {- return nil, err- }- endpoint.URL, endpoint.Query = url, query- }- }// The width is the vendor's field but the operator's decision: a row// that did not opt in keeps the model's native width even where the@@ -137,7 +107,7 @@ func newRemoteEmbedder(config Config, pooler EmbedderPooler) (Embedder, error) {// and telling the vendor which side of a search a text is on.type protocolEmbedder struct {inner api.Embedder- settings catalog.EmbeddingsSettings+ settings api.EmbeddingsSettingsmodelName stringmodelID stringdimensions intdiff --git a/internal/models/internal/configcopy/copy.go b/internal/models/internal/configcopy/copy.gonew file mode 100644index 000000000..c16fb1d95--- /dev/null+++ b/internal/models/internal/configcopy/copy.go@@ -0,0 +1,62 @@+// Package configcopy copies exported configuration data and immutable function values.+package configcopy++import "reflect"++// Clone copies exported configuration fields while retaining immutable functions.+func Clone[T any](value T) T {+ var out T+ reflect.ValueOf(&out).Elem().Set(cloneValue(reflect.ValueOf(&value).Elem()))+ return out+}++// Value preserves the static type of reflected optional configuration fields.+func Value(value reflect.Value) reflect.Value { return cloneValue(value) }++// Definitions contain only exported data fields and immutable function values.+// Copy every pointer, map and slice, including nested compatibility settings.+func cloneValue(v reflect.Value) reflect.Value {+ switch v.Kind() {+ case reflect.Interface:+ if v.IsNil() {+ return reflect.Zero(v.Type())+ }+ out := reflect.New(v.Type()).Elem()+ out.Set(cloneValue(v.Elem()))+ return out+ case reflect.Pointer:+ if v.IsNil() {+ return reflect.Zero(v.Type())+ }+ out := reflect.New(v.Type().Elem())+ out.Elem().Set(cloneValue(v.Elem()))+ return out+ case reflect.Map:+ if v.IsNil() {+ return reflect.Zero(v.Type())+ }+ out := reflect.MakeMapWithSize(v.Type(), v.Len())+ iter := v.MapRange()+ for iter.Next() {+ out.SetMapIndex(iter.Key(), cloneValue(iter.Value()))+ }+ return out+ case reflect.Slice:+ if v.IsNil() {+ return reflect.Zero(v.Type())+ }+ out := reflect.MakeSlice(v.Type(), v.Len(), v.Len())+ for i := 0; i < v.Len(); i++ {+ out.Index(i).Set(cloneValue(v.Index(i)))+ }+ return out+ case reflect.Struct:+ out := reflect.New(v.Type()).Elem()+ for i := 0; i < v.NumField(); i++ {+ out.Field(i).Set(cloneValue(v.Field(i)))+ }+ return out+ default:+ return v+ }+}diff --git a/internal/models/legacy_keys.go b/internal/models/legacy_keys.gonew file mode 100644index 000000000..96b371689--- /dev/null+++ b/internal/models/legacy_keys.go@@ -0,0 +1,28 @@+package models++// Extra-config keys honoured by Resolve. They predate the catalog and stay+// supported so existing model rows keep working unchanged.+const (+ // ExtraAPI forces a protocol ("openai-responses", "anthropic-messages", ...).+ ExtraAPI = "api"+ // ExtraRemoteModelName sends a different model id on the wire.+ ExtraRemoteModelName = "remote_model_name"+ // ExtraAPIVersion is the Azure api-version query parameter.+ ExtraAPIVersion = "api_version"+ // ExtraThinkingControl is the legacy thinking encoding selector written+ // by older UIs: none | enable_thinking | thinking_type | chat_template_kwargs.+ ExtraThinkingControl = "thinking_control"+ // ExtraTruncatePromptTokens is the vLLM-only server-side truncation+ // budget for rerank, opt-in per row. It is never sent unless the operator+ // set it: vendors that do not implement it reject the unknown field.+ ExtraTruncatePromptTokens = "truncate_prompt_tokens"+ // LegacyTruncatePromptTokens is the embedding truncation budget the+ // pre-catalog OpenAI-compatible client sent whenever a row left it at 0.+ LegacyTruncatePromptTokens = 511+ // ExtraScoreScale overrides the vendor rerank score scale for one row.+ // A self-hosted gateway serves whatever reranker was deployed behind it+ // and the two families disagree: BGE-class models answer a 0..1+ // probability, Qwen3-Reranker-class models an unbounded score. A vendor+ // can only state what its own documentation shows.+ ExtraScoreScale = "score_scale"+)diff --git a/internal/models/model.go b/internal/models/model.gonew file mode 100644index 000000000..b68a3a702--- /dev/null+++ b/internal/models/model.go@@ -0,0 +1,76 @@+// Package models defines shared, credential-free model metadata.+package models++import (+ "encoding/json"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/types"+)++// ModelCost is priced per million tokens, in USD unless Currency says otherwise.+type ModelCost struct {+ Input float64 `json:"input"`+ Output float64 `json:"output"`+ CacheRead float64 `json:"cache_read,omitempty"`+ CacheWrite float64 `json:"cache_write,omitempty"`+ Currency string `json:"currency,omitempty"`+}++// ModelSpec is one entry of the generated model catalog.+//+// Only ID is required. API defaults to the vendor's API; Type defaults to+// KnowledgeQA. Compat is interpreted according to API (see compat.go).+type ModelSpec struct {+ ID string `json:"id"`+ Name string `json:"name,omitempty"`+ // Type is the WeKnora model type this entry describes. Chat models with+ // image input are still KnowledgeQA; the UI derives VLM eligibility from+ // Input. Embedding / Rerank / ASR entries exist for the model picker.+ Type types.ModelType `json:"type,omitempty"`+ API api.API `json:"api,omitempty"`+ // Aliases are additional ids that resolve to this entry (dated+ // snapshots, vendor-prefixed names on gateways).+ Aliases []string `json:"aliases,omitempty"`+ // Match is a case-insensitive glob ("gpt-5*", "*deepseek-r1*") that lets+ // one entry describe a family. Exact ids and aliases win over patterns;+ // among patterns the longest literal prefix wins.+ Match string `json:"match,omitempty"`+ // Reasoning reports whether the model can emit thinking at all.+ Reasoning bool `json:"reasoning"`+ // Input lists accepted modalities: text, image, audio, video.+ Input []string `json:"input,omitempty"`+ ContextWindow int `json:"context_window,omitempty"`+ MaxOutputTokens int `json:"max_output_tokens,omitempty"`+ Cost *ModelCost `json:"cost,omitempty"`+ // ThinkingLevels maps protocol-neutral levels to vendor values; missing+ // keys inherit the vendor map. See api.ThinkingLevelMap.+ ThinkingLevels api.ThinkingLevelMap `json:"thinking_levels,omitempty"`+ // Compat is the protocol-specific overlay for this model (flat object,+ // fields depend on API). Decoded lazily by Resolve.+ Compat json.RawMessage `json:"compat,omitempty"`+ // Dimension is the embedding vector width (embedding entries only).+ Dimension int `json:"dimension,omitempty"`+ // Deprecated hides the entry from pickers but keeps resolution working.+ Deprecated bool `json:"deprecated,omitempty"`+ // Source is the documentation URL the facts were taken from.+ Source string `json:"source,omitempty"`+}++// DisplayName returns Name or the id.+func (m ModelSpec) DisplayName() string {+ if m.Name != "" {+ return m.Name+ }+ return m.ID+}++// AcceptsImages reports whether Input lists image.+func (m ModelSpec) AcceptsImages() bool {+ for _, in := range m.Input {+ if in == "image" {+ return true+ }+ }+ return false+}diff --git a/internal/models/model_type.go b/internal/models/model_type.gonew file mode 100644index 000000000..12bdfe93b--- /dev/null+++ b/internal/models/model_type.go@@ -0,0 +1,30 @@+package models++import (+ "strings"++ "github.com/Tencent/WeKnora/internal/types"+)++var frontendTypes = map[string]types.ModelType{+ "chat": types.ModelTypeKnowledgeQA,+ "embedding": types.ModelTypeEmbedding,+ "rerank": types.ModelTypeRerank,+ "vlm": types.ModelTypeVLLM,+ "vllm": types.ModelTypeVLLM,+ "asr": types.ModelTypeASR,+}++// ParseModelType accepts both frontend ("chat") and backend ("KnowledgeQA")+// spellings.+func ParseModelType(s string) (types.ModelType, bool) {+ if t, ok := frontendTypes[strings.ToLower(strings.TrimSpace(s))]; ok {+ return t, true+ }+ switch types.ModelType(s) {+ case types.ModelTypeKnowledgeQA, types.ModelTypeEmbedding, types.ModelTypeRerank,+ types.ModelTypeVLLM, types.ModelTypeASR:+ return types.ModelType(s), true+ }+ return "", false+}diff --git a/internal/models/parity/catalog_baseline_test.go b/internal/models/parity/catalog_baseline_test.gonew file mode 100644index 000000000..f365ac554--- /dev/null+++ b/internal/models/parity/catalog_baseline_test.go@@ -0,0 +1,113 @@+package parity++import (+ "crypto/sha256"+ "encoding/json"+ "fmt"+ "os"+ "strings"+ "testing"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/chat"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++// This fixture was captured before the provider/runtime refactor. It pins every+// catalog entry, alias and family rule, including full resolved protocol options,+// endpoints and request bodies at every reasoning level. Updating it is an+// explicit compatibility decision, never part of normal model generation.+func TestCatalogMigrationBaseline(t *testing.T) {+ actual := map[string]string{}+ for _, vendor := range modelruntime.List() {+ for _, entry := range vendor.Models() {+ names := append([]string{entry.ID}, entry.Aliases...)+ if entry.Match != "" {+ names = append(names, strings.ReplaceAll(entry.Match, "*", "snapshot"))+ }+ for _, name := range names {+ if name == "" {+ continue+ }+ key := fmt.Sprintf("%s/%s/%s", vendor.ID, entry.Type, name)+ r, err := modelruntime.Resolve(+ modelruntime.Ref{+ Provider: vendor.ID,+ Model: name,+ ModelType: entry.Type,+ },+ )+ if err != nil {+ actual[key] = "error: " + err.Error()+ continue+ }+ state := map[string]any{"resolved": r, "auth": vendor.AuthStyleFor(r.API)}+ if vendor.Endpoint != nil {+ u, q := vendor.Endpoint(+ providers.EndpointRequest{+ BaseURL: r.BaseURL,+ Model: name,+ ModelType: entry.Type,+ API: r.API,+ EmbeddingAPI: r.EmbeddingAPI,+ },+ )+ state["endpoint"], state["query"] = u, q+ }+ r.Vendor = nil // functions are not serializable; their output is captured above+ if entry.Type == "" || entry.Type == types.ModelTypeKnowledgeQA {+ bodies := map[string]any{}+ for _, level := range api.ReasoningLadder {+ for _, stream := range []bool{false, true} {+ bodies[fmt.Sprintf("%s/%t", level, stream)] = buildBody(t,+ &chat.ChatConfig{+ Provider: vendor.ID,+ ModelName: name,+ AppID: "app",+ AppSecret: "secret",+ BaseURL: reachableBaseURL(+ vendor.GetDefaultURL(+ types.ModelTypeKnowledgeQA,+ ),+ ),+ },+ &api.Options{+ MaxTokens: 256,+ Temperature: 0.5,+ ReasoningEffort: level,+ Thinking: ptrBool(+ level != api.ReasoningOff,+ ),+ }, stream)+ }+ }+ state["bodies"] = bodies+ }+ data, err := json.Marshal(state)+ require.NoError(t, err, key)+ actual[key] = fmt.Sprintf("%x", sha256.Sum256(data))+ }+ }+ }+ const path = "testdata/catalog-baseline.json"+ if os.Getenv("WEKNORA_UPDATE_MODEL_BASELINE") == "1" {+ data, err := json.MarshalIndent(actual, "", " ")+ require.NoError(t, err)+ require.NoError(t, os.MkdirAll("testdata", 0o755))+ require.NoError(t, os.WriteFile(path, append(data, '\n'), 0o644))+ }+ data, err := os.ReadFile(path)+ require.NoError(t, err)+ var expected map[string]string+ require.NoError(t, json.Unmarshal(data, &expected))+ require.Equal(+ t,+ expected,+ actual,+ "catalog or wire contract changed; inspect each difference before updating the baseline",+ )+ t.Logf("verified %d catalog entries, aliases and family matches", len(actual))+}diff --git a/internal/models/parity/parity_test.go b/internal/models/parity/parity_test.goindex 9b10629ed..9c0de9649 100644--- a/internal/models/parity/parity_test.go+++ b/internal/models/parity/parity_test.go@@ -25,10 +25,11 @@ import ("strings""testing"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/models/chat"- _ "github.com/Tencent/WeKnora/internal/models/vendors"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types"secutils "github.com/Tencent/WeKnora/internal/utils""github.com/stretchr/testify/assert"@@ -68,7 +69,7 @@ func ptrBool(b bool) *bool { return &b }var userTurn = []api.Message{{Role: "user", Content: "hi"}}-// buildBody runs the production path: ChatConfig -> catalog.Resolve ->+// buildBody runs the production path: ChatConfig -> modelruntime.Resolve ->// protocol client -> request body, then round-trips through JSON so the// assertions see the real wire types.func buildBody(t *testing.T, cfg *chat.ChatConfig, opts *api.Options, stream bool) map[string]any {@@ -93,9 +94,9 @@ func buildBody(t *testing.T, cfg *chat.ChatConfig, opts *api.Options, stream booreturn out}-func resolve(t *testing.T, provider, model string) *catalog.Resolved {+func resolve(t *testing.T, provider, model string) *modelruntime.Resolved {t.Helper()- r, err := catalog.Resolve(catalog.Ref{Provider: provider, Model: model})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: provider, Model: model})require.NoError(t, err)return r}@@ -253,7 +254,7 @@ func TestLegacyWireParity(t *testing.T) {{name: "openai reasoning model keeps max_completion_tokens and drops sampling",provider: "openai", model: "gpt-5.5",- extra: map[string]string{catalog.ExtraAPI: "openai-completions"},+ extra: map[string]string{models.ExtraAPI: "openai-completions"},opts: &api.Options{MaxTokens: 100, Temperature: 0.7, TopP: 0.9},want: map[string]any{"max_completion_tokens": float64(100), "max_tokens": nil,@@ -325,7 +326,7 @@ func TestLegacyWireParity(t *testing.T) {// precedence rule: an explicit legacy override outranks that gate.name: "legacy extra_config.thinking_control still overrides the vendor default",provider: "deepseek", model: "deepseek-chat",- extra: map[string]string{catalog.ExtraThinkingControl: "chat_template_kwargs"},+ extra: map[string]string{models.ExtraThinkingControl: "chat_template_kwargs"},opts: &api.Options{Thinking: ptrBool(true)},want: map[string]any{"chat_template_kwargs": map[string]any{"enable_thinking": true}, "thinking": nil,@@ -334,14 +335,14 @@ func TestLegacyWireParity(t *testing.T) {{name: "legacy extra_config.thinking_control=none silences thinking",provider: "volcengine", model: "doubao-seed-1-6-251015",- extra: map[string]string{catalog.ExtraThinkingControl: "none"},+ extra: map[string]string{models.ExtraThinkingControl: "none"},opts: &api.Options{Thinking: ptrBool(true)},want: map[string]any{"thinking": nil, "reasoning_effort": nil},},{name: "remote_model_name still overrides the wire model id",provider: "deepseek", model: "deepseek-chat",- extra: map[string]string{catalog.ExtraRemoteModelName: "deepseek-v4-pro-internal"},+ extra: map[string]string{models.ExtraRemoteModelName: "deepseek-v4-pro-internal"},opts: &api.Options{},want: map[string]any{"model": "deepseek-v4-pro-internal"},},@@ -441,7 +442,7 @@ func TestLegacyProviderDetection(t *testing.T) {"": "generic",}for url, want := range cases {- assert.Equal(t, want, catalog.DetectByURL(url), "DetectByURL(%q)", url)+ assert.Equal(t, want, modelruntime.DetectByURL(url), "DetectByURL(%q)", url)}}@@ -449,7 +450,7 @@ func TestLegacyProviderDetection(t *testing.T) {// net that catches a newly added vendor or model entry that is malformed,// contradictory, or unresolvable — without anyone updating this test.func TestCatalogInvariants(t *testing.T) {- vendors := catalog.List()+ vendors := modelruntime.List()require.NotEmpty(t, vendors, "no vendors registered")seenID := map[string]bool{}@@ -467,7 +468,7 @@ func TestCatalogInvariants(t *testing.T) {if v.RequiresAuth {assert.NotEmpty(t, v.Auth, "RequiresAuth without an auth style")}- if v.Auth == catalog.AuthSigned {+ if v.Auth == providers.AuthSigned {assert.NotNil(t, v.Signer, "signed auth without a Signer hook")}@@ -489,7 +490,7 @@ func TestCatalogInvariants(t *testing.T) {}ids := map[string]bool{}- for _, m := range v.Models {+ for _, m := range v.Models() {label := m.IDif label == "" {label = "match:" + m.Match@@ -523,7 +524,7 @@ func TestCatalogInvariants(t *testing.T) {if m.ID != "" {// Resolve validates the compat object against the model's// protocol: an unknown or misspelled key fails here.- _, err := catalog.Resolve(catalog.Ref{Provider: v.ID, Model: m.ID, ModelType: m.Type})+ _, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: m.ID, ModelType: m.Type})if bytes.Contains(m.Compat, []byte("unsupported_reason")) {// An entry that declares itself unserveable must say so// by refusing, not by resolving into a request shaped@@ -542,7 +543,7 @@ func TestCatalogInvariants(t *testing.T) {// model, with thinking on and off, and asserts the invariants that hold for// every vendor. A new model whose compat contradicts itself fails here.func TestEveryChatModelRequestShape(t *testing.T) {- for _, v := range catalog.List() {+ for _, v := range modelruntime.List() {if !v.SupportsType(types.ModelTypeKnowledgeQA) {continue}@@ -580,7 +581,7 @@ func TestEveryChatModelRequestShape(t *testing.T) {assert.NotContains(t, body, "temperature","thinking=%v: model rejects sampling parameters", thinking)}- if settings.ThinkingFormat == catalog.ThinkingFormatNone {+ if settings.ThinkingFormat == api.ThinkingFormatNone {for _, field := range []string{"thinking", "enable_thinking", "reasoning_effort", "reasoning"} {assert.NotContains(t, body, field,"thinking=%v: %s must not be sent when the vendor has no thinking format",@@ -611,10 +612,10 @@ func TestEveryChatModelRequestShape(t *testing.T) {// other vendor does: a signed request to a non-standard path, and plain-text// content because the endpoint rejects multi-part messages.func TestWeKnoraCloudTransport(t *testing.T) {- v, ok := catalog.Get("weknoracloud")+ v, ok := modelruntime.Get("weknoracloud")require.True(t, ok)require.NotNil(t, v.Endpoint, "WeKnora Cloud needs a custom endpoint")- url, _ := v.Endpoint(catalog.EndpointRequest{+ url, _ := v.Endpoint(providers.EndpointRequest{BaseURL: "https://weknora.weixin.qq.com", ModelType: types.ModelTypeKnowledgeQA,})assert.Equal(t, "https://weknora.weixin.qq.com/api/v1/chat/completions", url)@@ -634,7 +635,7 @@ func TestWeKnoraCloudTransport(t *testing.T) {// base URL, and those must keep speaking that protocol after the switch to// native generateContent as the default.func TestGeminiLegacyBaseURLKeepsOpenAIProtocol(t *testing.T) {- r, err := catalog.Resolve(catalog.Ref{+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "gemini", Model: "gemini-2.5-pro",BaseURL: "https://generativelanguage.googleapis.com/v1beta/openai",})@@ -699,7 +700,7 @@ func TestGeminiCredentialFollowsTheProtocol(t *testing.T) {// registry map and the per-vendor slices are shared, so a resolver that// mutated them would corrupt another request. Run with -race.func TestConcurrentResolve(t *testing.T) {- vendors := catalog.List()+ vendors := modelruntime.List()require.NotEmpty(t, vendors)const goroutines = 32@@ -713,7 +714,7 @@ func TestConcurrentResolve(t *testing.T) {if len(models) > 0 {name = models[i%len(models)].ID}- r, err := catalog.Resolve(catalog.Ref{Provider: v.ID, Model: name})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: name})if err != nil {t.Errorf("resolve %s/%s: %v", v.ID, name, err)return@@ -721,7 +722,7 @@ func TestConcurrentResolve(t *testing.T) {// Touch the derived views the handlers use._ = r.Capabilities()_ = r.ThinkingLevels.SupportedLevels()- _ = catalog.DetectByURL(r.BaseURL)+ _ = modelruntime.DetectByURL(r.BaseURL)}}(i)}@@ -737,11 +738,11 @@ func TestConcurrentResolve(t *testing.T) {// page they came from is recorded next to them, and the model editor links an// operator straight to that page from the picker. models.json may state the// URL once at file level for the entries a single page covers, so this also-// covers MustParseModels pushing it down — before that it was parsed and+// covers the generator preserving per-entry sources — previously it was parsed and// dropped, and most entries had nothing to link to.func TestEveryCatalogModelDocumentsItsSource(t *testing.T) {- for _, vendor := range catalog.List() {- for _, model := range vendor.Models {+ for _, vendor := range modelruntime.List() {+ for _, model := range vendor.Models() {name := model.IDif name == "" {name = model.Matchdiff --git a/internal/models/parity/rerank_test.go b/internal/models/parity/rerank_test.goindex 113061e6b..90618bcf8 100644--- a/internal/models/parity/rerank_test.go+++ b/internal/models/parity/rerank_test.go@@ -8,9 +8,11 @@ import ("strings""testing"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers""github.com/Tencent/WeKnora/internal/models/rerank"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -19,7 +21,7 @@ import (// TestEveryRerankVendorResolvesToAKnownProtocol walks the catalog, so a newly// added vendor is covered without touching this file.func TestEveryRerankVendorResolvesToAKnownProtocol(t *testing.T) {- vendors := catalog.ListByType(types.ModelTypeRerank)+ vendors := modelruntime.ListByType(types.ModelTypeRerank)require.NotEmpty(t, vendors, "no vendor serves rerank")for _, v := range vendors {@@ -28,7 +30,7 @@ func TestEveryRerankVendorResolvesToAKnownProtocol(t *testing.T) {if catalogued := v.ModelsByType(types.ModelTypeRerank); len(catalogued) > 0 {model = catalogued[0].ID}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: model, ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -36,7 +38,7 @@ func TestEveryRerankVendorResolvesToAKnownProtocol(t *testing.T) {"unknown rerank protocol %q", resolved.RerankAPI)// The catch-all vendor has no endpoint of its own: the operator// supplies one, and Validate requires it.- if v.ID != catalog.GenericID {+ if v.ID != providers.GenericID {assert.NotEmpty(t, resolved.BaseURL, "rerank vendors need a default endpoint")}@@ -73,7 +75,7 @@ func TestRerankProtocolAssignment(t *testing.T) {"litellm": api.RerankCohere,} {t.Run(id, func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -216,11 +218,11 @@ func TestSignedRerankVendorRequiresItsIdentityPair(t *testing.T) {// managed vendor documents the field, and sending it to one is how an// undocumented parameter ends up on every request.func TestTruncatePromptTokensOnlyReachesVLLMClassVendors(t *testing.T) {- optIn := map[string]string{catalog.ExtraTruncatePromptTokens: "512"}+ optIn := map[string]string{models.ExtraTruncatePromptTokens: "512"}for _, id := range []string{"generic", "gpustack"} {t.Run(id+" accepts it", func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "m", ModelType: types.ModelTypeRerank,BaseURL: "http://127.0.0.1:9/v1", Extra: optIn,})@@ -231,7 +233,7 @@ func TestTruncatePromptTokensOnlyReachesVLLMClassVendors(t *testing.T) {for _, id := range []string{"jina", "zhipu", "siliconflow", "qianfan", "weknoracloud", "aliyun", "nvidia"} {t.Run(id+" rejects it", func(t *testing.T) {- _, err := catalog.Resolve(catalog.Ref{+ _, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "m", ModelType: types.ModelTypeRerank, Extra: optIn,})require.Error(t, err, "a managed vendor must not silently accept a vLLM extension")@@ -242,10 +244,10 @@ func TestTruncatePromptTokensOnlyReachesVLLMClassVendors(t *testing.T) {func TestTruncatePromptTokensRejectsAnInvalidValue(t *testing.T) {for _, raw := range []string{"0", "-1", "abc"} {- _, err := catalog.Resolve(catalog.Ref{+ _, err := modelruntime.Resolve(modelruntime.Ref{Provider: "generic", Model: "m", ModelType: types.ModelTypeRerank,BaseURL: "http://127.0.0.1:9/v1",- Extra: map[string]string{catalog.ExtraTruncatePromptTokens: raw},+ Extra: map[string]string{models.ExtraTruncatePromptTokens: raw},})require.Error(t, err, "value %q", raw)}@@ -256,7 +258,7 @@ func TestTruncatePromptTokensRejectsAnInvalidValue(t *testing.T) {// test watched them; now they are declarations, so they need their own guard —// TestEveryRerankVendorResolvesToAKnownProtocol only checks they are sane.func TestRerankCeilingsAreTheDocumentedOnes(t *testing.T) {- for id, want := range map[string]catalog.RerankSettings{+ for id, want := range map[string]api.RerankSettings{// docs.bigmodel.cn: 最多 128 条,query 与单条文档各 4096 字符"zhipu": {MaxDocuments: 128, MaxQueryChars: 4096, MaxDocumentChars: 4096},// cloud.tencent.com/document/product/1772: RunRerank 60 docs,@@ -274,7 +276,7 @@ func TestRerankCeilingsAreTheDocumentedOnes(t *testing.T) {"aliyun": {MaxDocuments: 500},} {t.Run(id, func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -292,7 +294,7 @@ func TestRerankCeilingsAreTheDocumentedOnes(t *testing.T) {// ever had a client-level timeout. Without it a hung endpoint holds the// retrieval stage open for as long as the caller's context allows.func TestWeKnoraCloudRerankKeepsItsDeadline(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: "weknoracloud", Model: "rerank", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -300,7 +302,7 @@ func TestWeKnoraCloudRerankKeepsItsDeadline(t *testing.T) {// Everyone else has always run without one and relies on the caller.for _, id := range []string{"zhipu", "jina", "siliconflow", "aliyun", "nvidia", "generic"} {- other, err := catalog.Resolve(catalog.Ref{+ other, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -316,14 +318,14 @@ func TestWeKnoraCloudRerankKeepsItsDeadline(t *testing.T) {// all it takes — and it must be declared exactly where the extension is// accepted, or the form offers a switch the vendor will reject.func TestTruncatePromptTokensIsReachableFromTheEditor(t *testing.T) {- for _, v := range catalog.ListByType(types.ModelTypeRerank) {- var field *catalog.ExtraField+ for _, v := range modelruntime.ListByType(types.ModelTypeRerank) {+ var field *providers.ExtraFieldfor i := range v.ExtraFields {- if v.ExtraFields[i].Key == catalog.ExtraTruncatePromptTokens {+ if v.ExtraFields[i].Key == models.ExtraTruncatePromptTokens {field = &v.ExtraFields[i]}}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -350,8 +352,8 @@ func TestRerankScoreScalesMatchTheVendorDocs(t *testing.T) {// GPUStack: relevance_score, e.g. 1.951 / -3.734 / -6.157logitScaled := map[string]bool{"nvidia": true, "gpustack": true}- for _, v := range catalog.ListByType(types.ModelTypeRerank) {- resolved, err := catalog.Resolve(catalog.Ref{+ for _, v := range modelruntime.ListByType(types.ModelTypeRerank) {+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -369,7 +371,7 @@ func TestRerankScoreScalesMatchTheVendorDocs(t *testing.T) {// construction with the reason beats sending a request shaped for the wrong// protocol and reporting whatever the decoder makes of the reply.func TestUnimplementedRerankDialectsAreRefused(t *testing.T) {- v, ok := catalog.Get("aliyun")+ v, ok := modelruntime.Get("aliyun")require.True(t, ok)offered := make([]string, 0)@@ -379,7 +381,7 @@ func TestUnimplementedRerankDialectsAreRefused(t *testing.T) {assert.NotContains(t, offered, "qwen3-rerank", "the picker must not offer an unimplemented dialect")assert.Contains(t, offered, "gte-rerank-v2")- _, err := catalog.Resolve(catalog.Ref{+ _, err := modelruntime.Resolve(modelruntime.Ref{Provider: "aliyun", Model: "qwen3-rerank", ModelType: types.ModelTypeRerank,})require.Error(t, err)@@ -387,7 +389,7 @@ func TestUnimplementedRerankDialectsAreRefused(t *testing.T) {"the error should name the protocol the model actually speaks")// The vendor's other rerank model is unaffected.- _, err = catalog.Resolve(catalog.Ref{+ _, err = modelruntime.Resolve(modelruntime.Ref{Provider: "aliyun", Model: "gte-rerank-v2", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -411,7 +413,7 @@ func TestGatewayRerankEndpoints(t *testing.T) {{provider: "litellm", wantURL: "http://your_litellm_proxy/rerank"},} {t.Run(tc.provider, func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: tc.provider, Model: "m", ModelType: types.ModelTypeRerank,})require.NoError(t, err)@@ -438,19 +440,19 @@ func TestScoreScaleIsOverridablePerRow(t *testing.T) {for _, id := range []string{"gpustack", "generic"} {t.Run(id, func(t *testing.T) {base := "http://127.0.0.1:9/v1"- overridden, err := catalog.Resolve(catalog.Ref{+ overridden, err := modelruntime.Resolve(modelruntime.Ref{Provider: id, Model: "bge-reranker-v2-m3", ModelType: types.ModelTypeRerank,- BaseURL: base, Extra: map[string]string{catalog.ExtraScoreScale: "probability"},+ BaseURL: base, Extra: map[string]string{models.ExtraScoreScale: "probability"},})require.NoError(t, err)assert.Equal(t, api.ScoreProbability, overridden.Rerank.ScoreScale)// And the input to set it is rendered by the editor.- v, ok := catalog.Get(id)+ v, ok := modelruntime.Get(id)require.True(t, ok)- var field *catalog.ExtraField+ var field *providers.ExtraFieldfor i := range v.ExtraFields {- if v.ExtraFields[i].Key == catalog.ExtraScoreScale {+ if v.ExtraFields[i].Key == models.ExtraScoreScale {field = &v.ExtraFields[i]}}@@ -460,10 +462,10 @@ func TestScoreScaleIsOverridablePerRow(t *testing.T) {})}- _, err := catalog.Resolve(catalog.Ref{+ _, err := modelruntime.Resolve(modelruntime.Ref{Provider: "gpustack", Model: "m", ModelType: types.ModelTypeRerank,BaseURL: "http://127.0.0.1:9/v1",- Extra: map[string]string{catalog.ExtraScoreScale: "sigmoid"},+ Extra: map[string]string{models.ExtraScoreScale: "sigmoid"},})require.Error(t, err, "an unknown scale must not be treated as a probability")}@@ -476,10 +478,10 @@ func TestScoreScaleIsOverridablePerRow(t *testing.T) {func TestGatewayVendorsOfferTheScoreScaleOverride(t *testing.T) {gateways := map[string]bool{"generic": true, "gpustack": true, "litellm": true}- for _, v := range catalog.ListByType(types.ModelTypeRerank) {- var field *catalog.ExtraField+ for _, v := range modelruntime.ListByType(types.ModelTypeRerank) {+ var field *providers.ExtraFieldfor i := range v.ExtraFields {- if v.ExtraFields[i].Key == catalog.ExtraScoreScale {+ if v.ExtraFields[i].Key == models.ExtraScoreScale {field = &v.ExtraFields[i]}}@@ -502,7 +504,7 @@ func TestGatewayVendorsOfferTheScoreScaleOverride(t *testing.T) {// Every operator-facing string a vendor declares has to exist in both// languages, or half the product reads English prose in a Chinese form.func TestEveryExtraFieldProseIsLocalized(t *testing.T) {- for _, v := range catalog.List() {+ for _, v := range modelruntime.List() {for _, field := range v.ExtraFields {if field.Placeholder != "" && strings.Contains(field.Placeholder, " ") {assert.NotEqual(t, field.Placeholder, field.LocalizedPlaceholder("zh-CN"),diff --git a/internal/models/parity/testdata/catalog-baseline.json b/internal/models/parity/testdata/catalog-baseline.jsonnew file mode 100644index 000000000..9f74f4c1b--- /dev/null+++ b/internal/models/parity/testdata/catalog-baseline.json@@ -0,0 +1,353 @@+{+ "aliyun/ASR/qwen3-asr-flash": "bb6104c02ce1013fd954de79c4998fd5b9e96e8b91cbbe083c9bc02a23660d7a",+ "aliyun/ASR/snapshot": "error: catalog: aliyun does not serve \"\" through a protocol this build implements: Alibaba's other recognition models take a public file URL or run as asynchronous tasks; only qwen3-asr-flash accepts the audio in the request",+ "aliyun/Embedding/multimodal-embeddingsnapshot": "841622b61917a7ec092feffad27e86d4a9125deecdc27d46117c439d44c85806",+ "aliyun/Embedding/qwen2.5-vl-embeddingsnapshot": "b975e014ce58f39766a416bd75098b7d17124a63a71861b5e53316ef2eb22b1b",+ "aliyun/Embedding/qwen3-vl-embeddingsnapshot": "6360c00080aace602f2f430b8fbdd61a03db3307fe8d760b4fd72c516361b57e",+ "aliyun/Embedding/qwen3.7-text-embedding": "1747d31bcb369f32605000f3f2cc59406a4f7ddc5be6123c80e4e06f5d7fc2e7",+ "aliyun/Embedding/qwen3.7-text-embedding-flash": "14ce61f8e4aea6394b43f6383bd2ec3d1398abd0a8d666374c4300fb86845cd5",+ "aliyun/Embedding/text-embedding-v1": "1e7d78c2635542f53008f0aa30d69544fd4fae3a48d36745b027875005cfb2d6",+ "aliyun/Embedding/text-embedding-v2": "b3eb2440097a26c93dea795bdf9b9d1ea4d4a11f1e20a034e2bb146d7226883f",+ "aliyun/Embedding/text-embedding-v3": "ef7acfe7150c048a9c46d5e8e2bc14d890df0721f877d76c41e6a2ed275bb7cc",+ "aliyun/Embedding/text-embedding-v4": "acd6a3536ee4f98330fb02e39c9f1952dbb1eb578d70a82c64278355ca44bc36",+ "aliyun/Embedding/tongyi-embedding-vision-flash": "4e471e8267f1a58f999fea0c7c8d7280f96977d08f5381845195d98d141103c4",+ "aliyun/Embedding/tongyi-embedding-vision-plus": "0962b5ddbc901c0428bcab0ab362059ecd1628b6e1c8b41907122d6e8a037068",+ "aliyun/Embedding/tongyi-embedding-visionsnapshot": "f6dc43b2e5f638957bb1fedb361d4bd5f68a86d656ca1bd662be21695d18c9f9",+ "aliyun/KnowledgeQA/deepseek-r1": "735322a596dda4a914b7e53041643eab61bd90b51e18e0cffd36dcc807b6fd16",+ "aliyun/KnowledgeQA/deepseek-v3snapshot": "b3e72a6d322e5d53b18cf1204434be5f75de77262e67bab838492376c7c287b3",+ "aliyun/KnowledgeQA/deepseek-v4-flash": "ac9d4d9224054609f98ba4ab3fc32c47b99f6af8c4153793a2fd00f5495212e9",+ "aliyun/KnowledgeQA/deepseek-v4-pro": "721e53ca9a8ce694089bcd40191192bc977da23b4a1d4bd0dedf4fdc49211d22",+ "aliyun/KnowledgeQA/deepseek-v4snapshot": "0d8da530ae0a30876180c66297759e2432c7f1d75a3d619a8d16e62a68855947",+ "aliyun/KnowledgeQA/glm-5.3": "4dd3f7f0fa9a150dc5f5a04ac2e966d4ba72175469899595e2be1e25b3ced1cc",+ "aliyun/KnowledgeQA/glm-5snapshot": "1ac48a35980b980f74bba9ec66d544f4002d0cae9a56df6e56af048a4638d773",+ "aliyun/KnowledgeQA/kimi-k2.6": "c3abc2f5dca8649975aeba02b65d00b5e9d52a42d1ed78738e4ab52f21519cc6",+ "aliyun/KnowledgeQA/kimi-k2snapshot": "fe5309c7a15bd6d1a1f0a7a6ff6781114bca8df784d51426d10435f3b6bfe801",+ "aliyun/KnowledgeQA/kimi-k3": "bc5876d0856c08564e99bf64fe7d3d146ac198dbe2162aed5da5dc31e4414e76",+ "aliyun/KnowledgeQA/qwen-flash": "0dd76b78c1ec61684c3652e2071669dd7cf3bfebf5f2ac5455256ab7a3fea943",+ "aliyun/KnowledgeQA/qwen-flashsnapshot": "c87b62a72825e100762a35f59a9de188e5c32b9af200a88f52f53b31e242919c",+ "aliyun/KnowledgeQA/qwen-max": "6cbf111674fb87b581e0a00ba5bc374f755350df9f0f1b04cb1c57f2fbcf93bd",+ "aliyun/KnowledgeQA/qwen-maxsnapshot": "a82d0a42e7fda949b518405d13d1ffb00c2e638b9057eaa023d97133e47202a7",+ "aliyun/KnowledgeQA/qwen-plus": "9cddc4357709d690a0d6fc7c4f5e489f2be896079a5c2c0865ee8d584cb0710b",+ "aliyun/KnowledgeQA/qwen-plussnapshot": "71d8ee8a8211fd8185fa6d55ceb54d3bc211bab28de145eed903909ea56f99b9",+ "aliyun/KnowledgeQA/qwen-turbo": "2509ff8973a28864388f0f78bc9cf5ff39c41badcbb0b68c006fbd737d8b733f",+ "aliyun/KnowledgeQA/qwen-turbosnapshot": "763ccbe6edf8591c503e0fa583ccb57f2f3b1d3301d8755f281b93973c86ffdd",+ "aliyun/KnowledgeQA/qwen-vl-max": "363afe785842c67a130d5b52276898907ab6ec68fa94f7daeb92f620d9461241",+ "aliyun/KnowledgeQA/qwen-vl-plus": "93ceef7e0934e75ba46c29808100d06beb5b17e166d42b1a8f9b67827445bb20",+ "aliyun/KnowledgeQA/qwen3-max": "26c68d4418a2ac820f38298cc02c819759ad07ad73f1cdfb0717c2f3fb3b4777",+ "aliyun/KnowledgeQA/qwen3-vl-plus": "a9c17b4adc677e16c45c46f7c3d349050cf74f8bc45f4b00801d27bcef7afb0f",+ "aliyun/KnowledgeQA/qwen3.5-flash": "031aff057e413a6fbca8e23ad0c49c87c21966ee6a9433e62974da629c0e601b",+ "aliyun/KnowledgeQA/qwen3.5-plus": "0996fbdbd529902600e90b5479fd33433a1a42dbfc5bd048261f8e731fec1199",+ "aliyun/KnowledgeQA/qwen3.5snapshot": "aaeb6e1305ae6ed1e17f1f7d6f63998a6be1f643266510bd0b22de04cf1ec269",+ "aliyun/KnowledgeQA/qwen3.6-flash": "b0d78ba90bc8389faf889ddb233433c9064be614c223f9e642d56a76343631a6",+ "aliyun/KnowledgeQA/qwen3.6-plus": "ae8db4ffac0edb2acdc88415b4b86d7684b0c240adb5dc14d4396b83b249c287",+ "aliyun/KnowledgeQA/qwen3.6snapshot": "99d81f0501afe9bc35d73bde4994bf9694c3eac8df3db5555bda7ebe9a4d8c2d",+ "aliyun/KnowledgeQA/qwen3.7-flash": "bb843bbbcb15592b40b0440eefd62ccf33071296fafe2f62ad91b568d79a2278",+ "aliyun/KnowledgeQA/qwen3.7-max": "2d928e94ee5a8f4c7929b7864811809f24c9111c07c29ef5636a4f9100b5d24c",+ "aliyun/KnowledgeQA/qwen3.7-plus": "a9c62431dbc611c0fbe8143abbbf6684fe693b80ab0df6ef51f3420c434c234d",+ "aliyun/KnowledgeQA/qwen3.7snapshot": "c4f7868c2d989871b19f56ded1c2618681c42c9df3e21387b79592e684bce552",+ "aliyun/KnowledgeQA/qwen3.8-flash": "cfc1b3931753e0c95289e593b1b090492ab406cd5ba61e7b2517d9a0ca3202b7",+ "aliyun/KnowledgeQA/qwen3.8-max": "59599abf4bf64d2f9c7a3facb860fcbcddcdf833533202d6abf04f67b86bc4ec",+ "aliyun/KnowledgeQA/qwen3.8snapshot": "c7ca540b17a3b0c74abaf31bff8e3c5f6cf41011c36380931086c13f9adf947e",+ "aliyun/KnowledgeQA/qwen3snapshot": "aa634e380fcef6efc6ce9c096acb8d7ad75f8d80e3c078829ab47a08164d4cc8",+ "aliyun/KnowledgeQA/qwq-32b": "b05df754c2d09e0fe937e85c6bda28b71ef3e694c0e06c17dccdbd9217fecb28",+ "aliyun/KnowledgeQA/qwq-plus": "7139911fda2d14b002889abbd06c185e550bec0984cea85116510b17ba4063ea",+ "aliyun/Rerank/gte-rerank-v2": "27219a2ffc212a35e9eeacf87da136410342e1915dd1141dc3357d7b40f9595b",+ "aliyun/Rerank/qwen3-rerank": "error: catalog: aliyun does not serve \"qwen3-rerank\" through a protocol this build implements: qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet",+ "anthropic/KnowledgeQA/claude-fable-5": "8cb0c332960f271acac66df25e0b8a1259c863994b6d4ef3c9be3df47f85b5bc",+ "anthropic/KnowledgeQA/claude-fable-5-1": "fe4ee19f613745815e5caa1f258e67f9f9a901f5fc45c1d4cce030bfa6287b72",+ "anthropic/KnowledgeQA/claude-haiku-4-5": "5eb4abef41f957d98c0a15c83de48c0e6b46be48d59f761ba6006c29010487f9",+ "anthropic/KnowledgeQA/claude-haiku-4-5-20251001": "50878a87d7d212c8f295f191343f77200d71e71337b934a07a949ce04ef976f1",+ "anthropic/KnowledgeQA/claude-opus-4-5": "3536e5a1bb14f6e980eeda66cca9d7fc8bfea8c6b26937765069d93f713a673d",+ "anthropic/KnowledgeQA/claude-opus-4-5-20251101": "78bfa567c9c17acb9488ea0a7aaccb5b0e73e840db8c4955731debf1382ff8cf",+ "anthropic/KnowledgeQA/claude-opus-4-6": "96f08927c9e9df5c113102d498d38c1aab3a7280f350f14cfe8fad4dfcffe039",+ "anthropic/KnowledgeQA/claude-opus-4-7": "7b85755f5c9166ecd8e2e25d1ac60e580aa982ec8ab735c52fdec20dd8fa0db0",+ "anthropic/KnowledgeQA/claude-opus-4-8": "aedacfa002c376af796c1eae5063d9fb17a1b980e0528207621f47d723b702dd",+ "anthropic/KnowledgeQA/claude-opus-5": "6657decfbaaf44e3fc4aec8ac14fccd7e569e8614ce7127049a092de821132d3",+ "anthropic/KnowledgeQA/claude-sonnet-4-5": "176ba6989053acf35be0a6acdd421c1c94c20f183358544eb0343c6e74897220",+ "anthropic/KnowledgeQA/claude-sonnet-4-5-20250929": "6757d77ed1d25cf80d04d2d35217a7f5d94e37f1b7c3545bf1613ac0494ec388",+ "anthropic/KnowledgeQA/claude-sonnet-4-6": "c00c494964632af431731f6fdf2ba4d697d42b8e58600e8a28e6a880ad6f0cda",+ "anthropic/KnowledgeQA/claude-sonnet-5": "bcb9eaafd30ca276f91fddf6bd62cdbdce38129300abd069e202245568273f41",+ "azure_openai/Embedding/text-embedding-3snapshot": "0c2f547ad2206affe719f6f0775ee73574a4dda8a7993a699ee9c4e7d4983cab",+ "azure_openai/KnowledgeQA/gpt-4.1snapshot": "6b6e303e1e4ed32f972e8224ab090f835e63570543036912809fc6e2551f923c",+ "azure_openai/KnowledgeQA/gpt-4osnapshot": "69fab35e2db1fab9640c72ab3b0c7acae322a1d0758c61ade28bc39fb9f9f750",+ "azure_openai/KnowledgeQA/gpt-5": "db0a775a9c41d10b19d7707826820455e4b8f07cd5fbf9340f1329d97531d564",+ "azure_openai/KnowledgeQA/gpt-5-mini": "4b0569c209354289d80d9e897e199a0deb1e759b685e1f1f13d87b5a54aee4d6",+ "azure_openai/KnowledgeQA/gpt-5-nano": "362639f61878bf5dbe5c1f61172a7f617984014ef23e2d2183d0debebf17ba3d",+ "azure_openai/KnowledgeQA/gpt-5snapshot": "0212af206f4f3be585e5be378ae78d2a72e127dfd017b2ea3f0e31680377a15f",+ "azure_openai/KnowledgeQA/gpt-6snapshot": "32f322083e4d338bad9d46878e193be7914754a38771204a2ea110050b8fa655",+ "azure_openai/KnowledgeQA/o1snapshot": "932a1de3ec30ca2f61c26391d01e8053c167417818a347f1fff3968351992868",+ "azure_openai/KnowledgeQA/o3snapshot": "06838afe2bf35d03ad99cdceb6b088f272fa83aa4cc25d461d3b0ad034573066",+ "azure_openai/KnowledgeQA/o4snapshot": "5a234aaf785bf4b2835f8dbcc49b0f6ce886743ef6d429c68180ca247c9b5a3e",+ "deepseek/KnowledgeQA/deepseek-chat": "07512b23255f3d8ca9b19123617f7fecdf0da538b6d4c3ea7773ccc73a08be00",+ "deepseek/KnowledgeQA/deepseek-flash": "77d77b5c366570d4ba6e9b088c2690e8970e0284af7f5a6b4c114ff2024afdd3",+ "deepseek/KnowledgeQA/deepseek-reasoner": "0765764d483664d8df1d1fe2c708671a74eb355764cec3e7a3e1cfe0a1b6e89a",+ "deepseek/KnowledgeQA/deepseek-v4-flash": "a1d11bc227bae61b53cd3642d32c59affa715b2cdb73fc53995c6a0ad9977438",+ "deepseek/KnowledgeQA/deepseek-v4-pro": "5b245660012e5b1e4160861575244ecd1d0feb9b24a366d10cc58b4ae8257786",+ "gemini/Embedding/gemini-embedding-001": "2126e8863f9ba5d4cef4e0154c5b8ce8579dddd7d8aeb674bb74632b6294a7dd",+ "gemini/Embedding/gemini-embedding-2": "e99a5211364c62e875aa93c65911197d150f8e5581654705da6433ca129c34e7",+ "gemini/Embedding/gemini-embedding-2-preview": "a9d78acffaeabbae5c554d346a2c5893b7b68882f239cc5fc1e108126d4c8260",+ "gemini/KnowledgeQA/gemini-2.5-flash": "8fd1fd7205b512d2e7c506f171d4cf09f77e7c1f08d327942e42a63dd6a10560",+ "gemini/KnowledgeQA/gemini-2.5-flash-lite": "04688ec4b28a2ffc5afd5fa501b6ea144c3ee519badcbb36d82b61d44a25dd17",+ "gemini/KnowledgeQA/gemini-2.5-pro": "6929d8015b51e7326d9de5f333408b7abe91c23f87623af4f4434a78a6cbbaa2",+ "gemini/KnowledgeQA/gemini-3-flash-preview": "b2f619cdd5fbcd2202198be74c9215b1998e3e428cd46f7c38a38dceeee36542",+ "gemini/KnowledgeQA/gemini-3.1-flash-lite": "c8a1e2b17e829616366e2ad52cfb2e331c6e62e6c9682150da6ec5a0ebb94604",+ "gemini/KnowledgeQA/gemini-3.1-pro-preview": "53ce7edd9dc46112991f6ea1746dc419abcfad267c694db8d461fdd9a4275177",+ "gemini/KnowledgeQA/gemini-3.5-flash": "2abcc9d6223b140d31e73c4ea63f9f25b9728c6bea9dcfd4bc1e7ec96d985a96",+ "gemini/KnowledgeQA/gemini-3.5-flash-lite": "9c9815ef99aab3ab91926ecd8e0586598dde2737fe533d43d70c839bddd62521",+ "gemini/KnowledgeQA/gemini-3.6-flash": "8be4820a9da0c156cad0684936bb3c6f1ae0833065cb45952f8d0027a5eb1fee",+ "gemini/KnowledgeQA/gemini-3.7-flash": "570b30391590c3fa380e98e8323bf2187635d18db427eae3d75f9e63def26c8d",+ "gemini/KnowledgeQA/gemini-3.8-flash": "6d40802ed8d3b310e1e91c186f769a4f8a298138538853cf623ad43e59c29140",+ "gemini/KnowledgeQA/gemini-3snapshot": "c5931f2304774b718637f47540e78b66cbf855b4a4189c9fc0cea2040a12951d",+ "generic/KnowledgeQA/gpt-5snapshot": "3e3712264316db008c1465a2d7c395072d85942d0352196e456342cef0b14eb0",+ "generic/KnowledgeQA/o1snapshot": "52340886b4160a0cb9342ae33a7c81304c9dad5d22c2d1c1ce073f89860a30b1",+ "generic/KnowledgeQA/o3snapshot": "782e836769e56c43d9c954ab2d563df7d2f476ae4fb4d588bb8bf3c88ae42ce6",+ "generic/KnowledgeQA/o4snapshot": "dc652fe264d2c9bde369307bc48e8136ba92a5d31a54676374560ba878f2190a",+ "hunyuan/Embedding/hunyuan-embedding": "8f8dff4309455e2bb4566768b6d335b34359a7d6aa5253eb11f3b59d16517c5a",+ "hunyuan/KnowledgeQA/hunyuan-2.0-instruct-20251111": "1a634287a65c3317056937c9e9e35e28ae79e326f1910ee0f331618fc076acb9",+ "hunyuan/KnowledgeQA/hunyuan-2.0-thinking-20251109": "1e982bc103cfc5830b0634a9b1a44a1a33bece3647606c712016c89ea17af467",+ "hunyuan/KnowledgeQA/hunyuan-a13b": "615fcf75935e1b842cbfaf188d212546dd3a5450f1a850c7c7c269f3b3263dab",+ "hunyuan/KnowledgeQA/hunyuan-lite": "c2a18cc8c2fecd9f807dc0a746c287c3a111bc0fe68453806fcd511c388f48e9",+ "hunyuan/KnowledgeQA/hunyuan-t1-latest": "6b5be11d928cb578f87ad8fb151dabc2b41f9882e0eec5c2bbbdc63c8a9d4aac",+ "hunyuan/KnowledgeQA/hunyuan-t1-vision-20250916": "edfac3f8a8a9b5f32852f4669b9cc13f3c8d326a3ab5f01008135b474853e5dc",+ "hunyuan/KnowledgeQA/hunyuan-t1snapshot": "6d8d26d354fc6540e269a51d5a2e1108520e0c08133ca38f78d459ba0691770a",+ "hunyuan/KnowledgeQA/hunyuan-turbos-latest": "e0c9996172983b9d47994f073438aea931bdd995b7794c84eae745502afb3466",+ "hunyuan/KnowledgeQA/hunyuan-turbos-vision": "de1994d9055a856578b34082829c6de1728633d1e7e664b02b993131797f1291",+ "hunyuan/KnowledgeQA/hunyuan-turbos-vision-video": "07d35ec30279d336e39257ff80f558dd69ffa1c3e865a34a1585f2a261aad640",+ "hunyuan/KnowledgeQA/hunyuan-vision-1.5-instruct": "eb831ff45f66229ed468214ad2c40cd89e07d60021ee79685ff58d8cc68421e9",+ "jina/Embedding/jina-code-embeddings-0.5b": "b0d7bb78d59e7ab07673bdff461f516c5b50a48903d0eaeeeb01bfd0f53fa730",+ "jina/Embedding/jina-code-embeddings-1.5b": "06932f7c3e756ebfaedbcc60ff918cd7b544e3b4fdfaaca3bf49ef3746073e04",+ "jina/Embedding/jina-embeddings-v3": "34fede5426a6aa78e1e2c575a7fef52afd3af53331155f15e82d6ae566beff69",+ "jina/Embedding/jina-embeddings-v4": "f8b2c8a0328f5ba3b2e3eacb72dbbab13558d3961cf9c51eb76535b6a9d8db0b",+ "jina/Embedding/jina-embeddings-v5-omni-nano": "90d9ca7bd2bccbe643d984d5eff478f09f5190436d5baefbc498e700bd7131c6",+ "jina/Embedding/jina-embeddings-v5-omni-small": "fe239e4fc9e4ef3e61f6a43ea9eab9b23a249d85e8d2fbc38d2d5368fe0d6811",+ "jina/Embedding/jina-embeddings-v5-text-nano": "c9efe64eee9dc11b2583155ce522af3332188b5bbedaaa8bc07caaab54910f74",+ "jina/Embedding/jina-embeddings-v5-text-small": "16bdb3d6cba14b0fd16786cb6e9c16dfa411488661ff134629a330b0cbc9cba4",+ "jina/Rerank/jina-reranker-m0": "056816679d30640e0c9c0583d42cb1db42bce784206d85397dff780ff6762552",+ "jina/Rerank/jina-reranker-v2-base-multilingual": "40e4c4971b8fca257fd877fe92d59f8f4042552c07f8c0d3d282eddee491686a",+ "jina/Rerank/jina-reranker-v3": "686a1e72192f3d0d4ca422135c08612131a96017eea0dae371ec390c81497ea7",+ "jina/Rerank/jina-reranker-v3.5": "04141df650d26082775e4dda0e41c1fe0aaa712edcb6d70b2db71c2788835dcf",+ "lkeap/KnowledgeQA/deepseek-r1": "910b88dd40f5445e1cb93d4f1f75d0a918b6c2cbbfb2f6dd626486cfc30a01af",+ "lkeap/KnowledgeQA/deepseek-r1-0528": "e29f4d275bd351a9cba4dd109a13c70326403c50eedc630ef8c3d6be4c6b380d",+ "lkeap/KnowledgeQA/deepseek-v3": "1d95b0fcec9e157382300ff255b002fb81073020f1d857b47ddff7c8c0cc6899",+ "lkeap/KnowledgeQA/deepseek-v3-0324": "5d66cc4e847187520a51e6976edc2dceb11f1ef1ceb3bbc35b1c5f337e2a1f58",+ "lkeap/KnowledgeQA/deepseek-v3.1": "b51473160f3d344f85d5e0ae45ac6f1db7343781aea471c4a9c7ddd72dbc1e5d",+ "lkeap/KnowledgeQA/deepseek-v3.1-terminus": "6cd662bc9e0fd9b7e51f63dd97552f991897339a1e28301c099ee67c3a13fbc7",+ "lkeap/KnowledgeQA/deepseek-v3.2": "3ac1f719fd185a24d899de8b0ab8bce08c55fdfaeaf4370e8084d80eb7841456",+ "lkeap/KnowledgeQA/snapshotdeepseek-r1snapshot": "5fe12a729af1576b4446cf21e2df7d06147d1213da0b15bec1058ff4236fdf66",+ "lkeap/KnowledgeQA/snapshotdeepseek-v3snapshot": "b488b275212bd6fb7543b43798aa30d5008a231d7cae749e06a2be3b469f5965",+ "lkeap/Rerank/lke-reranker-base": "6e8dcdc74c37d9cf8abd2c513dcd8e79d43d6fc52ddc3bb44a95b25a6a191f52",+ "longcat/KnowledgeQA/LongCat-2.0": "84748558b2d2dbdad28bfb9937d2cb8fd867cf6d6240f561eb4278b93f186b4a",+ "longcat/KnowledgeQA/LongCat-Flash-Chat": "7f27f6c3e463fe45a39144ca5e0ca934e1157c7251e695a9f470d66bb63c4afb",+ "longcat/KnowledgeQA/LongCat-Flash-Thinking": "30269a2c7037a4b928b0ea4164f9934f4dca117b03574de470e2d8053a8d661a",+ "mimo/ASR/mimo-v2.5-asr": "cfd5e7af20f9bea915399d1de654049880144fd3b16b46d38563b328545f7d53",+ "mimo/KnowledgeQA/mimo-v2-flash": "a1111e2792de419143f71c33230097b3d7e0e5b525c6e217713940f0a9e34246",+ "mimo/KnowledgeQA/mimo-v2.5": "a53a5bf889aa110e4460fed294a3230758ddaa49a6db60e8b0408fe183a60ed9",+ "mimo/KnowledgeQA/mimo-v2.5-pro": "3c38342327d6286db15a7548f651c2780d8b0998b2671d05f187781eb6a23262",+ "mimo/KnowledgeQA/mimo-v2.5-pro-ultraspeed": "a47aba2614020595d63accdc1c3c6058cfebdb3198df58936fb95e28c9046092",+ "minimax/ASR/asr-1.0": "3466d2d1953d8165ba7677de85f36fa933118f5dc902bf39fdfa9158b0ec0eab",+ "minimax/KnowledgeQA/MiniMax-M2": "145995deb36b85b3f0933c4aed6273b97cbacf92891cae224949dae906d251cd",+ "minimax/KnowledgeQA/MiniMax-M2.1": "b745d75ad3095e2fdc25d22d7f723c30078b9bbb155c4d0f7d1bc64c5dbfbb59",+ "minimax/KnowledgeQA/MiniMax-M2.1-highspeed": "6f3d05e123ef452d9ed0b40456ccbe08c552ca2408f225dce40115add1b23fd5",+ "minimax/KnowledgeQA/MiniMax-M2.5": "163e53955eb8a46362e4581513644be9c86c39ff744819f777ae4f2bd81bf81d",+ "minimax/KnowledgeQA/MiniMax-M2.5-highspeed": "c1731e761db65503eaa72acdba28c95a1eaae15882d813534f7831b3256022cb",+ "minimax/KnowledgeQA/MiniMax-M2.7": "2efbb13fcb0efd7c36987ad5d12d1d6c1d80f2e0b5518abeaac8dc603ff44050",+ "minimax/KnowledgeQA/MiniMax-M2.7-highspeed": "7f7518fa498dc12eeec38d8d73daae4f1a43a207d07b9d2369948aaca347c5e8",+ "minimax/KnowledgeQA/MiniMax-M3": "e0ab669e2f427ed88ad4d5defec501fa835fa6e32922f8942be5216d5076b92b",+ "modelscope/Embedding/Qwen/Qwen3-Embedding-0.6B": "a4515af27268a360fe7ee62eb4c4785bc5e3079f65e0264acc99ba974b9a777b",+ "modelscope/Embedding/Qwen/Qwen3-Embedding-8B": "a76960f74528a100af92aad4def93306da5eb819ba8fc916693197d779f0ebd2",+ "modelscope/KnowledgeQA/Qwen/Qwen3-235B-A22B-Instruct-2507": "cbd8290913b5b1a584aaa9cd20ccb6478b67c62a73d9aa3f9f9c5aee0baf7d80",+ "modelscope/KnowledgeQA/Qwen/Qwen3-235B-A22B-Thinking-2507": "35599fb7d339e43401eed51973c8f67f2440c40e96c4dfdcdb6f0393d39163be",+ "modelscope/KnowledgeQA/Qwen/Qwen3-30B-A3B-Instruct-2507": "de63c30b559ee1b70d214465c67091c8892ed30e1213b1df7bbe06d22c4a31d5",+ "modelscope/KnowledgeQA/Qwen/Qwen3-30B-A3B-Thinking-2507": "e2e2b90ca7a7178d660a86796a671d9ca05311b13b5c3d10a914a33249de0e77",+ "modelscope/KnowledgeQA/Qwen/Qwen3-8B": "d9650153601f0e158e9799a2da4059925251959366d6bd511878c8c02ac49de2",+ "modelscope/KnowledgeQA/Qwen/Qwen3-Coder-30B-A3B-Instruct": "54874cdaf43b7b91c520b7db9e33bf45cf7ae64aa2fece00c9d0d4c14e8c8bbe",+ "modelscope/KnowledgeQA/Qwen/Qwen3-VL-235B-A22B-Instruct": "3fae347f784339e772be3d18d13182822ef2d16581ee4e2a588f5dc573945146",+ "modelscope/KnowledgeQA/ZhipuAI/GLM-4.5": "4c3824594e8801642e459a728ef3d786fddf5ae9b7cad658f3ca868834d98d8f",+ "modelscope/KnowledgeQA/ZhipuAI/GLM-4.6": "3c7c2713d06b22fef0cb7c4ca002c9d14049abf37be9750716d403e64caca607",+ "moonshot/KnowledgeQA/kimi-k2-thinking": "78e9accc9b580b7b4ddfe804b6d234912d906e5b84098db9378743a933d653fa",+ "moonshot/KnowledgeQA/kimi-k2-turbo-preview": "eef0bbc6a30c62c3125ea3bec013c99ce23c135e00be532ebf69f10946e2d197",+ "moonshot/KnowledgeQA/kimi-k2.5": "dd37529bc898f32b26c1261396b9bd5461ddc36da08b43743185a9af4551555f",+ "moonshot/KnowledgeQA/kimi-k2.6": "6a6e887f73fc5abcbe313c9ce5f15206f605b2f2f713c11acce3d720f8ba4c50",+ "moonshot/KnowledgeQA/kimi-k2.7-code": "e010d8cac56af5fdd145466dd229bbc3b21ce7120dd2840df7a79599dd51126b",+ "moonshot/KnowledgeQA/kimi-k2.7-code-highspeed": "2f6a58da0d422895eb49a1e2a85ef3ad1c25569c83ab6e08425a03ce39c08fff",+ "moonshot/KnowledgeQA/kimi-k3": "d762c5e5af93b109df5ea421866ccb260f819a12768cb19e88f708ed39bc6e06",+ "moonshot/KnowledgeQA/moonshot-v1-128k": "a083f7226a9ef76bd048db7852bfe263c8f080b5725b1dc0b99257ae3841ffb8",+ "moonshot/KnowledgeQA/moonshot-v1-32k": "ba0dcd86e11bbcec03725d605d6a50ce308d5f6682fd9522b101a7ef81f2f709",+ "moonshot/KnowledgeQA/moonshot-v1-8k": "118b5c3533abac97b6f364a3341d599856c5724842ccd809de6a27e7d78a9a5b",+ "moonshot/KnowledgeQA/moonshot-v1-8k-vision-preview": "dfce889dafa16367941825e7e496b2ba542c0f950d796d30e60bc611ee20ea55",+ "moonshot/KnowledgeQA/moonshot-v1snapshot": "ad805e8b2951004069afc16305e6dd5d24570bce9454fff41da4c89b0b552e8a",+ "novita/Embedding/baai/bge-m3": "ead230cee65e288b3f8f1befb4cfb39dddf581528bb617a46feaa76e0454faab",+ "novita/Embedding/qwen/qwen3-embedding-0.6b": "fd7fe2850e9f193d11bb27f1130bb325b95d95156c879f770c6e303599298e2e",+ "novita/Embedding/qwen/qwen3-embedding-8b": "870036141aea257889436fc43fef077f91ca92451c5c78cd14fcb10697bbe7be",+ "novita/KnowledgeQA/deepseek/deepseek-v4-flash": "46882c5a6f42c8c50189bd311fcd34e0f19e073006d94c403f7f7a0d130fb981",+ "novita/KnowledgeQA/deepseek/deepseek-v4-pro": "202e557b0ae3ec4cc2647b9c362ff0b8cb36d381d296ba5cf74bc1a3df8c7095",+ "novita/KnowledgeQA/google/gemma-4-31b-it": "3302698feace987ec23fad14ade2b771eef6cc60830baab3c93f0341994a475a",+ "novita/KnowledgeQA/minimax/minimax-m2.7": "d46d5b8360a5d7d6a7c81750234fcde3bbff8a308368b85d098d7a5afec27795",+ "novita/KnowledgeQA/moonshotai/kimi-k2.6": "1db1fe6b65cfb73ad60ee112020f7a44bf1d74b0bc5177ad49b1af5d19526811",+ "novita/KnowledgeQA/moonshotai/kimi-k2.7-code": "4c84bb9463ccec60043eb6a1682f85b2de44e3257aeb6bae036b3de4bc3f6ee9",+ "novita/KnowledgeQA/moonshotai/kimi-k3": "a4a9490695fab439e2ff3bbc428b3632cd6e1a2661c7664c76d86b0455c5ac30",+ "novita/KnowledgeQA/qwen/qwen3.5-397b-a17b": "7d73f0dfcf6597fa8d885a7b23cfbc3dee5cf2999e8787c490da7d3e2d27ae07",+ "novita/KnowledgeQA/qwen/qwen3.7-max": "e9ba323773ced5ebf841c3f58d68836a9123faa00ef6c307886f66d03c727ded",+ "novita/KnowledgeQA/xiaomimimo/mimo-v2.5-pro": "c5af6bb090696d50afb7564d863e05e62d889f285eb385e676e2d3bf5064ae79",+ "novita/KnowledgeQA/zai-org/glm-5.1": "f5e07a2348ba716a0c6fca88f9233bb591e38ba893290085a57098e94d0a90e2",+ "novita/KnowledgeQA/zai-org/glm-5.2": "5801f0529d010aa9d60e4fbbb00be0ab90103fb241361daf03f9b81fc4975af5",+ "nvidia/Embedding/nvidia/nemotron-3-embed-1b": "d5117e8e9b70279b2bd66152840f6c6421e79cdc953b76f8227573e9763f8216",+ "nvidia/KnowledgeQA/deepseek-ai/deepseek-v4-flash-0731": "f2c975c6dc38d31fc297c847c0d4c82173dac24252886b4c91ae8ea3bad87bae",+ "nvidia/KnowledgeQA/deepseek-ai/deepseek-v4-pro-0813": "ab2c7147362fba415f417037e4cc9a55c851613cb5febe1adc6867c9d8d68814",+ "nvidia/KnowledgeQA/google/gemma-4-31b-it": "2d9d31c3f69fedbf720aac946e6ef7226280ee2d9cd11e2f41cb1f8a8ab05f3d",+ "nvidia/KnowledgeQA/moonshotai/kimi-k2.6": "a62ebedfac75c0cd21a02ea11dfe6a3f7c021c0a055338268122174385cdf63d",+ "nvidia/KnowledgeQA/moonshotai/kimi-k3": "26588e04850c35ef81c921daa4577ad50680cdd94570a795c2b0a26558c797b7",+ "nvidia/KnowledgeQA/nvidia/nemotron-3-super-120b-a12b": "c0b0e182881bb1cae1d5e09edf0b18008ff84e766e71bf7f21540f77d3083aa6",+ "nvidia/KnowledgeQA/nvidia/nemotron-3-ultra-550b-a55b": "16a998db79f88f0014802d020cc38cb7819e4c961964c1cb358cf698e3ca43c0",+ "nvidia/KnowledgeQA/nvidia/nemotron-3.5-lightning-30b-a3b": "0b58b353733a2aa6c6254a31dd4b75e36eeaeb50fd87c79f89719db826c91766",+ "nvidia/KnowledgeQA/z-ai/glm-5.3": "5b2cc061f54a17df95cdf53e359faab697869a6ddfb24c945aa7823577795c3f",+ "nvidia/Rerank/nvidia/llama-nemotron-rerank-vl-1b-v2": "16ac1bfe044ead2a6d46ee3a8c9b8ab6f2b8256ae2cb050121331d515fa466cc",+ "nvidia/Rerank/nvidia/nv-rerankqa-mistral-4b-v3": "7fb22c5cb8dfb51d09e8fd4ad0d174f4734cf174e1d270ec190a56460d4fa939",+ "openai/ASR/gpt-4o-mini-transcribe": "ce0044f799b08a1524971126a2881e0a0f830d26cc44f141f93f944ac55eee8b",+ "openai/ASR/gpt-4o-transcribe": "3e533c7d02be1039d0316d2c4968ce73052240248baa096c1df5cabf713692e9",+ "openai/ASR/gpt-transcribe": "540a1ae5b477a4f73d9c2269bb3ec2b7f95459995140517987ae5f76e68b6899",+ "openai/ASR/whisper-1": "0636eb35239490f9e8e6a1d3fee44b9826a391e021e85aed7072c33fdcf2218c",+ "openai/Embedding/text-embedding-3-large": "3c14fc11141e7f473040fefb14ba5595e1dcb193e970b4480554935d1c118435",+ "openai/Embedding/text-embedding-3-small": "96dba6192448cf2a6e6b1aff646bd5be063e49fdea64b277555f4b5297b4560b",+ "openai/Embedding/text-embedding-ada-002": "410188713299a54711ca75e6d82c950d45e506602a71ec1dfbea298460a78d94",+ "openai/KnowledgeQA/gpt-4.1": "2c2025b04be58eb7dbb846ff5aa3098db2d4e0e556f5ae04a0727ed5ee122ed7",+ "openai/KnowledgeQA/gpt-4.1-mini": "6cd397454d5b4ff738b14c93c58bab88a447904da3332d8fa35aa9e137e1eec1",+ "openai/KnowledgeQA/gpt-4o": "49267acbe5769cff75edff28caa8880e23d7465d3381c13f6464fcf41cd11ceb",+ "openai/KnowledgeQA/gpt-4o-2024-08-06": "d2b5c47db996452cc672c75388b25da1462a60f302389d95029d50555e2bc95d",+ "openai/KnowledgeQA/gpt-4o-2024-11-20": "78c808e3cc9659ab1d27efd829e12313a8f7bf8e587ed856a2d85ae182d68921",+ "openai/KnowledgeQA/gpt-4o-mini": "39176c7bf6c81072957a5955c1804a75ffcfbb3cda03cbfb40ee15389927218b",+ "openai/KnowledgeQA/gpt-5": "1b8a325e646c0251225a1d83099eb67544dfd637e6fbe4489ea0399e59174ddb",+ "openai/KnowledgeQA/gpt-5-mini": "687e595b4d87b87a62230103fe10895e131795eef2c83e5a69daddfaea36dd02",+ "openai/KnowledgeQA/gpt-5-nano": "c0802166ccd659d2078118320182b73c6d6f3137f68838a15271e905e3e28ee5",+ "openai/KnowledgeQA/gpt-5.1": "a655f01773da62bb4dff4c26e6880465e83816e976a17052c26940068fdd5cee",+ "openai/KnowledgeQA/gpt-5.2": "37ed13fbd98481774ed42a462ee36f07d46776ff762e79cc63d37f80d6c8d31a",+ "openai/KnowledgeQA/gpt-5.4": "a4e18227d5b5bb6ba2ed085f36fdbd2d870abf6f2d43a253cb893eb34675661b",+ "openai/KnowledgeQA/gpt-5.4-mini": "2b491f50798d8ad85dadb59e9d9afb731ded5fee2b7479060e34e2749e5f3f63",+ "openai/KnowledgeQA/gpt-5.4-nano": "435903825985472fe57ad84d74233eb0f8cde613134e0da1c7c1d3e91072bdea",+ "openai/KnowledgeQA/gpt-5.5": "2ec73f0f32e00993d395a02f62b53873f010991423400a59c1388d9759cabc29",+ "openai/KnowledgeQA/gpt-5.6": "f3ae64cf2bb8b366c5355b96f3417a0f1b5c033aec57489bc9ea091b0a3906d0",+ "openai/KnowledgeQA/gpt-5.6-luna": "315609c50a9598f6a9ae0411ed2aba39946fe6be868b06cb7177516cad28706b",+ "openai/KnowledgeQA/gpt-5.6-sol": "6646d9a8463b8dcc13d84a53cd16deb84613c132c480378e3f243b83df01ef19",+ "openai/KnowledgeQA/gpt-5.6-terra": "ee33f16f0630b8c7f23a64c724267fcb5d794dfc523a6ab38e20a48d4447b515",+ "openai/KnowledgeQA/gpt-5snapshot": "fc10abaa4f5b71bf2c4c46624109ed99d5c0ddc196517803d0cdf68ef92a9448",+ "openai/KnowledgeQA/gpt-6-astra": "1a4d4e1be37f472307da3af52dd6db448da7bed568fedf3086e548303fb460cf",+ "openai/KnowledgeQA/gpt-6snapshot": "75e800414ec7df086c55eaf36509de26a5f6ed000f0e38d2520191a4176c3ad7",+ "openai/KnowledgeQA/o1snapshot": "dcc4cb93570f7fcd128679b692a27e2cc6e6ea38f37f2e7ad9ce6e28ac6749e8",+ "openai/KnowledgeQA/o3": "39cf8e5211e93dae65a14f9c6c5a76172844266690c4f448e5eb401bcd766572",+ "openai/KnowledgeQA/o3snapshot": "d875433d0f7897c01785b510381144f43dbc835249963e5f9b16ee3130068c68",+ "openai/KnowledgeQA/o4snapshot": "82910c522ac0b0d023f995a3672647c73e533b1992f79d4e597c11a8d53189a6",+ "openrouter/ASR/openai/whisper-large-v3": "18d077ef76d17cb51b3dadc18b570b40f2da916572c0196f7435d2728c3027f7",+ "openrouter/Embedding/openai/text-embedding-3-large": "18f651405d3a854813dd5938ce8c8ffefbc8f3e68ac64057335c1d6d1a382b62",+ "openrouter/Embedding/openai/text-embedding-3-small": "f16558abafbe7e1980542efd23ccd8bc215802e5a35444422ba948a02c59538d",+ "openrouter/KnowledgeQA/anthropic/claude-opus-5": "b410f7a28577fb2b8ec7845fbb9157dc44d2a51b287a825fade2722929c6fb7d",+ "openrouter/KnowledgeQA/anthropic/claude-sonnet-4.6": "d7d4e8a93c533bad68fa85c2accef5b10f08cabb382765ddea7799b06e8b5739",+ "openrouter/KnowledgeQA/anthropic/claude-sonnet-5": "7ebf34dfd7d017ac1fe6983b2191345fe96a1727619951a3426363a366b45f45",+ "openrouter/KnowledgeQA/anthropic/snapshot": "74ea9636e921fe17977b2915ba6397823abc6b23a43825b41e0b99612df38358",+ "openrouter/KnowledgeQA/deepseek/deepseek-v4-flash": "c25c357b6078af533e7a7fdd01ffed9d5ab83c6e589486d48bba184291a0e6b2",+ "openrouter/KnowledgeQA/deepseek/deepseek-v4-pro": "3f350e296e22a05eddca8737d11f637cfeb4c0ad245246fa510cdf2cd19a1980",+ "openrouter/KnowledgeQA/google/gemini-3.1-pro-preview": "1bba0aa89a00cd5fe8af7e76e93891ca4dd77281cd48414923afc95c9b4f0818",+ "openrouter/KnowledgeQA/google/gemini-3.8-flash": "e1f59cee98e945423b040c0bd2aa8ecf26780c0e70cd6a037b0b0aa0108ea475",+ "openrouter/KnowledgeQA/minimax/minimax-m3": "7fac4b6ec8518284aed9c74d66e0e243bec860a8a538d45cc03f5f7481b99cdb",+ "openrouter/KnowledgeQA/moonshotai/kimi-k3": "bf7e74b42760aa71c4423665f323d054d932ad5b1a59401857de1e2092fe6e36",+ "openrouter/KnowledgeQA/openai/gpt-5.4": "8a22de2014afc2a58312d2e5f965116ed19cbe0652246f8964d94993616c8e1c",+ "openrouter/KnowledgeQA/openai/gpt-5.5": "a9007fd1530e4f597ed152a3bf13a2921433557405c048952b07c17c6fbfba9a",+ "openrouter/KnowledgeQA/qwen/qwen3.7-max": "b875905a43449272a94f2339766bac4c4f9b5414c603b9c434b0e6a31b925fd3",+ "openrouter/KnowledgeQA/x-ai/grok-4.6": "b43bad43581cfc02bb2f7c8e56fbfea372edf6e4e6b1a34d15442efab0a0b0f4",+ "openrouter/KnowledgeQA/z-ai/glm-5.3": "d629d890b3e68a3e95a37d320390c60fe44019ff3bd80f9bb4bd897edcfa425c",+ "openrouter/Rerank/cohere/rerank-v3.5": "35f701fdcf196b6de1e71dc677dd3cdecf1a2a9b4fd71f08f2fb5cbc78601fc5",+ "qianfan/Embedding/bge-large-zh": "121f5c8566989713874cba0044039f9e02cf53fe23db739709e122459b9a3fda",+ "qianfan/Embedding/embedding-v1": "cc6b2807cbedb3422ba1982e04cae952c7ddffbba2685e4b53f90774d56aeab0",+ "qianfan/Embedding/tao-8k": "af316a1f4b9f96f93088f52a3e7e4292b6e30b5aa6f49243830890f4f4043058",+ "qianfan/KnowledgeQA/deepseek-v3.2": "32ebceea751c46e99ec750d5301e17e3b50a29a9002eb61e3065c4a4dd14ea5b",+ "qianfan/KnowledgeQA/ernie-4.5-turbo-128k": "2fa61399541418ed8d8fbe5fd8ead2655baf8bc92ef20f6ff2d9d4884de2f396",+ "qianfan/KnowledgeQA/ernie-4.5-turbo-vl-32k": "134b57565beec32415b79eb070c74dbd5bd819f90488fd005a4b44e671189d56",+ "qianfan/KnowledgeQA/ernie-5.0-thinking-preview": "638accf53511978b7a01a6d5bc2f06407a1a60906540a44ce1fe1ea57d0a73e3",+ "qianfan/KnowledgeQA/ernie-x1-turbo-32k": "fcb41841b028c5e6199f277b2d3e1036260d3913a923f7eb8f5650467d8d49ef",+ "qianfan/Rerank/bce-reranker-base": "485e2639fccc993514e87c0dcf434cb24dd37284777302b78f88e9b45bb412a0",+ "qiniu/KnowledgeQA/deepseek-r1": "95d9f18f66374713e5f7265b7d571a70590369048ad5b58c5499cae2090dcc88",+ "qiniu/KnowledgeQA/deepseek-v3": "921365f0f3370f7870edbfd7720cd948f51e5aae95e3956f3f8d4f130176b964",+ "qiniu/KnowledgeQA/deepseek/deepseek-v3.2-251201": "f505852c2ef532a79b58577d489b152a80a8960565d86472bcc73c7ab9ddc58c",+ "qiniu/KnowledgeQA/doubao-seed-2.0-pro": "b25cada50048f5a77ca8f54b55696d2c5d38a2bbb795a6200704ac093691ae45",+ "qiniu/KnowledgeQA/minimax/minimax-m2.5": "6d3df233d5dfaa21a13e124795d57cca22a69f3dff91bbd83fed3b4a03fc4493",+ "qiniu/KnowledgeQA/moonshotai/kimi-k2.5": "108c5be046d8592d756e1ff40592b36af6dd0798fd5d1967b747e5e44427b426",+ "qiniu/KnowledgeQA/qwen3.5-397b-a17b": "187b4cef7195768aeae7bf5d949dd438ce9a4bc9d0e07da993f9548ba0584a19",+ "qiniu/KnowledgeQA/xiaomi/mimo-v2-flash": "845a64410036654c2e66e2665461ce2cb4aef29e4aecdb94cd42df072f63f5e7",+ "qiniu/KnowledgeQA/z-ai/glm-4.7": "50f155530873601913d3501ae5fdd8e02cd53e779d164d5e3e5983f9f72aa6d2",+ "qiniu/KnowledgeQA/z-ai/glm-5": "d9ea33c0add65f8a817e4fd688141c1082d6e42f26e2a4cf85761f081feec093",+ "requesty/ASR/openai/gpt-4o-mini-transcribe": "c0349aa7c2203860f357fd0e46450f27489e3d1ca6600635268cc847b1866bab",+ "requesty/ASR/openai/gpt-4o-transcribe": "4316875346e4271458d0e62e5037d53454da07386768de13f370ce6b4fc65e45",+ "requesty/ASR/openai/whisper-1": "778b91371b71032df8453c650f91bbc964f6560522577a4846b9f25c8945f48a",+ "requesty/KnowledgeQA/anthropic/claude-opus-5": "8356a41a7bd95135d2ddf12b4b2415b82b8dbbcce718d1e60d8de3db1c950687",+ "requesty/KnowledgeQA/anthropic/claude-sonnet-5": "a75f2e814e2a97a56258c93d0039a7d89496abc72bb52f1955ad660dd13858ac",+ "requesty/KnowledgeQA/deepseek/deepseek-v4-pro-0813": "fa7d14e1c3a15d18e25b86b4276a83f9299ca7a7e6b08ebe396c61c88dcf9f46",+ "requesty/KnowledgeQA/google/gemini-3.1-pro-preview": "5ae18bea9729e634d48bbd42f720f8b3ccd2f61a1d6fd2351d66ae0ec7e72c68",+ "requesty/KnowledgeQA/google/gemini-3.6-flash": "4a87ddc564934a9852b530f1e26049a5a621425f190d2e4b1d43d1b1b65a51d4",+ "requesty/KnowledgeQA/moonshot/kimi-k3": "96f37af49c144a446d9c4c7c65211e65689826a25d8c33e5db31f508cae637c0",+ "requesty/KnowledgeQA/openai/gpt-5.4": "6ca93580eedb4008adf37034d96f41230e7b4222c96dbcb22a857a2da9e9b0b3",+ "requesty/KnowledgeQA/openai/gpt-5.5": "253f766ef2d39c19ba8e0bb5cdffd2839a4be3de4cf5ae16e319d515a18697f1",+ "requesty/KnowledgeQA/openai/gpt-6-astra": "6f4c1566c3840c8b0ce6d96a98dd1c07fd79b1e2b9293d1a53873ce5a1b5a427",+ "requesty/KnowledgeQA/vertex/gemini-3.8-flash": "8fb9c557105405e4a8b20bf9fd857da65edd424d02c9fbc084fb7411c5fa9d3b",+ "requesty/KnowledgeQA/zai/glm-5.2": "055e7a4a4470f79a61e327423a0212b24f6ad79be04afbde3abc26eb65347bb6",+ "siliconflow/ASR/FunAudioLLM/SenseVoiceSmall": "88839578e8f7b051a3d7143f8d302709fe69ab9271b8e854d5b5d12efa172c8b",+ "siliconflow/ASR/TeleAI/TeleSpeechASR": "a4dca0f67155be24e0a868455c53651ef38ff2553a5d8c5dd35087731b1a66cd",+ "siliconflow/Embedding/BAAI/bge-m3": "9d87b5170939e61d952b96f7dcffc56ea414b1ff59c0592a3e42dc826fda441c",+ "siliconflow/Embedding/Qwen/Qwen3-Embedding-0.6B": "b55351b9b00e746f4b383ae0c065c8e3c2a906273297f081d7e35a5a7e04f0ba",+ "siliconflow/Embedding/Qwen/Qwen3-Embedding-4B": "8aa441fee0aade229c25c57db8b0c93303f2d53d1102d57b939131c3c0a983a0",+ "siliconflow/Embedding/Qwen/Qwen3-Embedding-8B": "f3a6805f2883d3a193d13148ab9ca0aa182de4ec11f3007a4fd78702aa0b21bf",+ "siliconflow/KnowledgeQA/Pro/MiniMaxAI/MiniMax-M2.5": "700781182ca8df30b8cfdad4180fd36e2bfaae0da63ade30a1d10b5488fe2db9",+ "siliconflow/KnowledgeQA/Pro/deepseek-ai/DeepSeek-V4snapshot": "292817da83beca2f7fa60e9eeae633269f6d8e018032c02d7166b80b9120f5d6",+ "siliconflow/KnowledgeQA/Pro/moonshotai/Kimi-K2.5": "34d25f8f2758edefe777c7a89cd912afe8dcc6ec9d291847efda649f56656cd1",+ "siliconflow/KnowledgeQA/Pro/moonshotai/Kimi-K2.6": "1d65e2cb0cd8817f30ea1841b17f7c1688de2fb596cf886736e424128620889e",+ "siliconflow/KnowledgeQA/Pro/zai-org/GLM-5": "4549beb67deab651429c8385e206e7a256594a526c22d672a29c4c869d4b5755",+ "siliconflow/KnowledgeQA/Pro/zai-org/GLM-5.1": "9db6bed5330d09ee15dbc828a57e646da9abcdb3760004c51b5b7fbaa761ce59",+ "siliconflow/KnowledgeQA/Pro/zai-org/GLM-5.2": "ab9c0076ec579b6fe0b51f706128021b32f0b754b1fc62d913d7caeae7ed05fe",+ "siliconflow/KnowledgeQA/Qwen/Qwen3-VL-32B-Instruct": "35beda50dc06f2714574ee5a85b5e99ea0398e7eecd89ce663b510d1b101c242",+ "siliconflow/KnowledgeQA/Qwen/Qwen3.5-122B-A10B": "07db7c23527b82c43d9c85e6a341638dc856896417652fb5d15fd97e4c18d64a",+ "siliconflow/KnowledgeQA/Qwen/Qwen3.5-35B-A3B": "9a35f5c89b6ffeb6f1c2f2f524f393075f03e30eca264a99f03825007704499d",+ "siliconflow/KnowledgeQA/Qwen/Qwen3.5-397B-A17B": "852f2b573c9a7710fcba19662fca908de01b8a9e197eed500075e25feae18d4c",+ "siliconflow/KnowledgeQA/Qwen/Qwen3.6-35B-A3B": "46e2a4b78ef2f4ad61ae4cc4cf464434ca589333e6c03440819b2d93c7f0e834",+ "siliconflow/KnowledgeQA/deepseek-ai/DeepSeek-V3.2": "a8717568360641fc17238d588c9e5457e8be46c26377b6b3825b34c1002b4bbe",+ "siliconflow/KnowledgeQA/deepseek-ai/DeepSeek-V4-Flash": "0359b123c902a072e6b7f00ce62500745f9b7e68be0fdb4c96cb7ff1746dca46",+ "siliconflow/KnowledgeQA/deepseek-ai/DeepSeek-V4-Pro": "727f889e46c372bad78b32249a7adc3a32ed83191252c27477849785b4968cf0",+ "siliconflow/KnowledgeQA/deepseek-ai/DeepSeek-V4snapshot": "724ec881791b35536279abfc42f4ff466401032433d160c3ba3205bb2b921178",+ "siliconflow/KnowledgeQA/zai-org/GLM-5.2": "acce2ad2d6d1987c4702c00418bac6e441d0194fd7e8c12c9abee0141ac0f743",+ "siliconflow/Rerank/BAAI/bge-reranker-v2-m3": "471d9660cd6219c98941f7aec09ef68a17a5191a2350bea872d235098e4a1c1e",+ "siliconflow/Rerank/Qwen/Qwen3-Reranker-8B": "712284e5eef89f522e30c96bba18d019d0c48703adb2dc0fc1239aa55d582d49",+ "volcengine/Embedding/doubao-embedding-large-textsnapshot": "44d79d19f14506e75d7b9144907ffe70c3eb3110e07470362264022866ce104e",+ "volcengine/Embedding/doubao-embedding-textsnapshot": "e522020c10b4d3962869cd0bdfa42f845ca60cf2d1862f06ecb725d67386f32a",+ "volcengine/Embedding/doubao-embedding-vision-250615": "3d1035120259b61b2b7c6fc26d21948c6b2ef7420365f51f518573be2e4767d3",+ "volcengine/Embedding/doubao-embedding-vision-251215": "4c353f33993f52212365357f33f4547a49e127391c5f5424f52136b6924027fd",+ "volcengine/KnowledgeQA/deepseek-v4-1-flash-260910": "da798ebd4b75f0cac486e0c13b7b944db5e72119d70cb95749ea9a7546c8694b",+ "volcengine/KnowledgeQA/deepseek-v4-flash-ga-260731": "a5150f406c1a4889c3488cc113f14a55e55fbc67ad254e00f3e7919b3d6ea04d",+ "volcengine/KnowledgeQA/deepseek-v4-pro-ga-260813": "0bfe115ffe3d5837228188d4c94c34d58f374b4dd9c9c70106f0717ad335b456",+ "volcengine/KnowledgeQA/doubao-seed-1-6-251015": "41c2fe8ba6b42ec7961fdd2e1f6a4f27258d6d21e1f1fdf1d94c00201f347b8d",+ "volcengine/KnowledgeQA/doubao-seed-1-6-flash-250828": "e4b5567cd833190f9b87f8832d2a55554f0ae642acef6e8cd6f29f15cd875e0b",+ "volcengine/KnowledgeQA/doubao-seed-1-6-vision-250815": "9637b628a6c8ebd56d2fa5cf867bcbf70f16016961167ec269074e257b6d648d",+ "volcengine/KnowledgeQA/doubao-seed-1-8-251228": "342c5c259199ba362e65940a93a11a518c9c360fa3866f1ebe75549a996e46f6",+ "volcengine/KnowledgeQA/doubao-seed-2-0-code-preview-260215": "2e708cad82ed46e174bb0e21a72f131746f1d1bdbda3ffe62f6e7a00da18429f",+ "volcengine/KnowledgeQA/doubao-seed-2-0-lite-260428": "0730f665ae74ede933c04820e4616618b50eca760b87ccaccfeffe19e56ef07f",+ "volcengine/KnowledgeQA/doubao-seed-2-0-mini-260428": "b9a472f9abeaec9df800bad8b464527797e0c3b60203ca2565fd18e7e94c10ad",+ "volcengine/KnowledgeQA/doubao-seed-2-0-pro-260215": "bd0e1f3043f453477d4aeb1d74ee101f5fa7d9c14563404380ac30d42a0104fb",+ "volcengine/KnowledgeQA/doubao-seed-2-1-pro-260628": "c401fe36c486bb0bde15dbadda5f66d1095e83a4954afc3dc3567534fceae58c",+ "volcengine/KnowledgeQA/doubao-seed-2-1-pro-260915": "abea45c2694f8eb2e36dc4ed7e53643b89e09dde68e7fc89fe6149e2d9d8d56b",+ "volcengine/KnowledgeQA/doubao-seed-2-1-turbo-260628": "7a15c04ee6d70612fbfbf80cfff77507bd101ff3b9f22df1ee286fa734dd0476",+ "volcengine/KnowledgeQA/glm-5-2-260617": "e5207931dafd7edbc947999ff780a34d20867caa28772b6b10715ace4312f22a",+ "volcengine/KnowledgeQA/glm-5-3-flash-260828": "ca9bd13d9c86d2463efeb07ad414515a1f0cd7ab8dbe2173e5cc939f034e8577",+ "volcengine/Rerank/base-multilingual-rerank": "fa578e2a39ad622b50452c4d04ae9612ad5279c9abfe1df86143aacbae70820a",+ "volcengine/Rerank/doubao-seed-rerank": "2d26d34faf9c3d7a69302cfdd28c7e7162fe1ceb8060a507582724a5368f493f",+ "zhipu/ASR/glm-asr-2512": "58e487f13624e4ef38d8258e01664bd609e65d8b1d68c80855d314d8bc541342",+ "zhipu/Embedding/embedding-2": "524e2d23e61229245c2befdd4edd46c7ecd1814368d1afd7acb1ce98125601f4",+ "zhipu/Embedding/embedding-3": "e84ca0362294219a7dc044537d2dacf897d75c531e49699eac85c2c9f9cc4d3c",+ "zhipu/KnowledgeQA/glm-4.5-air": "3911dfaa4e69e0342c2c7757f78846e1509c7300db2e92ee256bb293db9b1b99",+ "zhipu/KnowledgeQA/glm-4.6": "2aa273031863e5b4a3dd1a66dfe951285837cd1161034748c798189639864ad7",+ "zhipu/KnowledgeQA/glm-4.6v": "b82aad09279b58d1bc98239fb6292c7571aa1160c6f8b763d984ecbbfa6080f1",+ "zhipu/KnowledgeQA/glm-4.7": "6614695fc13cfbf22f03be7304df3ed8335edff9a67d8dd1a3ec10d0d56055d5",+ "zhipu/KnowledgeQA/glm-4.7-flash": "fce7d598de8b287455711de716af3259470aaaeb04cc8af2ba32618b19cf10c4",+ "zhipu/KnowledgeQA/glm-5": "2bf18dfd80557bbca52ed26321b904a6289aa671d0307977e4115176ce4faec2",+ "zhipu/KnowledgeQA/glm-5.1": "dfcc36d6d2ded9ab8bfc5bbfc6af7a530d918710d9bfd301252a6c9ab17d8767",+ "zhipu/KnowledgeQA/glm-5.2": "3dad7d6d1be8fb9a43bd5e0b0d38eb28d988cb70029a5062e2d71b8ca046cd76",+ "zhipu/KnowledgeQA/glm-5.3": "2e114d129d282680ba853add9fad838921adef5ef20b5182b29ce21d9c705821",+ "zhipu/KnowledgeQA/glm-5.3-flash": "859f96e6699a7f6923f1fe224adcf6e0e6be012740970a9109f0b35a27862224",+ "zhipu/KnowledgeQA/glm-5v-turbo": "39c2299304ce46d636b564cab7b3061b74491b32f31d7ea8b4a2a1c22304704e",+ "zhipu/Rerank/rerank": "566896288736efe9f8ef8a44c6e9b9d2f2ad9cdc944bfb05b794c4c3ecb20a66"+}diff --git a/internal/models/parity/volcengine_budget_test.go b/internal/models/parity/volcengine_budget_test.gonew file mode 100644index 000000000..c48c63cdb--- /dev/null+++ b/internal/models/parity/volcengine_budget_test.go@@ -0,0 +1,38 @@+package parity++import (+ "testing"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/chat"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++func TestVolcengineCompletionBudgetFieldsAreMutuallyExclusive(t *testing.T) {+ vendor, ok := modelruntime.Get("volcengine")+ require.True(t, ok)+ for _, model := range vendor.ModelsByType(types.ModelTypeKnowledgeQA) {+ t.Run(model.ID, func(t *testing.T) {+ for _, stream := range []bool{false, true} {+ for _, thinking := range []bool{false, true} {+ for _, budget := range []int{0, 256} {+ body := buildBody(t, &chat.ChatConfig{+ Provider: "volcengine", ModelName: model.ID, BaseURL: "http://127.0.0.1:9/v3",+ Spec: &types.ModelSpecOverride{Compat: map[string]any{+ "extra_body": map[string]any{"max_tokens": 1024, "max_completion_tokens": 2048},+ }},+ }, &api.Options{MaxTokens: budget, Thinking: ptrBool(thinking)}, stream)+ require.NotContains(t, body, "max_tokens")+ want := 2048+ if budget > 0 {+ want = budget+ }+ require.Equal(t, float64(want), body["max_completion_tokens"])+ }+ }+ }+ })+ }+}diff --git a/internal/models/vendors/aliyun/vendor.go b/internal/models/providers/aliyun.gosimilarity index 80%rename from internal/models/vendors/aliyun/vendor.gorename to internal/models/providers/aliyun.goindex 9c5672580..3b85e488a 100644--- a/internal/models/vendors/aliyun/vendor.go+++ b/internal/models/providers/aliyun.go@@ -1,4 +1,4 @@-// Package aliyun registers Alibaba Cloud Model Studio (Bailian / DashScope)+// Package providers registers Alibaba Cloud Model Studio (Bailian / DashScope)// through its OpenAI-compatible mode.//// Facts (https://help.aliyun.com/zh/model-studio/qwen-api-via-openai-chat-completions,@@ -78,58 +78,54 @@// public docs render behind a console table we cannot quote; they are left as// they were. The same holds for kimi-k3 / kimi-k2.6 / glm-5.3 hosted here and// for qwq-32b's "off": null, which the 仅思考模式 list does not spell out.-package aliyun+package providersimport (_ "embed""strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/aliyun.svg+var aliyunIcon []byte-//go:embed icon.svg-var icon []byte+// AliyunID is the provider identifier stored on model rows.+const AliyunID = "aliyun"-// ID is the provider identifier stored on model rows.-const ID = "aliyun"+// AliyunBaseURL is the OpenAI-compatible mode used for chat, embedding and VLM.+const AliyunBaseURL = "https://dashscope.aliyuncs.com/compatible-mode/v1"-// BaseURL is the OpenAI-compatible mode used for chat, embedding and VLM.-const BaseURL = "https://dashscope.aliyuncs.com/compatible-mode/v1"+// AliyunRerankBaseURL is the DashScope-native text rerank endpoint.+const AliyunRerankBaseURL = "https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank"-// RerankBaseURL is the DashScope-native text rerank endpoint.-const RerankBaseURL = "https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank"--// AnthropicBaseURL is the documented Anthropic Messages facade. It is not the+// AliyunAnthropicBaseURL is the documented Anthropic Messages facade. It is not the// default for this vendor; operators who want it configure it explicitly.-const AnthropicBaseURL = "https://dashscope.aliyuncs.com/apps/anthropic"+const AliyunAnthropicBaseURL = "https://dashscope.aliyuncs.com/apps/anthropic"-// multimodalEmbeddingPath is the native multimodal embedding method+// AliyunMultimodalEmbeddingPath is the native multimodal embedding method// (https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference).-const multimodalEmbeddingPath = "/api/v1/services/embeddings/multimodal-embedding/multimodal-embedding"+const AliyunMultimodalEmbeddingPath = "/api/v1/services/embeddings/multimodal-embedding/multimodal-embedding"-func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newAliyunProvider() *Definition {+ return &Definition{+ ID: AliyunID,Name: "Alibaba Cloud DashScope",Names: map[string]string{"zh-CN": "阿里云 DashScope"},Description: "qwen-plus, qwen3.8-max, deepseek-v4-pro, text-embedding-v4, gte-rerank-v2, etc.",Website: "https://bailian.console.aliyun.com",- Icon: icon,+ Icon: aliyunIcon,API: api.APIOpenAICompletions,Order: 10,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"dashscope.aliyuncs.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: RerankBaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: AliyunBaseURL,+ types.ModelTypeEmbedding: AliyunBaseURL,+ types.ModelTypeRerank: AliyunRerankBaseURL,+ types.ModelTypeVLLM: AliyunBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -145,7 +141,7 @@ func init() {// URL without either root is taken as the host itself, which keeps a// workspace or international domain instead of replacing it with the// Beijing default as the pre-catalog client did.- Endpoint: func(r catalog.EndpointRequest) (string, map[string]string) {+ Endpoint: func(r EndpointRequest) (string, map[string]string) {if r.ModelType != types.ModelTypeEmbedding {return "", nil}@@ -156,11 +152,11 @@ func init() {}}if r.EmbeddingAPI == api.EmbeddingDashScope {- return root + multimodalEmbeddingPath, nil+ return root + AliyunMultimodalEmbeddingPath, nil}return root + "/compatible-mode/v1/embeddings", nil},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// ASR: qwen3-asr-flash is the one recognition model callable with// the audio in the request, on the compatible chat endpoint as a// base64 data URI; its catalog entry declares that. Every other@@ -175,34 +171,33 @@ func init() {// in models.json. The native APIs' text_type / instruct are not// declared: both change the document vectors// (Tencent/WeKnora#1401).- Embeddings: catalog.EmbeddingsCompat{- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),+ Embeddings: api.EmbeddingsCompat{+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),},- Rerank: catalog.RerankCompat{- SendReturnDocs: catalog.Ptr(true),+ Rerank: api.RerankCompat{+ SendReturnDocs: api.Ptr(true),// 500 documents per request for the native text-rerank models.// The query (4,000 tokens) and per-document limits are stated in// tokens, which a rune count cannot express, so they are not// declared.- MaxDocuments: catalog.Ptr(500),+ MaxDocuments: api.Ptr(500),},- OpenAICompletions: catalog.OpenAICompletionsCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{// Explicit although it matches the protocol default, because// this vendor's own parameter table deprecates the other// field and the choice should be visible here.- MaxTokensField: catalog.Ptr("max_completion_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),- ThinkingBudgetField: catalog.Ptr("thinking_budget"),- CacheControlFormat: catalog.Ptr("anthropic"),+ MaxTokensField: api.Ptr("max_completion_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),+ ThinkingBudgetField: api.Ptr("thinking_budget"),+ CacheControlFormat: api.Ptr("anthropic"),// usage carries prompt_tokens_details.cached_tokens and// cache_creation.ephemeral_5m_input_tokens.- PromptCacheAccounting: catalog.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),// reasoning_effort exists but only on the families that enable// it per entry (qwen3.8, DeepSeek-V4, glm-5.3).- SupportsReasoningEffort: catalog.Ptr(false),+ SupportsReasoningEffort: api.Ptr(false),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/anthropic/vendor.go b/internal/models/providers/anthropic.gosimilarity index 83%rename from internal/models/vendors/anthropic/vendor.gorename to internal/models/providers/anthropic.goindex 2c6c8f974..15158664e 100644--- a/internal/models/vendors/anthropic/vendor.go+++ b/internal/models/providers/anthropic.go@@ -1,4 +1,4 @@-// Package anthropic registers Anthropic's native Messages API.+// Package providers registers Anthropic's native Messages API.//// Facts (https://platform.claude.com/docs/en/api/messages — docs.anthropic.com// now redirects there):@@ -36,55 +36,50 @@//// Unverified: Claude Mythos 5.1 / Mythos 5 / Mythos Preview are documented// but limited-availability, so they are left out of the catalog.-package anthropic+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/anthropic.svg+var anthropicIcon []byte-//go:embed icon.svg-var icon []byte+// AnthropicID is the provider identifier stored on model rows.+const AnthropicID = "anthropic"-// ID is the provider identifier stored on model rows.-const ID = "anthropic"+// AnthropicBaseURL is the documented first-party endpoint.+const AnthropicBaseURL = "https://api.anthropic.com/v1"-// BaseURL is the documented first-party endpoint.-const BaseURL = "https://api.anthropic.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newAnthropicProvider() *Definition {+ return &Definition{+ ID: AnthropicID,Name: "Anthropic",Names: map[string]string{"zh-CN": "Anthropic"},Description: "Claude models via the native Anthropic Messages API: " +"claude-opus-5, claude-sonnet-5, claude-haiku-4-5, etc.",Website: "https://console.anthropic.com",- Icon: icon,+ Icon: anthropicIcon,API: api.APIAnthropicMessages,Order: 32,RequiresAuth: true,- Auth: catalog.AuthXAPIKey,+ Auth: AuthXAPIKey,URLPatterns: []string{"api.anthropic.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: AnthropicBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,},// Protocol defaults (budget-mode thinking, 2023-06-01 version) apply// at vendor level; adaptive-effort models override per entry.- Compat: catalog.VendorCompat{},+ Compat: VendorCompat{},// Anthropic's effort ladder has no "minimal" rung; fold it onto low// for every model so a caller asking for minimal never sends a value// the Messages API rejects.ThinkingLevels: api.ThinkingLevelMap{api.ReasoningMinimal: api.StringPtr("low")},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/aliyun/icon.svg b/internal/models/providers/assets/aliyun.svgsimilarity index 100%rename from internal/models/vendors/aliyun/icon.svgrename to internal/models/providers/assets/aliyun.svgdiff --git a/internal/models/vendors/anthropic/icon.svg b/internal/models/providers/assets/anthropic.svgsimilarity index 100%rename from internal/models/vendors/anthropic/icon.svgrename to internal/models/providers/assets/anthropic.svgdiff --git a/internal/models/vendors/azure_openai/icon.svg b/internal/models/providers/assets/azure_openai.svgsimilarity index 100%rename from internal/models/vendors/azure_openai/icon.svgrename to internal/models/providers/assets/azure_openai.svgdiff --git a/internal/models/vendors/deepseek/icon.svg b/internal/models/providers/assets/deepseek.svgsimilarity index 100%rename from internal/models/vendors/deepseek/icon.svgrename to internal/models/providers/assets/deepseek.svgdiff --git a/internal/models/vendors/gemini/icon.svg b/internal/models/providers/assets/gemini.svgsimilarity index 100%rename from internal/models/vendors/gemini/icon.svgrename to internal/models/providers/assets/gemini.svgdiff --git a/internal/models/vendors/generic/icon.svg b/internal/models/providers/assets/generic.svgsimilarity index 100%rename from internal/models/vendors/generic/icon.svgrename to internal/models/providers/assets/generic.svgdiff --git a/internal/models/vendors/gpustack/icon.svg b/internal/models/providers/assets/gpustack.svgsimilarity index 100%rename from internal/models/vendors/gpustack/icon.svgrename to internal/models/providers/assets/gpustack.svgdiff --git a/internal/models/vendors/hunyuan/icon.svg b/internal/models/providers/assets/hunyuan.svgsimilarity index 100%rename from internal/models/vendors/hunyuan/icon.svgrename to internal/models/providers/assets/hunyuan.svgdiff --git a/internal/models/vendors/jina/icon.svg b/internal/models/providers/assets/jina.svgsimilarity index 100%rename from internal/models/vendors/jina/icon.svgrename to internal/models/providers/assets/jina.svgdiff --git a/internal/models/vendors/litellm/icon.svg b/internal/models/providers/assets/litellm.svgsimilarity index 100%rename from internal/models/vendors/litellm/icon.svgrename to internal/models/providers/assets/litellm.svgdiff --git a/internal/models/vendors/lkeap/icon.svg b/internal/models/providers/assets/lkeap.svgsimilarity index 100%rename from internal/models/vendors/lkeap/icon.svgrename to internal/models/providers/assets/lkeap.svgdiff --git a/internal/models/vendors/longcat/icon.svg b/internal/models/providers/assets/longcat.svgsimilarity index 100%rename from internal/models/vendors/longcat/icon.svgrename to internal/models/providers/assets/longcat.svgdiff --git a/internal/models/vendors/mimo/icon.svg b/internal/models/providers/assets/mimo.svgsimilarity index 100%rename from internal/models/vendors/mimo/icon.svgrename to internal/models/providers/assets/mimo.svgdiff --git a/internal/models/vendors/minimax/icon.svg b/internal/models/providers/assets/minimax.svgsimilarity index 100%rename from internal/models/vendors/minimax/icon.svgrename to internal/models/providers/assets/minimax.svgdiff --git a/internal/models/vendors/modelscope/icon.svg b/internal/models/providers/assets/modelscope.svgsimilarity index 100%rename from internal/models/vendors/modelscope/icon.svgrename to internal/models/providers/assets/modelscope.svgdiff --git a/internal/models/vendors/moonshot/icon.svg b/internal/models/providers/assets/moonshot.svgsimilarity index 100%rename from internal/models/vendors/moonshot/icon.svgrename to internal/models/providers/assets/moonshot.svgdiff --git a/internal/models/vendors/novita/icon.svg b/internal/models/providers/assets/novita.svgsimilarity index 100%rename from internal/models/vendors/novita/icon.svgrename to internal/models/providers/assets/novita.svgdiff --git a/internal/models/vendors/nvidia/icon.svg b/internal/models/providers/assets/nvidia.svgsimilarity index 100%rename from internal/models/vendors/nvidia/icon.svgrename to internal/models/providers/assets/nvidia.svgdiff --git a/internal/models/vendors/openai/icon.svg b/internal/models/providers/assets/openai.svgsimilarity index 100%rename from internal/models/vendors/openai/icon.svgrename to internal/models/providers/assets/openai.svgdiff --git a/internal/models/vendors/openrouter/icon.svg b/internal/models/providers/assets/openrouter.svgsimilarity index 100%rename from internal/models/vendors/openrouter/icon.svgrename to internal/models/providers/assets/openrouter.svgdiff --git a/internal/models/vendors/qianfan/icon.svg b/internal/models/providers/assets/qianfan.svgsimilarity index 100%rename from internal/models/vendors/qianfan/icon.svgrename to internal/models/providers/assets/qianfan.svgdiff --git a/internal/models/vendors/qiniu/icon.svg b/internal/models/providers/assets/qiniu.svgsimilarity index 100%rename from internal/models/vendors/qiniu/icon.svgrename to internal/models/providers/assets/qiniu.svgdiff --git a/internal/models/vendors/requesty/icon.svg b/internal/models/providers/assets/requesty.svgsimilarity index 100%rename from internal/models/vendors/requesty/icon.svgrename to internal/models/providers/assets/requesty.svgdiff --git a/internal/models/vendors/siliconflow/icon.svg b/internal/models/providers/assets/siliconflow.svgsimilarity index 100%rename from internal/models/vendors/siliconflow/icon.svgrename to internal/models/providers/assets/siliconflow.svgdiff --git a/internal/models/vendors/volcengine/icon.svg b/internal/models/providers/assets/volcengine.svgsimilarity index 100%rename from internal/models/vendors/volcengine/icon.svgrename to internal/models/providers/assets/volcengine.svgdiff --git a/internal/models/vendors/weknoracloud/icon.svg b/internal/models/providers/assets/weknoracloud.svgsimilarity index 100%rename from internal/models/vendors/weknoracloud/icon.svgrename to internal/models/providers/assets/weknoracloud.svgdiff --git a/internal/models/vendors/zhipu/icon.svg b/internal/models/providers/assets/zhipu.svgsimilarity index 100%rename from internal/models/vendors/zhipu/icon.svgrename to internal/models/providers/assets/zhipu.svgdiff --git a/internal/models/vendors/azure_openai/vendor.go b/internal/models/providers/azure_openai.gosimilarity index 83%rename from internal/models/vendors/azure_openai/vendor.gorename to internal/models/providers/azure_openai.goindex 63e7909c4..656988f55 100644--- a/internal/models/vendors/azure_openai/vendor.go+++ b/internal/models/providers/azure_openai.go@@ -1,4 +1,4 @@-// Package azureopenai registers Azure OpenAI (Azure AI Foundry).+// Package providers registers Azure OpenAI (Azure AI Foundry).//// Facts (https://learn.microsoft.com/azure/ai-foundry/openai/api-version-lifecycle// and https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning):@@ -15,7 +15,7 @@// cannot work on it. The Endpoint hook therefore emits the v1 shape by// default and only falls back to the legacy shape when the operator// explicitly fills the api_version extra field;-// - authentication is the `api-key` header, not a bearer token (Entra ID+// - authentication is the `api-key` header, not a bearer token (Entra AzureOpenaiID// bearer tokens are the other documented option and are not modelled);// - the model name stored on the row is the deployment name, so the// catalog only carries family patterns (gpt-6*, gpt-5*, o1*, o3*, o4*,@@ -75,54 +75,51 @@// website-docs/03-features/06-models.md; an operator whose gateway only// serves the dated path (an API Management front end, a sovereign cloud)// restores the exact previous shape by filling the api_version extra field.-package azureopenai+package providersimport (_ "embed""net/url""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/azure_openai.svg+var azureOpenaiIcon []byte-//go:embed icon.svg-var icon []byte+// AzureOpenaiID is the provider identifier stored on model rows.+const AzureOpenaiID = "azure_openai"-// ID is the provider identifier stored on model rows.-const ID = "azure_openai"--// BaseURL is the resource endpoint template; the operator replaces+// AzureOpenaiBaseURL is the resource endpoint template; the operator replaces// {resource} with their own resource name.-const BaseURL = "https://{resource}.openai.azure.com"+const AzureOpenaiBaseURL = "https://{resource}.openai.azure.com"-// LegacyAPIVersion is the newest GA api-version of the dated data-plane+// AzureOpenaiLegacyAPIVersion is the newest GA api-version of the dated data-plane// inference spec. It is only used when the operator explicitly asks for the// legacy deployments path; it predates reasoning_effort, so reasoning// deployments need a preview version such as 2025-04-01-preview instead.-const LegacyAPIVersion = "2024-10-21"+const AzureOpenaiLegacyAPIVersion = "2024-10-21"-func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newAzureOpenaiProvider() *Definition {+ return &Definition{+ ID: AzureOpenaiID,Name: "Azure OpenAI",Names: map[string]string{"zh-CN": "Azure OpenAI"},Description: "gpt-4o, gpt-5, o3, text-embedding-3-large deployments, etc.",Website: "https://ai.azure.com",- Icon: icon,+ Icon: azureOpenaiIcon,API: api.APIOpenAICompletions,Order: 31,RequiresAuth: true,- Auth: catalog.AuthAPIKeyHeader,+ Auth: AuthAPIKeyHeader,URLPatterns: []string{"openai.azure.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: AzureOpenaiBaseURL,+ types.ModelTypeEmbedding: AzureOpenaiBaseURL,+ types.ModelTypeVLLM: AzureOpenaiBaseURL,},// ASR is deliberately absent. The ASR client now resolves through// this vendor (api-key header, Endpoint hook below), but the only@@ -139,9 +136,9 @@ func init() {types.ModelTypeEmbedding,types.ModelTypeVLLM,},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []ExtraField{{- Key: catalog.ExtraAPIVersion,+ Key: models.ExtraAPIVersion,Label: "API Version (legacy deployments path)",Labels: map[string]string{"zh-CN": "API 版本(旧版 deployments 路径)"},Type: "string",@@ -155,23 +152,23 @@ func init() {},},},- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// The same body as OpenAI's; the Endpoint hook below supplies the// v1 or deployments URL.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenAI),- SupportsReasoningEffort: catalog.Ptr(true),- SupportsDeveloperRole: catalog.Ptr(true),- SupportsStore: catalog.Ptr(true),- PromptCacheKey: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenAI),+ SupportsReasoningEffort: api.Ptr(true),+ SupportsDeveloperRole: api.Ptr(true),+ SupportsStore: api.Ptr(true),+ PromptCacheKey: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},},- Endpoint: func(r catalog.EndpointRequest) (string, map[string]string) {+ Endpoint: func(r EndpointRequest) (string, map[string]string) {var path stringswitch r.ModelType {case types.ModelTypeEmbedding:@@ -189,7 +186,7 @@ func init() {// An explicit api-version selects the legacy deployments path;// otherwise use the v1 GA data plane, which carries the// deployment name in the body instead of the URL.- if version := strings.TrimSpace(r.Extra[catalog.ExtraAPIVersion]); version != "" {+ if version := strings.TrimSpace(r.Extra[models.ExtraAPIVersion]); version != "" {legacy := root + "/openai/deployments/" + url.PathEscape(r.Model) + pathreturn legacy, map[string]string{"api-version": version}}@@ -198,6 +195,5 @@ func init() {}return root + "/openai/v1" + path, nil},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/providers/builtin.go b/internal/models/providers/builtin.gonew file mode 100644index 000000000..8a59435d1--- /dev/null+++ b/internal/models/providers/builtin.go@@ -0,0 +1,36 @@+package providers++import "github.com/Tencent/WeKnora/internal/models/internal/configcopy"++// Builtins returns independent provider definitions without registering global state.+func Builtins() []*Definition {+ return configcopy.Clone([]*Definition{+ newAliyunProvider(),+ newAnthropicProvider(),+ newAzureOpenaiProvider(),+ newDeepseekProvider(),+ newGeminiProvider(),+ newGenericProvider(),+ newGpustackProvider(),+ newHunyuanProvider(),+ newJinaProvider(),+ newLitellmProvider(),+ newLkeapProvider(),+ newLongcatProvider(),+ newMimoProvider(),+ newMinimaxProvider(),+ newModelscopeProvider(),+ newMoonshotProvider(),+ newNovitaProvider(),+ newNvidiaProvider(),+ newOpenaiProvider(),+ newOpenrouterProvider(),+ newQianfanProvider(),+ newQiniuProvider(),+ newRequestyProvider(),+ newSiliconflowProvider(),+ newVolcengineProvider(),+ newWeKnoraCloudProvider(),+ newZhipuProvider(),+ })+}diff --git a/internal/models/providers/compat.go b/internal/models/providers/compat.gonew file mode 100644index 000000000..50be2a6f1--- /dev/null+++ b/internal/models/providers/compat.go@@ -0,0 +1,18 @@+package providers++import "github.com/Tencent/WeKnora/internal/models/api"++// VendorCompat carries a vendor's defaults for every protocol it may speak.+type VendorCompat struct {+ OpenAICompletions api.OpenAICompletionsCompat `json:"openai_completions,omitempty"`+ OpenAIResponses api.OpenAIResponsesCompat `json:"openai_responses,omitempty"`+ AnthropicMessages api.AnthropicMessagesCompat `json:"anthropic_messages,omitempty"`+ GoogleGenerativeAI api.GoogleGenerativeAICompat `json:"google_generative_ai,omitempty"`+ // Rerank is the rerank protocol overlay. It has no per-protocol variants:+ // a vendor serves exactly one rerank dialect.+ Rerank api.RerankCompat `json:"rerank,omitempty"`+ // Embeddings is the embedding protocol overlay, likewise one per vendor.+ Embeddings api.EmbeddingsCompat `json:"embeddings,omitempty"`+ // Transcriptions is the speech-to-text overlay, likewise one per vendor.+ Transcriptions api.TranscriptionsCompat `json:"transcriptions,omitempty"`+}diff --git a/internal/models/vendors/deepseek/vendor.go b/internal/models/providers/deepseek.gosimilarity index 81%rename from internal/models/vendors/deepseek/vendor.gorename to internal/models/providers/deepseek.goindex 0f1756370..4db3f9862 100644--- a/internal/models/vendors/deepseek/vendor.go+++ b/internal/models/providers/deepseek.go@@ -1,4 +1,4 @@-// Package deepseek registers DeepSeek's first-party API.+// Package providers registers DeepSeek's first-party API.//// Facts (https://api-docs.deepseek.com/api/create-chat-completion and// https://api-docs.deepseek.com/guides/thinking_mode):@@ -48,52 +48,48 @@// minimal / low to `high`. The reference enumerates low / high / max for the// API as a whole without restricting them per model, so the override is kept// but nothing documents it.-package deepseek+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/deepseek.svg+var deepseekIcon []byte-//go:embed icon.svg-var icon []byte+// DeepseekID is the provider identifier stored on model rows.+const DeepseekID = "deepseek"-// ID is the provider identifier stored on model rows.-const ID = "deepseek"+// DeepseekBaseURL is the documented first-party endpoint.+const DeepseekBaseURL = "https://api.deepseek.com/v1"-// BaseURL is the documented first-party endpoint.-const BaseURL = "https://api.deepseek.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newDeepseekProvider() *Definition {+ return &Definition{+ ID: DeepseekID,Name: "DeepSeek",Names: map[string]string{"zh-CN": "DeepSeek 深度求索"},Description: "deepseek-flash, deepseek-v4-pro",Website: "https://platform.deepseek.com",- Icon: icon,+ Icon: deepseekIcon,API: api.APIOpenAICompletions,Order: 30,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"api.deepseek.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: DeepseekBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA},- Compat: catalog.VendorCompat{- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),- SupportsStore: catalog.Ptr(false),+ Compat: VendorCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),+ SupportsStore: api.Ptr(false),// `required` and named functions 400 while thinking is on,// which is the default on every current model.ToolChoiceModes: []string{"none", "auto"},@@ -110,6 +106,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("max"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/catalog/types.go b/internal/models/providers/definition.gosimilarity index 68%rename from internal/models/catalog/types.gorename to internal/models/providers/definition.goindex bc2985be7..dc9923ff3 100644--- a/internal/models/catalog/types.go+++ b/internal/models/providers/definition.go@@ -1,22 +1,11 @@-// Package catalog is the model/vendor directory. It answers one question for-// the rest of the system: "given a provider id, a model name and whatever the-// operator configured, how exactly do we talk to this model?"-//-// Facts come from three layers, lowest precedence first:-// 1. built-in vendor packages under internal/models/vendors (vendor.go +-// models.json + icon.svg), registered through Register;-// 2. the deployment overlay config/models.json (same schema as pi's-// ~/.pi/agent/models.json): new vendors, base URL / key overrides,-// per-model overrides;-// 3. per-model overrides stored on the models table.-//-// Resolve merges those layers into a Resolved value that the protocol-// packages consume verbatim. No protocol or vendor package is imported here.-package catalog+// Package providers defines vendor defaults and routing rules independently of the model catalog.+package providersimport (- "encoding/json"+ "fmt"+ "strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api""github.com/Tencent/WeKnora/internal/types")@@ -111,7 +100,7 @@ func (f ExtraField) LocalizedPlaceholder(locale string) string {// CredentialLabelFor returns the credential naming for a model type, or nil// when the vendor uses the generic API-key wording.-func (v *Vendor) CredentialLabelFor(modelType types.ModelType) *CredentialLabel {+func (v *Definition) CredentialLabelFor(modelType types.ModelType) *CredentialLabel {for i := range v.CredentialLabels {c := &v.CredentialLabels[i]if len(c.ModelTypes) == 0 {@@ -141,80 +130,6 @@ func (o ExtraFieldOption) LocalizedLabel(locale string) string {return localizedOr(o.Labels, locale, o.Label)}-// ModelCost is priced per million tokens, in USD unless Currency says otherwise.-type ModelCost struct {- Input float64 `json:"input"`- Output float64 `json:"output"`- CacheRead float64 `json:"cache_read,omitempty"`- CacheWrite float64 `json:"cache_write,omitempty"`- Currency string `json:"currency,omitempty"`-}--// ModelSpec is one entry of a vendor's models.json.-//-// Only ID is required. API defaults to the vendor's API; Type defaults to-// KnowledgeQA. Compat is interpreted according to API (see compat.go).-type ModelSpec struct {- ID string `json:"id"`- Name string `json:"name,omitempty"`- // Type is the WeKnora model type this entry describes. Chat models with- // image input are still KnowledgeQA; the UI derives VLM eligibility from- // Input. Embedding / Rerank / ASR entries exist for the model picker.- Type types.ModelType `json:"type,omitempty"`- API api.API `json:"api,omitempty"`- // Aliases are additional ids that resolve to this entry (dated- // snapshots, vendor-prefixed names on gateways).- Aliases []string `json:"aliases,omitempty"`- // Match is a case-insensitive glob ("gpt-5*", "*deepseek-r1*") that lets- // one entry describe a family. Exact ids and aliases win over patterns;- // among patterns the longest literal prefix wins.- Match string `json:"match,omitempty"`- // Reasoning reports whether the model can emit thinking at all.- Reasoning bool `json:"reasoning"`- // Input lists accepted modalities: text, image, audio, video.- Input []string `json:"input,omitempty"`- ContextWindow int `json:"context_window,omitempty"`- MaxOutputTokens int `json:"max_output_tokens,omitempty"`- Cost *ModelCost `json:"cost,omitempty"`- // ThinkingLevels maps protocol-neutral levels to vendor values; missing- // keys inherit the vendor map. See api.ThinkingLevelMap.- ThinkingLevels api.ThinkingLevelMap `json:"thinking_levels,omitempty"`- // Compat is the protocol-specific overlay for this model (flat object,- // fields depend on API). Decoded lazily by Resolve.- Compat json.RawMessage `json:"compat,omitempty"`- // Dimension is the embedding vector width (embedding entries only).- Dimension int `json:"dimension,omitempty"`- // Deprecated hides the entry from pickers but keeps resolution working.- Deprecated bool `json:"deprecated,omitempty"`- // Source is the documentation URL the facts were taken from.- Source string `json:"source,omitempty"`-}--// DisplayName returns Name or the id.-func (m ModelSpec) DisplayName() string {- if m.Name != "" {- return m.Name- }- return m.ID-}--// AcceptsImages reports whether Input lists image.-func (m ModelSpec) AcceptsImages() bool {- for _, in := range m.Input {- if in == "image" {- return true- }- }- return false-}--// Credentials is what the operator stored for one model row.-type Credentials struct {- APIKey string- AppID string- AppSecret string-}-// EndpointRequest is the input to a vendor's Endpoint hook.type EndpointRequest struct {BaseURL string@@ -229,8 +144,8 @@ type EndpointRequest struct {Extra map[string]string}-// Vendor is one model vendor / gateway / self-hosted runtime.-type Vendor struct {+// Definition is one model vendor / gateway / self-hosted runtime.+type Definition struct {// ID is the stable identifier stored in models.parameters.provider.ID string// Name is the brand name; Names carries localized variants keyed by@@ -275,8 +190,6 @@ type Vendor struct {Compat VendorCompat// ThinkingLevels is the vendor-level level map.ThinkingLevels api.ThinkingLevelMap- // Models is the built-in catalog (from models.json).- Models []ModelSpec// Order sorts the vendor list in the UI (lower first).Order int@@ -286,10 +199,10 @@ type Vendor struct {// PreferAPI, when set, may switch the protocol for a base URL / model// pair after URL inference ran (OpenAI uses Responses on its own host// and Chat Completions on relays). Returning "" keeps the current choice.- PreferAPI func(baseURL string, spec ModelSpec) api.API+ PreferAPI func(baseURL string, spec models.ModelSpec) api.API// Signer, when set (AuthSigned), builds the request signer from the// stored credentials.- Signer func(creds Credentials) api.AuthFunc+ Signer func(creds api.Credentials) api.AuthFunc// Validate checks a configuration before it is saved or used. Nil means// the default check (key required when RequiresAuth; model name required).Validate func(cfg *Config) error@@ -313,7 +226,7 @@ type Config struct {// GetDefaultURL returns the default base URL for a model type, falling back// to the chat URL.-func (v *Vendor) GetDefaultURL(modelType types.ModelType) string {+func (v *Definition) GetDefaultURL(modelType types.ModelType) string {if v == nil {return ""}@@ -327,7 +240,7 @@ func (v *Vendor) GetDefaultURL(modelType types.ModelType) string {}// SupportsType reports whether the vendor lists the model type.-func (v *Vendor) SupportsType(modelType types.ModelType) bool {+func (v *Definition) SupportsType(modelType types.ModelType) bool {for _, t := range v.ModelTypes {if t == modelType {return true@@ -337,7 +250,7 @@ func (v *Vendor) SupportsType(modelType types.ModelType) bool {}// LocalizedName returns the name for a locale, falling back to Name.-func (v *Vendor) LocalizedName(locale string) string {+func (v *Definition) LocalizedName(locale string) string {if n, ok := v.Names[locale]; ok && n != "" {return n}@@ -345,7 +258,7 @@ func (v *Vendor) LocalizedName(locale string) string {}// LocalizedDescription returns the description for a locale.-func (v *Vendor) LocalizedDescription(locale string) string {+func (v *Definition) LocalizedDescription(locale string) string {if d, ok := v.Descriptions[locale]; ok && d != "" {return d}@@ -354,7 +267,7 @@ func (v *Vendor) LocalizedDescription(locale string) string {// AuthStyleFor returns the auth style this vendor uses for one protocol,// falling back to the vendor-wide Auth.-func (v *Vendor) AuthStyleFor(protocol api.API) AuthStyle {+func (v *Definition) AuthStyleFor(protocol api.API) AuthStyle {if style, ok := v.AuthByAPI[protocol]; ok && style != "" {return style}@@ -363,8 +276,8 @@ func (v *Vendor) AuthStyleFor(protocol api.API) AuthStyle {// AuthFunc builds the request authenticator for the stored credentials. The// protocol matters because a vendor that serves a second protocol on a-// sub-path may authenticate it differently (see Vendor.AuthByAPI).-func (v *Vendor) AuthFunc(protocol api.API, creds Credentials) api.AuthFunc {+// sub-path may authenticate it differently (see Definition.AuthByAPI).+func (v *Definition) AuthFunc(protocol api.API, creds api.Credentials) api.AuthFunc {switch v.AuthStyleFor(protocol) {case AuthAPIKeyHeader:return api.HeaderAuth("api-key", creds.APIKey)@@ -385,7 +298,7 @@ func (v *Vendor) AuthFunc(protocol api.API, creds Credentials) api.AuthFunc {}// ValidateConfig runs the vendor's validation.-func (v *Vendor) ValidateConfig(cfg *Config) error {+func (v *Definition) ValidateConfig(cfg *Config) error {if v.Validate != nil {return v.Validate(cfg)}@@ -395,5 +308,21 @@ func (v *Vendor) ValidateConfig(cfg *Config) error {// IconContentType is the media type of vendor icons served inline.const IconContentType = "image/svg+xml"-// Ptr returns a pointer to v; vendor packages use it to fill overlay structs.-func Ptr[T any](v T) *T { return &v }+// GenericID is the catch-all OpenAI-compatible provider.+const GenericID = "generic"++func defaultValidate(v *Definition, cfg *Config) error {+ if cfg == nil {+ return fmt.Errorf("config is nil")+ }+ if v.RequiresAuth && v.Auth != AuthSigned && strings.TrimSpace(cfg.APIKey) == "" {+ return fmt.Errorf("API key is required for %s", v.Name)+ }+ if v.ID == GenericID && strings.TrimSpace(cfg.BaseURL) == "" {+ return fmt.Errorf("base URL is required for generic provider")+ }+ if strings.TrimSpace(cfg.ModelName) == "" {+ return fmt.Errorf("model name is required")+ }+ return nil+}diff --git a/internal/models/vendors/gemini/vendor.go b/internal/models/providers/gemini.gosimilarity index 77%rename from internal/models/vendors/gemini/vendor.gorename to internal/models/providers/gemini.goindex 7694f0261..b5f7dd63f 100644--- a/internal/models/vendors/gemini/vendor.go+++ b/internal/models/providers/gemini.go@@ -1,4 +1,4 @@-// Package gemini registers Google's Gemini API.+// Package providers registers Google's Gemini API.//// Facts (https://ai.google.dev/gemini-api/docs/thinking):// - the native protocol is generateContent under@@ -44,67 +44,63 @@// - gemini-3.1-flash-lite is on the models page but absent from the// thinking guide's level table, so its minimal rung is an assumption// carried over from the other Flash Lite tiers.-package gemini+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/gemini.svg+var geminiIcon []byte-//go:embed icon.svg-var icon []byte+// GeminiID is the provider identifier stored on model rows.+const GeminiID = "gemini"-// ID is the provider identifier stored on model rows.-const ID = "gemini"+// GeminiBaseURL is the native Gemini API endpoint.+const GeminiBaseURL = "https://generativelanguage.googleapis.com/v1beta"-// BaseURL is the native Gemini API endpoint.-const BaseURL = "https://generativelanguage.googleapis.com/v1beta"+// GeminiOpenAICompatBaseURL keeps the OpenAI Chat Completions protocol.+const GeminiOpenAICompatBaseURL = GeminiBaseURL + "/openai"-// OpenAICompatBaseURL keeps the OpenAI Chat Completions protocol.-const OpenAICompatBaseURL = BaseURL + "/openai"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newGeminiProvider() *Definition {+ return &Definition{+ ID: GeminiID,Name: "Google Gemini",Names: map[string]string{"zh-CN": "Google Gemini"},Description: "gemini-3.8-flash, gemini-3.1-pro-preview, gemini-2.5-pro, gemini-embedding-2, etc. " +- "Native generateContent by default; set base_url to " + OpenAICompatBaseURL ++ "Native generateContent by default; set base_url to " + GeminiOpenAICompatBaseURL +" to keep the OpenAI-compatible protocol.",Descriptions: map[string]string{"zh-CN": "gemini-3.8-flash, gemini-3.1-pro-preview, gemini-2.5-pro, gemini-embedding-2 等。" +- "默认走原生 generateContent 协议;将 base_url 指向 " + OpenAICompatBaseURL + " 可继续使用 OpenAI 兼容协议。",+ "默认走原生 generateContent 协议;将 base_url 指向 " + GeminiOpenAICompatBaseURL + " 可继续使用 OpenAI 兼容协议。",},Website: "https://aistudio.google.com",- Icon: icon,+ Icon: geminiIcon,API: api.APIGoogleGenerativeAI,EmbeddingAPI: api.EmbeddingGoogle,Order: 33,RequiresAuth: true,- Auth: catalog.AuthGoogleAPIKey,+ Auth: AuthGoogleAPIKey,// The OpenAI-compatible facade documents only Authorization: Bearer.// Sending x-goog-api-key there would change the credential of every// row stored before the native protocol became the default — they all// carry the .../v1beta/openai base URL.- AuthByAPI: map[api.API]catalog.AuthStyle{- api.APIOpenAICompletions: catalog.AuthBearer,+ AuthByAPI: map[api.API]AuthStyle{+ api.APIOpenAICompletions: AuthBearer,},URLPatterns: []string{"generativelanguage.googleapis.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,+ types.ModelTypeKnowledgeQA: GeminiBaseURL,+ types.ModelTypeEmbedding: GeminiBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeEmbedding,},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// https://ai.google.dev/api/embeddings: per request model, content// and embedContentConfig {taskType, title, outputDimensionality,// autoTruncate, …}; the same option names at the top level of the@@ -114,19 +110,18 @@ func init() {// gemini-embedding-001 only and is deliberately not declared: it// changes the document vectors, so turning it on would split every// existing index across two spaces (Tencent/WeKnora#1401).- Embeddings: catalog.EmbeddingsCompat{- DimensionsField: catalog.Ptr("outputDimensionality"),+ Embeddings: api.EmbeddingsCompat{+ DimensionsField: api.Ptr("outputDimensionality"),},// Used when the operator points base_url at the /openai facade.- OpenAICompletions: catalog.OpenAICompletionsCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{ToolCallExtraFields: []string{"extra_content"},- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenAI),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenAI),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},// Native protocol keeps the generativelanguage defaults.- GoogleGenerativeAI: catalog.GoogleGenerativeAICompat{},+ GoogleGenerativeAI: api.GoogleGenerativeAICompat{},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/generic/vendor.go b/internal/models/providers/generic.gosimilarity index 79%rename from internal/models/vendors/generic/vendor.gorename to internal/models/providers/generic.goindex 145530fdc..39f4e125f 100644--- a/internal/models/vendors/generic/vendor.go+++ b/internal/models/providers/generic.go@@ -1,4 +1,4 @@-// Package generic registers the catch-all vendor for any OpenAI-compatible+// Package providers registers the catch-all vendor for any OpenAI-compatible// endpoint (vLLM, SGLang, Xinference, Ollama's OpenAI facade, ...).//// Facts (no single upstream; the settings follow the vLLM / SGLang@@ -29,40 +29,33 @@// DeepSeek-V3, so a non-Qwen template will ignore the switch this vendor// sends rather than reject it. Per-model chat-template keys are not// expressible in the compat model.-package generic+package providersimport (_ "embed""fmt""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/generic.svg+var genericIcon []byte-//go:embed icon.svg-var icon []byte--// ID is the provider identifier stored on model rows. It must equal-// catalog.GenericID because Resolve degrades unknown vendors to it.-const ID = catalog.GenericID--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newGenericProvider() *Definition {+ return &Definition{+ ID: GenericID,Name: "Custom (OpenAI-compatible)",Names: map[string]string{"zh-CN": "自定义 (OpenAI兼容接口)"},Description: "Any OpenAI-compatible endpoint (vLLM, SGLang, Xinference, Ollama, ...)",Descriptions: map[string]string{"zh-CN": "任意 OpenAI 兼容接口(vLLM、SGLang、Xinference、Ollama 等)"},- Icon: icon,+ Icon: genericIcon,API: api.APIOpenAICompletions,Order: 0,RequiresAuth: false,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,DefaultBaseURLs: map[types.ModelType]string{},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -71,12 +64,12 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- ExtraFields: []catalog.ExtraField{{- Key: catalog.ExtraScoreScale,+ ExtraFields: []ExtraField{{+ Key: models.ExtraScoreScale,Label: "Rerank score scale",Labels: map[string]string{"zh-CN": "Rerank 分数标度"},Type: "select",- Options: []catalog.ExtraFieldOption{+ Options: []ExtraFieldOption{{Label: "Unbounded score (Qwen3-Reranker class)",Labels: map[string]string{"zh-CN": "无界分数(Qwen3-Reranker 一类)"},@@ -96,7 +89,7 @@ func init() {Required: false,ModelTypes: []types.ModelType{types.ModelTypeRerank},}, {- Key: catalog.ExtraTruncatePromptTokens,+ Key: models.ExtraTruncatePromptTokens,Label: "Rerank prompt truncation (vLLM)",Labels: map[string]string{"zh-CN": "Rerank 提示词截断长度(vLLM)"},Type: "number",@@ -107,7 +100,7 @@ func init() {Placeholders: map[string]string{"zh-CN": "留空,除非后端因文档过长而报错"},ModelTypes: []types.ModelType{types.ModelTypeRerank},}},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// Transcriptions keeps the baseline, json by default. The// pre-catalog client always asked for verbose_json, which not every// model or server can produce: OpenAI's gpt-4o transcribers accept@@ -116,30 +109,30 @@ func init() {// {"response_format": "verbose_json"} in its compat. The language// hint goes as OpenAI's language form field, which a server that// does not implement it ignores.- Transcriptions: catalog.TranscriptionsCompat{- LanguageParam: catalog.Ptr(catalog.LanguageForm),+ Transcriptions: api.TranscriptionsCompat{+ LanguageParam: api.Ptr(api.LanguageForm),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// Whatever the operator runs. Everything the pre-catalog client// sent stays: vLLM, SGLang, TEI and Ollama's OpenAI route all// accept it, and dimensions still goes out only when the row// asks for a width.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),- AcceptsTruncatePromptTokens: catalog.Ptr(true),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),+ AcceptsTruncatePromptTokens: api.Ptr(true),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// Any OpenAI-compatible endpoint an operator points here is most// often a vLLM or SGLang server, which is where// truncate_prompt_tokens comes from.- AcceptsTruncatePromptTokens: catalog.Ptr(true),+ AcceptsTruncatePromptTokens: api.Ptr(true),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatChatTemplateKwargs),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatChatTemplateKwargs),},},- Validate: func(cfg *catalog.Config) error {+ Validate: func(cfg *Config) error {if cfg == nil {return fmt.Errorf("config is nil")}@@ -151,6 +144,5 @@ func init() {}return nil},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/gpustack/vendor.go b/internal/models/providers/gpustack.gosimilarity index 77%rename from internal/models/vendors/gpustack/vendor.gorename to internal/models/providers/gpustack.goindex f42f3ff1c..0062b6ecd 100644--- a/internal/models/vendors/gpustack/vendor.go+++ b/internal/models/providers/gpustack.go@@ -1,4 +1,4 @@-// Package gpustack registers a self-hosted GPUStack cluster+// Package providers registers a self-hosted GPUStack cluster// (https://github.com/gpustack/gpustack).//// Facts (https://docs.gpustack.ai/latest/integrations/inference-apis/):@@ -27,52 +27,49 @@// The 2.x docs neither document it nor announce its removal, which is why// the default moved to /v1 rather than keeping a path only one line// documents.-package gpustack+package providersimport (_ "embed""fmt""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/gpustack.svg+var gpustackIcon []byte-//go:embed icon.svg-var icon []byte+// GpustackID is the provider identifier stored on model rows.+const GpustackID = "gpustack"-// ID is the provider identifier stored on model rows.-const ID = "gpustack"--// BaseURL is the OpenAI-compatible placeholder. Since GPUStack 2.x every+// GpustackBaseURL is the OpenAI-compatible placeholder. Since GPUStack 2.x every// surface — chat, embeddings, transcriptions and the Jina-style rerank —// hangs off /v1.-const BaseURL = "http://your_gpustack_server_url/v1"+const GpustackBaseURL = "http://your_gpustack_server_url/v1"-func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newGpustackProvider() *Definition {+ return &Definition{+ ID: GpustackID,Name: "GPUStack",Names: map[string]string{"zh-CN": "GPUStack"},Description: "Choose your deployed model on GPUStack",Descriptions: map[string]string{"zh-CN": "选择你在 GPUStack 上部署的模型"},Website: "https://gpustack.ai",- Icon: icon,+ Icon: gpustackIcon,API: api.APIOpenAICompletions,Order: 60,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"gpustack"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,- types.ModelTypeASR: BaseURL,+ types.ModelTypeKnowledgeQA: GpustackBaseURL,+ types.ModelTypeEmbedding: GpustackBaseURL,+ types.ModelTypeRerank: GpustackBaseURL,+ types.ModelTypeVLLM: GpustackBaseURL,+ types.ModelTypeASR: GpustackBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -81,12 +78,12 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- ExtraFields: []catalog.ExtraField{{- Key: catalog.ExtraScoreScale,+ ExtraFields: []ExtraField{{+ Key: models.ExtraScoreScale,Label: "Rerank score scale",Labels: map[string]string{"zh-CN": "Rerank 分数标度"},Type: "select",- Options: []catalog.ExtraFieldOption{+ Options: []ExtraFieldOption{{Label: "Unbounded score (Qwen3-Reranker class)",Labels: map[string]string{"zh-CN": "无界分数(Qwen3-Reranker 一类)"},@@ -106,7 +103,7 @@ func init() {Required: false,ModelTypes: []types.ModelType{types.ModelTypeRerank},}, {- Key: catalog.ExtraTruncatePromptTokens,+ Key: models.ExtraTruncatePromptTokens,Label: "Rerank prompt truncation (vLLM)",Labels: map[string]string{"zh-CN": "Rerank 提示词截断长度(vLLM)"},Type: "number",@@ -117,7 +114,7 @@ func init() {Placeholders: map[string]string{"zh-CN": "留空,除非后端因文档过长而报错"},ModelTypes: []types.ModelType{types.ModelTypeRerank},}},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// Transcriptions keeps the baseline, json by default. GPUStack// serves audio through vox-box (https://github.com/gpustack/vox-box),// whose route wraps a json answer as {"text": ...} but returns@@ -126,34 +123,34 @@ func init() {// format. The pre-catalog client's verbose_json therefore arrived// as a JSON string that could not be decoded. The route reads a// language form field.- Transcriptions: catalog.TranscriptionsCompat{- LanguageParam: catalog.Ptr(catalog.LanguageForm),+ Transcriptions: api.TranscriptionsCompat{+ LanguageParam: api.Ptr(api.LanguageForm),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// vLLM's embedding server: dimensions for Matryoshka models, the// row's truncation budget, and encoding_format.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),- AcceptsTruncatePromptTokens: catalog.Ptr(true),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),+ AcceptsTruncatePromptTokens: api.Ptr(true),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// GPUStack's built-in backends are vLLM, SGLang, Ascend MindIE and// VoxBox, so the vLLM rerank extension reaches the model.- AcceptsTruncatePromptTokens: catalog.Ptr(true),+ AcceptsTruncatePromptTokens: api.Ptr(true),// The field is spelled relevance_score like the Cohere shape, but// it is not a probability: the rerank API page's own example// returns 1.951932668685913, -3.7347371578216553 and// -6.157620906829834. Read as a probability, every negative score// falls below a relevance threshold tuned for 0..1.// https://docs.gpustack.ai/2.0/user-guide/rerank-api/- ScoreScale: catalog.Ptr(api.ScoreLogit),+ ScoreScale: api.Ptr(api.ScoreLogit),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatChatTemplateKwargs),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatChatTemplateKwargs),},},- Validate: func(cfg *catalog.Config) error {+ Validate: func(cfg *Config) error {if cfg == nil {return fmt.Errorf("config is nil")}@@ -168,6 +165,5 @@ func init() {}return nil},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/hunyuan/vendor.go b/internal/models/providers/hunyuan.gosimilarity index 83%rename from internal/models/vendors/hunyuan/vendor.gorename to internal/models/providers/hunyuan.goindex 8dfc85733..3218de8b2 100644--- a/internal/models/vendors/hunyuan/vendor.go+++ b/internal/models/providers/hunyuan.go@@ -1,4 +1,4 @@-// Package hunyuan registers Tencent Hunyuan through its OpenAI-compatible+// Package providers registers Tencent Hunyuan through its OpenAI-compatible// endpoint.//// Facts (https://cloud.tencent.com/document/product/1729/111007):@@ -52,61 +52,56 @@// unverified: the hunyuan-2.0-* ids are documented only on the Anthropic// facade, so their availability on this OpenAI-compatible host, their// context windows and their output caps are unconfirmed.-package hunyuan+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/hunyuan.svg+var hunyuanIcon []byte-//go:embed icon.svg-var icon []byte+// HunyuanID is the provider identifier stored on model rows.+const HunyuanID = "hunyuan"-// ID is the provider identifier stored on model rows.-const ID = "hunyuan"+// HunyuanBaseURL is the OpenAI-compatible endpoint (chat and embedding).+const HunyuanBaseURL = "https://api.hunyuan.cloud.tencent.com/v1"-// BaseURL is the OpenAI-compatible endpoint (chat and embedding).-const BaseURL = "https://api.hunyuan.cloud.tencent.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newHunyuanProvider() *Definition {+ return &Definition{+ ID: HunyuanID,Name: "Tencent Hunyuan",Names: map[string]string{"zh-CN": "腾讯混元 Hunyuan"},Description: "hunyuan-t1-latest, hunyuan-turbos-latest, hunyuan-a13b, hunyuan-embedding, etc.",Website: "https://cloud.tencent.com/product/hunyuan",- Icon: icon,+ Icon: hunyuanIcon,API: api.APIOpenAICompletions,Order: 13,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"hunyuan.cloud.tencent.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,+ types.ModelTypeKnowledgeQA: HunyuanBaseURL,+ types.ModelTypeEmbedding: HunyuanBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeEmbedding,},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// Embeddings keeps the bare baseline on purpose: "Embedding 接口目前仅// 支持 input 和 model 参数 … dimensions 固定为 1024"// (https://cloud.tencent.com/document/product/1729/111007).- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),// 可选值包括 none、auto、custom: neither "required" nor OpenAI's// named-function object is documented.ToolChoiceModes: []string{"none", "auto"},},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/jina/vendor.go b/internal/models/providers/jina.gosimilarity index 74%rename from internal/models/vendors/jina/vendor.gorename to internal/models/providers/jina.goindex 0d1b4191c..5a21153e4 100644--- a/internal/models/vendors/jina/vendor.go+++ b/internal/models/providers/jina.go@@ -1,4 +1,4 @@-// Package jina registers Jina AI's embedding and rerank APIs.+// Package providers registers Jina AI's embedding and rerank APIs.//// Facts (https://jina.ai/embeddings and https://jina.ai/reranker):// - both endpoints live under https://api.jina.ai/v1 and authenticate with@@ -20,51 +20,47 @@// Unverified: api.jina.ai does not serve a fetchable OpenAPI document, so// the OpenAI-schema compatibility claim rests on the wording of the// embeddings FAQ rather than a spec.-package jina+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/jina.svg+var jinaIcon []byte-//go:embed icon.svg-var icon []byte+// JinaID is the provider identifier stored on model rows.+const JinaID = "jina"-// ID is the provider identifier stored on model rows.-const ID = "jina"+// JinaBaseURL serves embeddings and rerank.+const JinaBaseURL = "https://api.jina.ai/v1"-// BaseURL serves embeddings and rerank.-const BaseURL = "https://api.jina.ai/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newJinaProvider() *Definition {+ return &Definition{+ ID: JinaID,Name: "Jina AI",Names: map[string]string{"zh-CN": "Jina"},Description: "jina-embeddings-v5-text-small, jina-embeddings-v4, jina-reranker-v3.5, jina-reranker-m0, etc.",Website: "https://jina.ai",- Icon: icon,+ Icon: jinaIcon,API: api.APIOpenAICompletions,Order: 50,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"api.jina.ai"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,+ types.ModelTypeEmbedding: JinaBaseURL,+ types.ModelTypeRerank: JinaBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeEmbedding,types.ModelTypeRerank,},- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// https://jina.ai/embeddings/: model, input, an optional task,// dimensions, embedding_type, normalized, late_chunking and a// boolean truncate that defaults to false (an over-long input is@@ -73,17 +69,16 @@ func init() {// changes the document vectors, so turning it on would leave every// existing index half in one space and half in another// (Tencent/WeKnora#1401).- DimensionsField: catalog.Ptr("dimensions"),- TruncateField: catalog.Ptr("truncate"),- TruncateValue: catalog.Ptr("true"),+ DimensionsField: api.Ptr("dimensions"),+ TruncateField: api.Ptr("truncate"),+ TruncateValue: api.Ptr("true"),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// return_documents echoes the text back. Results are matched// by index, so this is not needed to map them; it is kept// because it is what this vendor has always been sent.- SendReturnDocs: catalog.Ptr(true),+ SendReturnDocs: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/litellm/vendor.go b/internal/models/providers/litellm.gosimilarity index 75%rename from internal/models/vendors/litellm/vendor.gorename to internal/models/providers/litellm.goindex 23c24f2af..4d30d963a 100644--- a/internal/models/vendors/litellm/vendor.go+++ b/internal/models/providers/litellm.go@@ -1,4 +1,4 @@-// Package litellm registers a self-hosted LiteLLM proxy+// Package providers registers a self-hosted LiteLLM proxy// (https://github.com/BerriAI/litellm).//// Facts (https://docs.litellm.ai/docs/reasoning_content):@@ -26,51 +26,48 @@// the provider in the request body", but a proxy configured with// allowed_openai_params may drop it, so operators fronting open-weight// models may need thinking_control=chat_template_kwargs plus that allowlist.-package litellm+package providersimport (_ "embed"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/litellm.svg+var litellmIcon []byte-//go:embed icon.svg-var icon []byte+// LitellmID is the provider identifier stored on model rows.+const LitellmID = "litellm"-// ID is the provider identifier stored on model rows.-const ID = "litellm"+// LitellmBaseURL is a placeholder the operator replaces with a reachable proxy.+const LitellmBaseURL = "http://your_litellm_proxy/v1"-// BaseURL is a placeholder the operator replaces with a reachable proxy.-const BaseURL = "http://your_litellm_proxy/v1"--// RerankBaseURL is the proxy root. LiteLLM documents rerank at /rerank+// LitellmRerankBaseURL is the proxy root. LiteLLM documents rerank at /rerank// rather than /v1/rerank, so it does not hang off the chat base URL.-const RerankBaseURL = "http://your_litellm_proxy"+const LitellmRerankBaseURL = "http://your_litellm_proxy"-func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newLitellmProvider() *Definition {+ return &Definition{+ ID: LitellmID,Name: "LiteLLM",Names: map[string]string{"zh-CN": "LiteLLM"},- Description: "Self-hosted LiteLLM proxy: one OpenAI-compatible endpoint to 100+ providers.",+ Description: "Self-hosted LiteLLM proxy: one OpenAI-compatible endpoint to 100+ ",Descriptions: map[string]string{"zh-CN": "自建 LiteLLM 代理:一个 OpenAI 兼容入口对接 100+ 模型服务。"},Website: "https://docs.litellm.ai",- Icon: icon,+ Icon: litellmIcon,API: api.APIOpenAICompletions,Order: 41,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"litellm"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: RerankBaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: LitellmBaseURL,+ types.ModelTypeEmbedding: LitellmBaseURL,+ types.ModelTypeRerank: LitellmRerankBaseURL,+ types.ModelTypeVLLM: LitellmBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -79,12 +76,12 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- ExtraFields: []catalog.ExtraField{{- Key: catalog.ExtraScoreScale,+ ExtraFields: []ExtraField{{+ Key: models.ExtraScoreScale,Label: "Rerank score scale",Labels: map[string]string{"zh-CN": "Rerank 分数标度"},Type: "select",- Options: []catalog.ExtraFieldOption{+ Options: []ExtraFieldOption{{Label: "Unbounded score (Qwen3-Reranker class)",Labels: map[string]string{"zh-CN": "无界分数(Qwen3-Reranker 一类)"},@@ -104,20 +101,20 @@ func init() {Required: false,ModelTypes: []types.ModelType{types.ModelTypeRerank},}},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// Transcriptions keeps the baseline: the proxy serves the OpenAI// /audio/transcriptions route for whichever upstream it is// configured with (https://docs.litellm.ai/docs/audio_transcription).- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://docs.litellm.ai/docs/embedding/supported_embedding:// model, input, user, dimensions, encoding_format; anything else// is forwarded to the upstream as a provider-specific kwarg.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenAI),- SupportsReasoningEffort: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenAI),+ SupportsReasoningEffort: api.Ptr(true),},},// LiteLLM documents the whole ladder plus "none" as the off switch.@@ -126,6 +123,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("xhigh"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/lkeap/vendor.go b/internal/models/providers/lkeap.gosimilarity index 80%rename from internal/models/vendors/lkeap/vendor.gorename to internal/models/providers/lkeap.goindex 4bce13233..9f44aa7c6 100644--- a/internal/models/vendors/lkeap/vendor.go+++ b/internal/models/providers/lkeap.go@@ -1,4 +1,4 @@-// Package lkeap registers Tencent Cloud LKEAP (Knowledge Engine Atomic+// Package providers registers Tencent Cloud LKEAP (Knowledge Engine Atomic// Power) through its OpenAI-compatible endpoint.//// Chat facts (https://cloud.tencent.com/document/product/1772/115969 and@@ -39,35 +39,31 @@// unverified: LKEAP documents neither tool_choice modes,// stream_options.include_usage nor any prompt-cache accounting, so the// protocol defaults are kept.-package lkeap+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/lkeap.svg+var lkeapIcon []byte-//go:embed icon.svg-var icon []byte+// LkeapID is the provider identifier stored on model rows.+const LkeapID = "lkeap"-// ID is the provider identifier stored on model rows.-const ID = "lkeap"+// LkeapBaseURL is the OpenAI-compatible chat endpoint.+const LkeapBaseURL = "https://api.lkeap.cloud.tencent.com/v1"-// BaseURL is the OpenAI-compatible chat endpoint.-const BaseURL = "https://api.lkeap.cloud.tencent.com/v1"+// LkeapRerankBaseURL is the TC3-signed cloud API host used for rerank.+const LkeapRerankBaseURL = "https://lkeap.tencentcloudapi.com"-// RerankBaseURL is the TC3-signed cloud API host used for rerank.-const RerankBaseURL = "https://lkeap.tencentcloudapi.com"--func init() {+func newLkeapProvider() *Definition {rerankOnly := []types.ModelType{types.ModelTypeRerank}- catalog.Register(&catalog.Vendor{- ID: ID,+ return &Definition{+ ID: LkeapID,Name: "Tencent Cloud LKEAP",Names: map[string]string{"zh-CN": "腾讯云 LKEAP"},Description: "deepseek-v3.2, deepseek-v3.1-terminus, deepseek-r1-0528, lke-reranker-base",@@ -75,15 +71,15 @@ func init() {"zh-CN": "DeepSeek-V3.2、DeepSeek-V3.1-Terminus、DeepSeek-R1-0528、lke-reranker-base",},Website: "https://cloud.tencent.com/product/lkeap",- Icon: icon,+ Icon: lkeapIcon,API: api.APIOpenAICompletions,Order: 23,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"lkeap.cloud.tencent.com", "api.lkeap", "lkeap.tencentcloudapi.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeRerank: RerankBaseURL,+ types.ModelTypeKnowledgeQA: LkeapBaseURL,+ types.ModelTypeRerank: LkeapRerankBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -93,7 +89,7 @@ func init() {// first credential is a SecretId, not a bearer token. Left as the// generic "API Key" an operator pastes an `sk-` key that can never// sign a request.- CredentialLabels: []catalog.CredentialLabel{{+ CredentialLabels: []CredentialLabel{{Label: "SecretId",Labels: map[string]string{"zh-CN": "SecretId(TC3 签名)"},Placeholder: "Tencent Cloud SecretId (AKID...)",@@ -103,7 +99,7 @@ func init() {ModelTypes: rerankOnly,Required: true,}},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []ExtraField{{Key: "secret_key",Label: "Secret Key",@@ -125,7 +121,7 @@ func init() {Type: "select",Default: "ap-guangzhou",Placeholder: "ap-guangzhou",- Options: []catalog.ExtraFieldOption{+ Options: []ExtraFieldOption{{Label: "ap-guangzhou", Value: "ap-guangzhou"},{Label: "ap-beijing", Value: "ap-beijing"},},@@ -133,23 +129,22 @@ func init() {},},RerankAPI: api.RerankTencentLKEAP,- Compat: catalog.VendorCompat{- Rerank: catalog.RerankCompat{+ Compat: VendorCompat{+ Rerank: api.RerankCompat{// RunRerank takes at most 60 documents, and Query plus Docs// together at most 2000 characters.- MaxDocuments: catalog.Ptr(60),- MaxRequestChars: catalog.Ptr(2000),+ MaxDocuments: api.Ptr(60),+ MaxRequestChars: api.Ptr(2000),// Batches went out one at a time before the shared batching// layer existed. A 2000-character budget splits a large// candidate set into many requests, so the default fan-out of// four would be a new burst against RunRerank.- MaxConcurrency: catalog.Ptr(1),+ MaxConcurrency: api.Ptr(1),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/longcat/vendor.go b/internal/models/providers/longcat.gosimilarity index 75%rename from internal/models/vendors/longcat/vendor.gorename to internal/models/providers/longcat.goindex 603a5727b..801f3e72b 100644--- a/internal/models/vendors/longcat/vendor.go+++ b/internal/models/providers/longcat.go@@ -1,4 +1,4 @@-// Package longcat registers Meituan LongCat's OpenAI-compatible endpoint.+// Package providers registers Meituan LongCat's OpenAI-compatible endpoint.//// Facts (chat reference https://longcat.chat/platform/docs/zh/api/chat.html,// overview https://longcat.chat/platform/docs/zh/APIDocs.html):@@ -42,56 +42,51 @@// unverified: the published usage object carries no cache counters even// though the price list bills cached input, so prompt_cache_accounting// stays off; neither prompt_cache_key nor cache_control is documented.-package longcat+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/longcat.svg+var longcatIcon []byte-//go:embed icon.svg-var icon []byte+// LongcatID is the provider identifier stored on model rows.+const LongcatID = "longcat"-// ID is the provider identifier stored on model rows.-const ID = "longcat"+// LongcatBaseURL is the OpenAI-compatible chat endpoint.+const LongcatBaseURL = "https://api.longcat.chat/openai/v1"-// BaseURL is the OpenAI-compatible chat endpoint.-const BaseURL = "https://api.longcat.chat/openai/v1"+// LongcatAnthropicBaseURL is the Anthropic Messages surface of the same platform.+const LongcatAnthropicBaseURL = "https://api.longcat.chat/anthropic/v1"-// AnthropicBaseURL is the Anthropic Messages surface of the same platform.-const AnthropicBaseURL = "https://api.longcat.chat/anthropic/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newLongcatProvider() *Definition {+ return &Definition{+ ID: LongcatID,Name: "LongCat AI",Names: map[string]string{"zh-CN": "美团 LongCat"},Description: "LongCat-2.0",Website: "https://longcat.chat/platform",- Icon: icon,+ Icon: longcatIcon,API: api.APIOpenAICompletions,Order: 22,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"longcat.chat"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: LongcatBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,},- Compat: catalog.VendorCompat{- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),+ Compat: VendorCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/mimo/vendor.go b/internal/models/providers/mimo.gosimilarity index 77%rename from internal/models/vendors/mimo/vendor.gorename to internal/models/providers/mimo.goindex 48ece1f13..4f298563c 100644--- a/internal/models/vendors/mimo/vendor.go+++ b/internal/models/providers/mimo.go@@ -1,4 +1,4 @@-// Package mimo registers Xiaomi MiMo's OpenAI-compatible endpoint.+// Package providers registers Xiaomi MiMo's OpenAI-compatible endpoint.//// Facts (https://mimo.mi.com/static/docs/api/chat/openai-api.md,// https://mimo.mi.com/static/docs/quick-start/summary/model.md,@@ -33,67 +33,62 @@// limits and prices are unconfirmed; the ASR (mimo-v2.5-asr) and TTS models// are documented but not registered here, since this vendor only declares the// chat model type.-package mimo+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/mimo.svg+var mimoIcon []byte-//go:embed icon.svg-var icon []byte+// MimoID is the provider identifier stored on model rows.+const MimoID = "mimo"-// ID is the provider identifier stored on model rows.-const ID = "mimo"+// MimoBaseURL is the OpenAI-compatible chat endpoint.+const MimoBaseURL = "https://api.xiaomimimo.com/v1"-// BaseURL is the OpenAI-compatible chat endpoint.-const BaseURL = "https://api.xiaomimimo.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newMimoProvider() *Definition {+ return &Definition{+ ID: MimoID,Name: "Xiaomi MiMo",Names: map[string]string{"zh-CN": "小米 MiMo"},Description: "mimo-v2.5-pro, mimo-v2.5",Website: "https://platform.xiaomimimo.com",- Icon: icon,+ Icon: mimoIcon,API: api.APIOpenAICompletions,Order: 18,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"xiaomimimo.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: MimoBaseURL,},TranscriptionAPI: api.TranscriptionChatAudio,ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeASR,},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// ASR: mimo-v2.5-asr on the chat endpoint, WAV or MP3 as a base64// data URI whose "encoded string size must not exceed 10 MB"// (https://mimo.mi.com/docs/en-US/quick-start/usage-guide/audio/Speech-Recognition).- Transcriptions: catalog.TranscriptionsCompat{+ Transcriptions: api.TranscriptionsCompat{// The ceiling counts the whole data URI as sent.- MaxEncodedBytes: catalog.Ptr(10 << 20),+ MaxEncodedBytes: api.Ptr(10 << 20),Formats: []string{"wav", "mp3"},// asr_options.language: "auto|zh|en".- LanguageParam: catalog.Ptr(catalog.LanguageASROptions),+ LanguageParam: api.Ptr(api.LanguageASROptions),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ PromptCacheAccounting: api.Ptr(true),// Only `auto` is honoured; everything else is stripped.ToolChoiceModes: []string{"auto"},},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/minimax/vendor.go b/internal/models/providers/minimax.gosimilarity index 71%rename from internal/models/vendors/minimax/vendor.gorename to internal/models/providers/minimax.goindex d5a6f156c..15192c321 100644--- a/internal/models/vendors/minimax/vendor.go+++ b/internal/models/providers/minimax.go@@ -1,4 +1,4 @@-// Package minimax registers MiniMax's OpenAI-compatible chat endpoint.+// Package providers registers MiniMax's OpenAI-compatible chat endpoint.//// Facts (https://platform.minimax.io/docs/api-reference/text-openai-api):// - both `max_tokens` (legacy) and `max_completion_tokens` are accepted,@@ -20,7 +20,7 @@// minimaxi.com, global keys to minimax.io).//// Second protocol: an Anthropic Messages facade lives at-// https://api.minimax.io/anthropic (mainland form in AnthropicBaseURL), and+// https://api.minimax.io/anthropic (mainland form in MinimaxAnthropicBaseURL), and// the vendor presents it first for thinking and tool workflows, documented at// https://platform.minimax.io/docs/api-reference/text-anthropic-api.// Resolve switches protocol when the base URL ends with /anthropic; this@@ -42,82 +42,77 @@// carried over unconfirmed;// unverified: only the global https://api.minimax.io/anthropic form of the// Anthropic facade is spelled out in the docs; the mainland-// https://api.minimaxi.com/anthropic that AnthropicBaseURL holds is inferred+// https://api.minimaxi.com/anthropic that MinimaxAnthropicBaseURL holds is inferred// from the region split of the /v1 hosts.-package minimax+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/minimax.svg+var minimaxIcon []byte-//go:embed icon.svg-var icon []byte+// MinimaxID is the provider identifier stored on model rows.+const MinimaxID = "minimax"-// ID is the provider identifier stored on model rows.-const ID = "minimax"+// MinimaxBaseURL is the mainland-China OpenAI-compatible endpoint.+const MinimaxBaseURL = "https://api.minimaxi.com/v1"-// BaseURL is the mainland-China OpenAI-compatible endpoint.-const BaseURL = "https://api.minimaxi.com/v1"+// MinimaxGlobalBaseURL is the international endpoint.+const MinimaxGlobalBaseURL = "https://api.minimax.io/v1"-// GlobalBaseURL is the international endpoint.-const GlobalBaseURL = "https://api.minimax.io/v1"+// MinimaxAnthropicBaseURL is the Anthropic Messages compatibility facade.+const MinimaxAnthropicBaseURL = "https://api.minimaxi.com/anthropic"-// AnthropicBaseURL is the Anthropic Messages compatibility facade.-const AnthropicBaseURL = "https://api.minimaxi.com/anthropic"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newMinimaxProvider() *Definition {+ return &Definition{+ ID: MinimaxID,Name: "MiniMax",Names: map[string]string{"zh-CN": "MiniMax"},Description: "MiniMax-M3, MiniMax-M2.7, MiniMax-M2.7-highspeed, etc. Global endpoint " +- GlobalBaseURL + "; Anthropic-compatible facade " + AnthropicBaseURL,+ MinimaxGlobalBaseURL + "; Anthropic-compatible facade " + MinimaxAnthropicBaseURL,Descriptions: map[string]string{"zh-CN": "MiniMax-M3, MiniMax-M2.7, MiniMax-M2.7-highspeed 等。国际版 " +- GlobalBaseURL + ";Anthropic 兼容接口 " + AnthropicBaseURL,+ MinimaxGlobalBaseURL + ";Anthropic 兼容接口 " + MinimaxAnthropicBaseURL,},Website: "https://platform.minimaxi.com",- Icon: icon,+ Icon: minimaxIcon,API: api.APIOpenAICompletions,Order: 16,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"minimax.io", "minimaxi.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: MinimaxBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// https://platform.minimax.io/docs/api-reference/speech-to-text// (and the same page on platform.minimax.cn): multipart model// (asr-1.0) + file on /v1/speech_to_text rather than the OpenAI// path, answering {text, duration, trace_id} for the default// json. At most 50 MB and 500 seconds; "超出会返回 400 而不会被截断".- Path: catalog.Ptr("/speech_to_text"),- MaxFileBytes: catalog.Ptr(50 << 20),+ Path: api.Ptr("/speech_to_text"),+ MaxFileBytes: api.Ptr(50 << 20),// "wav / aiff / flac / alac(m4a) / mp3 / aac / opus / ogg";// "不支持无容器的裸 PCM 数据". The language hint is a request// header, a BCP-47 tag, not a form field.Formats: []string{"wav", "aiff", "flac", "m4a", "mp3", "aac", "opus", "ogg"},- LanguageParam: catalog.Ptr(catalog.LanguageHeader),+ LanguageParam: api.Ptr(api.LanguageHeader),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- ThinkingEnabledValue: catalog.Ptr("adaptive"),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ ThinkingEnabledValue: api.Ptr("adaptive"),+ PromptCacheAccounting: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/modelscope/vendor.go b/internal/models/providers/modelscope.gosimilarity index 76%rename from internal/models/vendors/modelscope/vendor.gorename to internal/models/providers/modelscope.goindex 2c8630574..bd4aa52d4 100644--- a/internal/models/vendors/modelscope/vendor.go+++ b/internal/models/providers/modelscope.go@@ -1,4 +1,4 @@-// Package modelscope registers ModelScope's API-Inference service.+// Package providers registers ModelScope's API-Inference service.//// Facts (https://modelscope.cn/docs/model-service/API-Inference/intro,// https://modelscope.cn/docs/model-service/API-Inference/limits):@@ -32,59 +32,54 @@// served, such as Qwen/Qwen3.5-35B-A3B or ZhipuAI/GLM-5.2, do) — they are kept// because no official page states their retirement, but the list needs a// refresh against the model pages.-package modelscope+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/modelscope.svg+var modelscopeIcon []byte-//go:embed icon.svg-var icon []byte+// ModelscopeID is the provider identifier stored on model rows.+const ModelscopeID = "modelscope"-// ID is the provider identifier stored on model rows.-const ID = "modelscope"+// ModelscopeBaseURL is the OpenAI-compatible inference endpoint.+const ModelscopeBaseURL = "https://api-inference.modelscope.cn/v1"-// BaseURL is the OpenAI-compatible inference endpoint.-const BaseURL = "https://api-inference.modelscope.cn/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newModelscopeProvider() *Definition {+ return &Definition{+ ID: ModelscopeID,Name: "ModelScope",Names: map[string]string{"zh-CN": "魔搭 ModelScope"},Description: "Qwen/Qwen3-235B-A22B-Instruct-2507, ZhipuAI/GLM-4.6, Qwen/Qwen3-Embedding-8B, etc.",Website: "https://modelscope.cn",- Icon: icon,+ Icon: modelscopeIcon,API: api.APIOpenAICompletions,Order: 19,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"modelscope.cn"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: ModelscopeBaseURL,+ types.ModelTypeEmbedding: ModelscopeBaseURL,+ types.ModelTypeVLLM: ModelscopeBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeEmbedding,types.ModelTypeVLLM,},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// Embeddings keeps the bare baseline: /v1/embeddings answers, but no// ModelScope page documents a single parameter of it.- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/moonshot/vendor.go b/internal/models/providers/moonshot.gosimilarity index 80%rename from internal/models/vendors/moonshot/vendor.gorename to internal/models/providers/moonshot.goindex 0a6539d57..936d72c8d 100644--- a/internal/models/vendors/moonshot/vendor.go+++ b/internal/models/providers/moonshot.go@@ -1,4 +1,4 @@-// Package moonshot registers Moonshot AI (Kimi).+// Package providers registers Moonshot AI (Kimi).//// Facts (https://platform.kimi.com/docs/api/overview,// https://platform.kimi.com/docs/api/chat,@@ -41,58 +41,53 @@// the protocol defaults are kept; the 262144 max output tokens of the K2.x// entries is not a documented cap (the docs only give a 32768 default); the// per-token costs are USD conversions of the CNY price list.-package moonshot+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/moonshot.svg+var moonshotIcon []byte-//go:embed icon.svg-var icon []byte+// MoonshotID is the provider identifier stored on model rows.+const MoonshotID = "moonshot"-// ID is the provider identifier stored on model rows.-const ID = "moonshot"+// MoonshotBaseURL is the global OpenAI-compatible endpoint.+const MoonshotBaseURL = "https://api.moonshot.ai/v1"-// BaseURL is the global OpenAI-compatible endpoint.-const BaseURL = "https://api.moonshot.ai/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newMoonshotProvider() *Definition {+ return &Definition{+ ID: MoonshotID,Name: "Moonshot AI",Names: map[string]string{"zh-CN": "月之暗面 Moonshot"},Description: "kimi-k3, kimi-k2.7-code, kimi-k2.7-code-highspeed, kimi-k2.6",Website: "https://platform.kimi.com",- Icon: icon,+ Icon: moonshotIcon,API: api.APIOpenAICompletions,Order: 17,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"moonshot.ai", "moonshot.cn"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: MoonshotBaseURL,+ types.ModelTypeVLLM: MoonshotBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,types.ModelTypeVLLM,},- Compat: catalog.VendorCompat{- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- PromptCacheAccounting: catalog.Ptr(true),+ Compat: VendorCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ PromptCacheAccounting: api.Ptr(true),// `required` is kimi-k3 only and a named function 400s while// thinking is on, which is the default on every model.ToolChoiceModes: []string{"none", "auto"},},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/novita/vendor.go b/internal/models/providers/novita.gosimilarity index 72%rename from internal/models/vendors/novita/vendor.gorename to internal/models/providers/novita.goindex 05f38477c..119b34d99 100644--- a/internal/models/vendors/novita/vendor.go+++ b/internal/models/providers/novita.go@@ -1,4 +1,4 @@-// Package novita registers the Novita AI gateway.+// Package providers registers the Novita AI gateway.//// Facts (https://docs.novita.ai — novita.ai/docs/* redirects there):// - chat, embedding, VLM and rerank share https://api.novita.ai/openai/v1;@@ -27,46 +27,42 @@// - the three embedding entries are served by the API but the embeddings// reference restricts `model` to a single enum value (baai/bge-m3), and// they are absent from the default /v1/models listing.-package novita+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/novita.svg+var novitaIcon []byte-//go:embed icon.svg-var icon []byte+// NovitaID is the provider identifier stored on model rows.+const NovitaID = "novita"-// ID is the provider identifier stored on model rows.-const ID = "novita"+// NovitaBaseURL is the OpenAI-compatible gateway endpoint.+const NovitaBaseURL = "https://api.novita.ai/openai/v1"-// BaseURL is the OpenAI-compatible gateway endpoint.-const BaseURL = "https://api.novita.ai/openai/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newNovitaProvider() *Definition {+ return &Definition{+ ID: NovitaID,Name: "Novita AI",Names: map[string]string{"zh-CN": "Novita AI"},Description: "moonshotai/kimi-k3, zai-org/glm-5.2, deepseek/deepseek-v4-pro, qwen/qwen3-embedding-0.6b, etc.",Website: "https://novita.ai",- Icon: icon,+ Icon: novitaIcon,API: api.APIOpenAICompletions,Order: 52,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"api.novita.ai", "novita.ai"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: NovitaBaseURL,+ types.ModelTypeEmbedding: NovitaBaseURL,+ types.ModelTypeRerank: NovitaBaseURL,+ types.ModelTypeVLLM: NovitaBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -74,17 +70,16 @@ func init() {types.ModelTypeRerank,types.ModelTypeVLLM,},- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// https://novita.ai/docs/api-reference/model-apis-llm-create-embeddings:// input, model, encoding_format. Nothing else.- SendEncodingFormat: catalog.Ptr(true),+ SendEncodingFormat: api.Ptr(true),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/nvidia/vendor.go b/internal/models/providers/nvidia.gosimilarity index 78%rename from internal/models/vendors/nvidia/vendor.gorename to internal/models/providers/nvidia.goindex e602adc89..c4bebe6f2 100644--- a/internal/models/vendors/nvidia/vendor.go+++ b/internal/models/providers/nvidia.go@@ -1,4 +1,4 @@-// Package nvidia registers NVIDIA NIM's hosted API (build.nvidia.com).+// Package providers registers NVIDIA NIM's hosted API (build.nvidia.com).//// Facts (https://docs.api.nvidia.com/nim/ and the per-model cards on// https://build.nvidia.com):@@ -50,50 +50,46 @@// "configurable low, high, or max reasoning effort", but none of its// samples show the parameter. The entry assumes the top-level// `reasoning_effort` its first-party API documents.-package nvidia+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/nvidia.svg+var nvidiaIcon []byte-//go:embed icon.svg-var icon []byte+// NvidiaID is the provider identifier stored on model rows.+const NvidiaID = "nvidia"-// ID is the provider identifier stored on model rows.-const ID = "nvidia"+// NvidiaBaseURL serves chat, embedding and VLM.+const NvidiaBaseURL = "https://integrate.api.nvidia.com/v1"-// BaseURL serves chat, embedding and VLM.-const BaseURL = "https://integrate.api.nvidia.com/v1"+// NvidiaRerankBaseURL is the retrieval reranking NIM.+const NvidiaRerankBaseURL = "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking"-// RerankBaseURL is the retrieval reranking NIM.-const RerankBaseURL = "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newNvidiaProvider() *Definition {+ return &Definition{+ ID: NvidiaID,Name: "NVIDIA",Names: map[string]string{"zh-CN": "NVIDIA"},Description: "nvidia/nemotron-3-ultra-550b-a55b, deepseek-ai/deepseek-v4-pro-0813, " +"nvidia/nemotron-3-embed-1b, nvidia/nv-rerankqa-mistral-4b-v3, etc.",Website: "https://build.nvidia.com",- Icon: icon,+ Icon: nvidiaIcon,API: api.APIOpenAICompletions,Order: 51,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"nvidia.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: RerankBaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: NvidiaBaseURL,+ types.ModelTypeEmbedding: NvidiaBaseURL,+ types.ModelTypeRerank: NvidiaRerankBaseURL,+ types.ModelTypeVLLM: NvidiaBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -102,8 +98,8 @@ func init() {types.ModelTypeVLLM,},RerankAPI: api.RerankNIM,- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// https://docs.api.nvidia.com/nim/reference/nvidia-nemotron-3-embed-1b-infer:// input, model, input_type (passage | query), encoding_format,// truncate (NONE | START | END, default NONE), user. There is no@@ -113,28 +109,27 @@ func init() {// insists they must. This is the hosted API: a self-hosted NIM// (https://docs.nvidia.com/nim/nemo-retriever/embedding/latest/reference.html)// does take dimensions, and belongs on a generic row pointed at it.- SendEncodingFormat: catalog.Ptr(true),- InputTypeField: catalog.Ptr("input_type"),+ SendEncodingFormat: api.Ptr(true),+ InputTypeField: api.Ptr("input_type"),InputTypeValues: map[string]string{"document": "passage", "query": "query"},// NONE fails the request on an over-long input instead of// cutting it.- TruncateField: catalog.Ptr("truncate"),- TruncateValue: catalog.Ptr("END"),+ TruncateField: api.Ptr("truncate"),+ TruncateValue: api.Ptr("END"),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// rankings[].logit is unbounded and routinely negative, so the// caller must be told this is not a 0..1 relevance score.- ScoreScale: catalog.Ptr(api.ScoreLogit),+ ScoreScale: api.Ptr(api.ScoreLogit),// truncate defaults to NONE upstream, which fails the request on// an over-long passage instead of cutting it.- Truncate: catalog.Ptr("END"),- MaxDocuments: catalog.Ptr(512),+ Truncate: api.Ptr("END"),+ MaxDocuments: api.Ptr(512),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatChatTemplateKwargs),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatChatTemplateKwargs),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/openai/vendor.go b/internal/models/providers/openai.gosimilarity index 76%rename from internal/models/vendors/openai/vendor.gorename to internal/models/providers/openai.goindex f9191b9b1..8474bcc0c 100644--- a/internal/models/vendors/openai/vendor.go+++ b/internal/models/providers/openai.go@@ -1,4 +1,4 @@-// Package openai registers OpenAI's first-party platform.+// Package providers registers OpenAI's first-party platform.//// Facts (https://developers.openai.com/api/docs — platform.openai.com/docs// now redirects there):@@ -45,48 +45,45 @@// against the entry's own API, and these entries are Chat Completions// entries. GPT-5.6 and later replaced `prompt_cache_retention` with// `prompt_cache_options.ttl`, which the protocol layer does not send yet.-package openai+package providersimport (_ "embed""net/url""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/openai.svg+var openaiIcon []byte-//go:embed icon.svg-var icon []byte+// OpenaiID is the provider identifier stored on model rows.+const OpenaiID = "openai"-// ID is the provider identifier stored on model rows.-const ID = "openai"+// OpenaiBaseURL is the documented first-party endpoint.+const OpenaiBaseURL = "https://api.openai.com/v1"-// BaseURL is the documented first-party endpoint.-const BaseURL = "https://api.openai.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newOpenaiProvider() *Definition {+ return &Definition{+ ID: OpenaiID,Name: "OpenAI",Names: map[string]string{"zh-CN": "OpenAI"},Description: "gpt-6-astra, gpt-5.6-sol, gpt-5.5, gpt-4.1, text-embedding-3-large, etc.",Website: "https://developers.openai.com",- Icon: icon,+ Icon: openaiIcon,API: api.APIOpenAICompletions,Order: 30,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"api.openai.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeVLLM: BaseURL,- types.ModelTypeASR: BaseURL,+ types.ModelTypeKnowledgeQA: OpenaiBaseURL,+ types.ModelTypeEmbedding: OpenaiBaseURL,+ types.ModelTypeVLLM: OpenaiBaseURL,+ types.ModelTypeASR: OpenaiBaseURL,},// No rerank: OpenAI's API has no rerank endpoint — the reference// index (https://developers.openai.com/api/llms.txt) does not mention@@ -98,47 +95,47 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// The transcription reference (URL in openaitranscriptions):// response_format differs per model — "For gpt-4o-transcribe// and gpt-4o-mini-transcribe, the only supported format is// json", the default — so it is declared per entry, not here.// "Files can be up to 25 MB"// (https://developers.openai.com/api/docs/guides/speech-to-text).- MaxFileBytes: catalog.Ptr(25 << 20),+ MaxFileBytes: api.Ptr(25 << 20),// "flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm", and a// language field in ISO-639-1.Formats: []string{"flac", "mp3", "mp4", "mpeg", "mpga", "m4a", "ogg", "wav", "webm"},- LanguageParam: catalog.Ptr(catalog.LanguageForm),+ LanguageParam: api.Ptr(api.LanguageForm),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://developers.openai.com/api/reference/resources/embeddings/methods/create:// model, input, dimensions (text-embedding-3 and later; the ada-002// entry turns it off), encoding_format, user. An input array// "must be 2048 dimensions or less" — elements, despite the word.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),- MaxBatchSize: catalog.Ptr(2048),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),+ MaxBatchSize: api.Ptr(2048),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenAI),- SupportsReasoningEffort: catalog.Ptr(true),- SupportsDeveloperRole: catalog.Ptr(true),- SupportsStore: catalog.Ptr(true),- PromptCacheKey: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenAI),+ SupportsReasoningEffort: api.Ptr(true),+ SupportsDeveloperRole: api.Ptr(true),+ SupportsStore: api.Ptr(true),+ PromptCacheKey: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- PreferAPI: preferResponsesOnFirstParty,- })++ PreferAPI: OpenaiPreferResponsesOnFirstParty,+ }}-// preferResponsesOnFirstParty switches chat traffic aimed at api.openai.com+// OpenaiPreferResponsesOnFirstParty switches chat traffic aimed at api.openai.com// to the Responses protocol. Anything else (Azure-style relays, LiteLLM,// enterprise gateways) keeps Chat Completions, the protocol they document.-func preferResponsesOnFirstParty(baseURL string, spec catalog.ModelSpec) api.API {+func OpenaiPreferResponsesOnFirstParty(baseURL string, spec models.ModelSpec) api.API {if spec.Type != "" && spec.Type != types.ModelTypeKnowledgeQA {return ""}diff --git a/internal/models/vendors/openrouter/vendor.go b/internal/models/providers/openrouter.gosimilarity index 73%rename from internal/models/vendors/openrouter/vendor.gorename to internal/models/providers/openrouter.goindex 38d62c260..a3addf3f2 100644--- a/internal/models/vendors/openrouter/vendor.go+++ b/internal/models/providers/openrouter.go@@ -1,4 +1,4 @@-// Package openrouter registers the OpenRouter gateway.+// Package providers registers the OpenRouter gateway.//// Facts (https://openrouter.ai/docs/guides/best-practices/reasoning-tokens —// the old /docs/use-cases/ path now redirects there):@@ -28,47 +28,43 @@// Unverified: GET /api/v1/models lists chat models only — embedding models// live behind /api/v1/embeddings/models — so any future auto-sync of this// catalog has to read both listings or it will silently lose embeddings.-package openrouter+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/openrouter.svg+var openrouterIcon []byte-//go:embed icon.svg-var icon []byte+// OpenrouterID is the provider identifier stored on model rows.+const OpenrouterID = "openrouter"-// ID is the provider identifier stored on model rows.-const ID = "openrouter"+// OpenrouterBaseURL is the OpenAI-compatible gateway endpoint.+const OpenrouterBaseURL = "https://openrouter.ai/api/v1"-// BaseURL is the OpenAI-compatible gateway endpoint.-const BaseURL = "https://openrouter.ai/api/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newOpenrouterProvider() *Definition {+ return &Definition{+ ID: OpenrouterID,Name: "OpenRouter",Names: map[string]string{"zh-CN": "OpenRouter"},Description: "openai/gpt-5.5, anthropic/claude-opus-5, google/gemini-3.8-flash, " +"deepseek/deepseek-v4-pro, etc.",Website: "https://openrouter.ai",- Icon: icon,+ Icon: openrouterIcon,API: api.APIOpenAICompletions,Order: 40,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"openrouter.ai"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: OpenrouterBaseURL,+ types.ModelTypeEmbedding: OpenrouterBaseURL,+ types.ModelTypeRerank: OpenrouterBaseURL,+ types.ModelTypeVLLM: OpenrouterBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -77,17 +73,17 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// https://openrouter.ai/docs/api/api-reference/stt/create-transcription:// OpenAI-style multipart file + model, json by default. "Max 25// MB; send larger files as base64 JSON via input_audio."- MaxFileBytes: catalog.Ptr(25 << 20),+ MaxFileBytes: api.Ptr(25 << 20),// language is an ISO-639-1 form field. The format "is derived// from the filename extension", with no closed list.- LanguageParam: catalog.Ptr(catalog.LanguageForm),+ LanguageParam: api.Ptr(api.LanguageForm),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://openrouter.ai/docs/api/api-reference/embeddings/create-embeddings:// model, input, dimensions, encoding_format, input_type, provider,// user. input_type is a free-form string handed to whichever@@ -96,14 +92,14 @@ func init() {// an asymmetric model it changes the document vectors. Not// declared, for the reason Jina's task is not// (Tencent/WeKnora#1401).- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenRouter),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheKey: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenRouter),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheKey: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},},// The reasoning.effort enum covers the whole ladder; per-model@@ -112,6 +108,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("xhigh"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/vendors_test.go b/internal/models/providers/providers_test.gosimilarity index 87%rename from internal/models/vendors/vendors_test.gorename to internal/models/providers/providers_test.goindex f3ebb50fd..465c1c564 100644--- a/internal/models/vendors/vendors_test.go+++ b/internal/models/providers/providers_test.go@@ -1,12 +1,14 @@-package vendors+package providers_testimport ("bytes""strings""testing"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -25,7 +27,7 @@ func TestAllVendorsRegistered(t *testing.T) {t.Fatalf("expected 27 vendor ids in the spec, got %d", len(expectedIDs))}for _, id := range expectedIDs {- v, ok := catalog.Get(id)+ v, ok := modelruntime.Get(id)if !ok {t.Errorf("vendor %q is not registered", id)continue@@ -45,7 +47,7 @@ func TestAllVendorsRegistered(t *testing.T) {if v.RequiresAuth && v.Auth == "" {t.Errorf("vendor %q: RequiresAuth without Auth style", id)}- if v.Auth == catalog.AuthSigned && v.Signer == nil {+ if v.Auth == providers.AuthSigned && v.Signer == nil {t.Errorf("vendor %q: AuthSigned without Signer", id)}if !v.API.Known() {@@ -55,7 +57,7 @@ func TestAllVendorsRegistered(t *testing.T) {t.Errorf("vendor %q: no ModelTypes", id)}}- for _, v := range catalog.List() {+ for _, v := range modelruntime.List() {found := falsefor _, id := range expectedIDs {if id == v.ID {@@ -71,11 +73,11 @@ func TestAllVendorsRegistered(t *testing.T) {func TestEveryCatalogEntryResolves(t *testing.T) {for _, id := range expectedIDs {- v, ok := catalog.Get(id)+ v, ok := modelruntime.Get(id)if !ok {t.Fatalf("vendor %q missing", id)}- for _, m := range v.Models {+ for _, m := range v.Models() {if m.ID == "" && m.Match == "" {t.Errorf("%s: model entry %q has neither id nor match", id, m.Name)continue@@ -89,7 +91,7 @@ func TestEveryCatalogEntryResolves(t *testing.T) {if modelType == "" {modelType = types.ModelTypeKnowledgeQA}- r, err := catalog.Resolve(catalog.Ref{Provider: v.ID, Model: name, ModelType: modelType})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: v.ID, Model: name, ModelType: modelType})// An entry may declare that this build cannot serve it — a vendor// whose second rerank dialect has no protocol package. Refusing is// the point: the alternative is a request shaped for the wrong@@ -139,7 +141,7 @@ func TestNamesInsideChatGlobsResolveForOtherTypes(t *testing.T) {}for _, n := range names {for _, modelType := range []types.ModelType{types.ModelTypeEmbedding, types.ModelTypeRerank} {- r, err := catalog.Resolve(catalog.Ref{Provider: n.provider, Model: n.model, ModelType: modelType})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: n.provider, Model: n.model, ModelType: modelType})if err != nil {t.Errorf("%s/%s as %s: %v", n.provider, n.model, modelType, err)continue@@ -154,7 +156,7 @@ func TestNamesInsideChatGlobsResolveForOtherTypes(t *testing.T) {func TestDetectByURLRoundTrip(t *testing.T) {for _, id := range expectedIDs {- v, _ := catalog.Get(id)+ v, _ := modelruntime.Get(id)if len(v.URLPatterns) == 0 {continue}@@ -162,19 +164,19 @@ func TestDetectByURLRoundTrip(t *testing.T) {if !strings.HasPrefix(u, "https://") || strings.Contains(u, "{") {continue // placeholder or http-only self-hosted default}- if got := catalog.DetectByURL(u); got != v.ID {+ if got := modelruntime.DetectByURL(u); got != v.ID {t.Errorf("DetectByURL(%q) = %q, want %q", u, got, v.ID)}}- if got := catalog.DetectByURL("http://your_litellm_proxy/v1"); got != "litellm" {+ if got := modelruntime.DetectByURL("http://your_litellm_proxy/v1"); got != "litellm" {t.Errorf("litellm placeholder detected as %q", got)}// GPUStack 2.x serves the OpenAI-compatible surface at /v1; the 0.x// /v1-openai path must keep resolving for rows saved before the move.- if got := catalog.DetectByURL("http://your_gpustack_server_url/v1-openai"); got != "gpustack" {+ if got := modelruntime.DetectByURL("http://your_gpustack_server_url/v1-openai"); got != "gpustack" {t.Errorf("gpustack placeholder detected as %q", got)}- if got := catalog.DetectByURL("https://api.moonshot.cn/v1"); got != "moonshot" {+ if got := modelruntime.DetectByURL("https://api.moonshot.cn/v1"); got != "moonshot" {t.Errorf("moonshot.cn detected as %q", got)}}@@ -194,7 +196,7 @@ func TestOpenAIProtocolSelection(t *testing.T) {{"https://api.openai.com/v1", map[string]string{"api": "openai-completions"}, api.APIOpenAICompletions},}for _, tc := range cases {- r, err := catalog.Resolve(catalog.Ref{+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "openai", Model: "gpt-5.5", BaseURL: tc.baseURL, Extra: tc.extra,})if err != nil {@@ -206,9 +208,9 @@ func TestOpenAIProtocolSelection(t *testing.T) {}}-func resolve(t *testing.T, provider, model string) *catalog.Resolved {+func resolve(t *testing.T, provider, model string) *modelruntime.Resolved {t.Helper()- r, err := catalog.Resolve(catalog.Ref{Provider: provider, Model: model})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: provider, Model: model})if err != nil {t.Fatalf("resolve %s/%s: %v", provider, model, err)}@@ -278,15 +280,15 @@ func TestFamilyExpectations(t *testing.T) {if r := resolve(t, "gemini", "gemini-2.5-flash"); r.API != api.APIGoogleGenerativeAI {t.Errorf("gemini/gemini-2.5-flash API = %q", r.API)}- if r := resolve(t, "gemini", "gemini-3.8-flash"); r.GoogleGenerativeAI.ThinkingMode != catalog.GoogleThinkingLevel {+ if r := resolve(t, "gemini", "gemini-3.8-flash"); r.GoogleGenerativeAI.ThinkingMode != api.GoogleThinkingLevel {t.Errorf("gemini/gemini-3.8-flash thinking mode = %q", r.GoogleGenerativeAI.ThinkingMode)}if r := resolve(t, "anthropic", "claude-opus-5"); r.AnthropicMessages.ThinkingMode !=- catalog.AnthropicThinkingAdaptive || !r.AnthropicMessages.SupportsEffort {+ api.AnthropicThinkingAdaptive || !r.AnthropicMessages.SupportsEffort {t.Error("anthropic/claude-opus-5 should use adaptive thinking with effort")}if r := resolve(t, "anthropic", "claude-sonnet-4-5"); r.AnthropicMessages.ThinkingMode !=- catalog.AnthropicThinkingBudget {+ api.AnthropicThinkingBudget {t.Error("anthropic/claude-sonnet-4-5 should keep budget thinking")}if r := resolve(t, "anthropic", "claude-sonnet-4-5-20250929"); !r.Cataloged {@@ -329,13 +331,13 @@ func TestFamilyExpectations(t *testing.T) {// default (chat_template_kwargs) would silently drop the level.for _, model := range []string{"z-ai/glm-5.3", "moonshotai/kimi-k3"} {r := resolve(t, "nvidia", model)- if r.OpenAICompletions.ThinkingFormat != catalog.ThinkingFormatOpenAI ||+ if r.OpenAICompletions.ThinkingFormat != api.ThinkingFormatOpenAI ||!r.OpenAICompletions.SupportsReasoningEffort {t.Errorf("nvidia/%s should grade with a top-level reasoning_effort", model)}}if r := resolve(t, "nvidia", "nvidia/nemotron-3-ultra-550b-a55b"); r.OpenAICompletions.ThinkingFormat !=- catalog.ThinkingFormatChatTemplateKwargs {+ api.ThinkingFormatChatTemplateKwargs {t.Error("nvidia nemotron should keep the chat-template switch")}// DashScope errors when qwen3.8-max gets both fields.@@ -350,12 +352,12 @@ func TestFamilyExpectations(t *testing.T) {}func TestHooks(t *testing.T) {- azure, _ := catalog.Get("azure_openai")- u, q := azure.Endpoint(catalog.EndpointRequest{+ azure, _ := modelruntime.Get("azure_openai")+ u, q := azure.Endpoint(providers.EndpointRequest{BaseURL: "https://my-res.openai.azure.com/",Model: "gpt-4o deploy",ModelType: types.ModelTypeKnowledgeQA,- Extra: map[string]string{catalog.ExtraAPIVersion: "2025-01-01-preview"},+ Extra: map[string]string{models.ExtraAPIVersion: "2025-01-01-preview"},})if u != "https://my-res.openai.azure.com/openai/deployments/gpt-4o%20deploy/chat/completions" {t.Errorf("azure endpoint = %q", u)@@ -366,20 +368,20 @@ func TestHooks(t *testing.T) {// Without an explicit api_version the hook emits the v1 GA data plane,// which carries the deployment name in the body and takes no// api-version at all.- u, q = azure.Endpoint(catalog.EndpointRequest{BaseURL: "https://x.openai.azure.com", Model: "d"})+ u, q = azure.Endpoint(providers.EndpointRequest{BaseURL: "https://x.openai.azure.com", Model: "d"})if u != "https://x.openai.azure.com/openai/v1/chat/completions" {t.Errorf("azure v1 endpoint = %q", u)}if len(q) != 0 {t.Errorf("azure v1 query = %v, want none", q)}- if azure.Auth != catalog.AuthAPIKeyHeader {+ if azure.Auth != providers.AuthAPIKeyHeader {t.Errorf("azure auth = %q", azure.Auth)}// Embedding obeys the same rule as chat for the same stored row, so one// Azure resource never ends up serving chat on v1 and embedding on the// dated deployments path. internal/models/embedding calls this hook.- u, q = azure.Endpoint(catalog.EndpointRequest{+ u, q = azure.Endpoint(providers.EndpointRequest{BaseURL: "https://x.openai.azure.com", Model: "embed-deploy",ModelType: types.ModelTypeEmbedding,})@@ -389,10 +391,10 @@ func TestHooks(t *testing.T) {if len(q) != 0 {t.Errorf("azure v1 embedding query = %v, want none", q)}- u, q = azure.Endpoint(catalog.EndpointRequest{+ u, q = azure.Endpoint(providers.EndpointRequest{BaseURL: "https://x.openai.azure.com", Model: "embed-deploy",ModelType: types.ModelTypeEmbedding,- Extra: map[string]string{catalog.ExtraAPIVersion: "2024-10-21"},+ Extra: map[string]string{models.ExtraAPIVersion: "2024-10-21"},})if u != "https://x.openai.azure.com/openai/deployments/embed-deploy/embeddings" {t.Errorf("azure legacy embedding endpoint = %q", u)@@ -401,34 +403,34 @@ func TestHooks(t *testing.T) {t.Errorf("azure legacy embedding api-version = %q", q["api-version"])}- wk, _ := catalog.Get("weknoracloud")- u, _ = wk.Endpoint(catalog.EndpointRequest{+ wk, _ := modelruntime.Get("weknoracloud")+ u, _ = wk.Endpoint(providers.EndpointRequest{BaseURL: "https://weknora.weixin.qq.com/", ModelType: types.ModelTypeKnowledgeQA,})if u != "https://weknora.weixin.qq.com/api/v1/chat/completions" {t.Errorf("weknoracloud endpoint = %q", u)}- if wk.Auth != catalog.AuthSigned || wk.Signer == nil {+ if wk.Auth != providers.AuthSigned || wk.Signer == nil {t.Error("weknoracloud should use a signer")}- if err := wk.ValidateConfig(&catalog.Config{}); err != nil {+ if err := wk.ValidateConfig(&providers.Config{}); err != nil {t.Errorf("weknoracloud validate should pass without key: %v", err)}- generic, _ := catalog.Get("generic")- if err := generic.ValidateConfig(&catalog.Config{ModelName: "m"}); err == nil {+ generic, _ := modelruntime.Get("generic")+ if err := generic.ValidateConfig(&providers.Config{ModelName: "m"}); err == nil {t.Error("generic validate should require a base URL")}- if err := generic.ValidateConfig(&catalog.Config{BaseURL: "http://x/v1", ModelName: "m"}); err != nil {+ if err := generic.ValidateConfig(&providers.Config{BaseURL: "http://x/v1", ModelName: "m"}); err != nil {t.Errorf("generic validate: %v", err)}- gpustack, _ := catalog.Get("gpustack")- if err := gpustack.ValidateConfig(&catalog.Config{APIKey: "k", ModelName: "m"}); err == nil {+ gpustack, _ := modelruntime.Get("gpustack")+ if err := gpustack.ValidateConfig(&providers.Config{APIKey: "k", ModelName: "m"}); err == nil {t.Error("gpustack validate should require a base URL")}for _, id := range []string{"volcengine", "lkeap"} {- v, _ := catalog.Get(id)+ v, _ := modelruntime.Get(id)found := falsefor _, f := range v.ExtraFields {if f.Key == "secret_key" {@@ -454,7 +456,7 @@ func TestSignedRerankCredentialLabels(t *testing.T) {{"volcengine", "Access Key ID"},} {t.Run(tc.vendor, func(t *testing.T) {- v, ok := catalog.Get(tc.vendor)+ v, ok := modelruntime.Get(tc.vendor)if !ok {t.Fatalf("vendor %s is not registered", tc.vendor)}diff --git a/internal/models/vendors/qianfan/vendor.go b/internal/models/providers/qianfan.gosimilarity index 76%rename from internal/models/vendors/qianfan/vendor.gorename to internal/models/providers/qianfan.goindex 0e0aad576..1d1a52375 100644--- a/internal/models/vendors/qianfan/vendor.go+++ b/internal/models/providers/qianfan.go@@ -1,4 +1,4 @@-// Package qianfan registers Baidu AI Cloud Qianfan through its+// Package providers registers Baidu AI Cloud Qianfan through its// OpenAI-compatible v2 endpoint.//// Facts (v2 text generation reference@@ -53,46 +53,42 @@// - Qianfan also exposes a Responses API// (https://cloud.baidu.com/doc/qianfan-docs/s/4mi400l1m); this vendor// stays on Chat Completions, which is what the model pages document.-package qianfan+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/qianfan.svg+var qianfanIcon []byte-//go:embed icon.svg-var icon []byte+// QianfanID is the provider identifier stored on model rows.+const QianfanID = "qianfan"-// ID is the provider identifier stored on model rows.-const ID = "qianfan"+// QianfanBaseURL is the OpenAI-compatible v2 endpoint for every model type.+const QianfanBaseURL = "https://qianfan.baidubce.com/v2"-// BaseURL is the OpenAI-compatible v2 endpoint for every model type.-const BaseURL = "https://qianfan.baidubce.com/v2"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newQianfanProvider() *Definition {+ return &Definition{+ ID: QianfanID,Name: "Baidu Qianfan",Names: map[string]string{"zh-CN": "百度千帆 Baidu Cloud"},Description: "ernie-5.0-thinking-preview, ernie-4.5-turbo-128k, embedding-v1, bce-reranker-base, etc.",Website: "https://console.bce.baidu.com/qianfan",- Icon: icon,+ Icon: qianfanIcon,API: api.APIOpenAICompletions,Order: 20,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"qianfan.baidubce.com", "baidubce.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: QianfanBaseURL,+ types.ModelTypeEmbedding: QianfanBaseURL,+ types.ModelTypeRerank: QianfanBaseURL,+ types.ModelTypeVLLM: QianfanBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -100,31 +96,30 @@ func init() {types.ModelTypeRerank,types.ModelTypeVLLM,},- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn: model,// input, user, encoding_format ("当前只支持float"). The model list// (https://cloud.baidu.com/doc/qianfan/s/rmh4stp0j) caps a request// at 16 texts; tao-8k takes one.- SendEncodingFormat: catalog.Ptr(true),- MaxBatchSize: catalog.Ptr(16),+ SendEncodingFormat: api.Ptr(true),+ MaxBatchSize: api.Ptr(16),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// "文本数量不超过64"; query "长度不超过1600个字符"; each document// "长度不超过4096个字符".- MaxDocuments: catalog.Ptr(64),- MaxQueryChars: catalog.Ptr(1600),- MaxDocumentChars: catalog.Ptr(4096),+ MaxDocuments: api.Ptr(64),+ MaxQueryChars: api.Ptr(1600),+ MaxDocumentChars: api.Ptr(4096),},- OpenAICompletions: catalog.OpenAICompletionsCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{// Both spellings are accepted; max_completion_tokens is the// one that also covers the thinking chain.- MaxTokensField: catalog.Ptr("max_completion_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),- ThinkingBudgetField: catalog.Ptr("thinking_budget"),- PromptCacheAccounting: catalog.Ptr(true),+ MaxTokensField: api.Ptr("max_completion_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),+ ThinkingBudgetField: api.Ptr("thinking_budget"),+ PromptCacheAccounting: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/qiniu/vendor.go b/internal/models/providers/qiniu.gosimilarity index 80%rename from internal/models/vendors/qiniu/vendor.gorename to internal/models/providers/qiniu.goindex 98fd5dbee..4674736c2 100644--- a/internal/models/vendors/qiniu/vendor.go+++ b/internal/models/providers/qiniu.go@@ -1,4 +1,4 @@-// Package qiniu registers Qiniu Cloud's AI token gateway.+// Package providers registers Qiniu Cloud's AI token gateway.//// Facts (parameter reference// https://developer.qiniu.com/aitokenapi/13390/chat-completions, endpoint@@ -49,55 +49,50 @@// returned only a subset of the ids below. No retirement notice was found// for any of them, so every entry is kept; models.dev lists no prices for// this gateway, so cost is omitted.-package qiniu+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/qiniu.svg+var qiniuIcon []byte-//go:embed icon.svg-var icon []byte+// QiniuID is the provider identifier stored on model rows.+const QiniuID = "qiniu"-// ID is the provider identifier stored on model rows.-const ID = "qiniu"+// QiniuBaseURL is the OpenAI-compatible chat endpoint.+const QiniuBaseURL = "https://api.qnaigc.com/v1"-// BaseURL is the OpenAI-compatible chat endpoint.-const BaseURL = "https://api.qnaigc.com/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newQiniuProvider() *Definition {+ return &Definition{+ ID: QiniuID,Name: "Qiniu Cloud",Names: map[string]string{"zh-CN": "七牛云 Qiniu"},Description: "deepseek/deepseek-v3.2-251201, z-ai/glm-4.7, qwen3.5-397b-a17b, etc.",Website: "https://portal.qiniu.com/ai-inference",- Icon: icon,+ Icon: qiniuIcon,API: api.APIOpenAICompletions,Order: 21,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,// api.modelink.ai is the gateway's documented international host.URLPatterns: []string{"qiniuapi.com", "qiniu", "qnaigc.com", "modelink.ai"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,+ types.ModelTypeKnowledgeQA: QiniuBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,},- Compat: catalog.VendorCompat{- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- SupportsReasoningEffort: catalog.Ptr(true),+ Compat: VendorCompat{+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ SupportsReasoningEffort: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/requesty/vendor.go b/internal/models/providers/requesty.gosimilarity index 74%rename from internal/models/vendors/requesty/vendor.gorename to internal/models/providers/requesty.goindex 74be132d9..36a8f0671 100644--- a/internal/models/vendors/requesty/vendor.go+++ b/internal/models/providers/requesty.go@@ -1,4 +1,4 @@-// Package requesty registers the Requesty router.+// Package providers registers the Requesty router.//// Facts (https://docs.requesty.ai/features/reasoning and// https://docs.requesty.ai/frameworks/openai):@@ -33,45 +33,41 @@// 3.6;// - GET /v1/models is chat-only; embedding models live at// /v1/models/embedding, which the docs do not mention.-package requesty+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/requesty.svg+var requestyIcon []byte-//go:embed icon.svg-var icon []byte+// RequestyID is the provider identifier stored on model rows.+const RequestyID = "requesty"-// ID is the provider identifier stored on model rows.-const ID = "requesty"+// RequestyBaseURL is the OpenAI-compatible router endpoint.+const RequestyBaseURL = "https://router.requesty.ai/v1"-// BaseURL is the OpenAI-compatible router endpoint.-const BaseURL = "https://router.requesty.ai/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newRequestyProvider() *Definition {+ return &Definition{+ ID: RequestyID,Name: "Requesty",Names: map[string]string{"zh-CN": "Requesty"},Description: "openai/gpt-5.5, anthropic/claude-opus-5, google/gemini-3.1-pro-preview, zai/glm-5.2, etc.",Website: "https://requesty.ai",- Icon: icon,+ Icon: requestyIcon,API: api.APIOpenAICompletions,Order: 42,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"router.requesty.ai", "requesty.ai"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: RequestyBaseURL,+ types.ModelTypeEmbedding: RequestyBaseURL,+ types.ModelTypeVLLM: RequestyBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -79,27 +75,27 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create:// OpenAI-compatible multipart, json by default, verbose_json// available. "The maximum upload size per request is 32 MB."- MaxFileBytes: catalog.Ptr(32 << 20),+ MaxFileBytes: api.Ptr(32 << 20),// "flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm"; language// is an ISO 639-1 form field.Formats: []string{"flac", "mp3", "mp4", "mpeg", "mpga", "m4a", "ogg", "wav", "webm"},- LanguageParam: catalog.Ptr(catalog.LanguageForm),+ LanguageParam: api.Ptr(api.LanguageForm),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://docs.requesty.ai/api-reference/endpoint/embeddings-create:// model, input, encoding_format, dimensions.- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatOpenAI),- SupportsReasoningEffort: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatOpenAI),+ SupportsReasoningEffort: api.Ptr(true),},},// Requesty spells the weakest rung "min" and accepts the whole@@ -110,6 +106,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("xhigh"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/siliconflow/vendor.go b/internal/models/providers/siliconflow.gosimilarity index 67%rename from internal/models/vendors/siliconflow/vendor.gorename to internal/models/providers/siliconflow.goindex 1421d5d72..4d036f5df 100644--- a/internal/models/vendors/siliconflow/vendor.go+++ b/internal/models/providers/siliconflow.go@@ -1,4 +1,4 @@-// Package siliconflow registers SiliconFlow (SiliconCloud), an+// Package providers registers SiliconFlow (SiliconCloud), an// OpenAI-compatible gateway to open-weight models.//// Facts (https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions):@@ -27,47 +27,43 @@// from the SiliconCloud model pages, and the per-model context windows,// output caps and prices in models.json are not restated in the API// reference.-package siliconflow+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/siliconflow.svg+var siliconflowIcon []byte-//go:embed icon.svg-var icon []byte+// SiliconflowID is the provider identifier stored on model rows.+const SiliconflowID = "siliconflow"-// ID is the provider identifier stored on model rows.-const ID = "siliconflow"+// SiliconflowBaseURL serves every model type.+const SiliconflowBaseURL = "https://api.siliconflow.cn/v1"-// BaseURL serves every model type.-const BaseURL = "https://api.siliconflow.cn/v1"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newSiliconflowProvider() *Definition {+ return &Definition{+ ID: SiliconflowID,Name: "SiliconFlow",Names: map[string]string{"zh-CN": "硅基流动 SiliconFlow"},Description: "deepseek-ai/DeepSeek-V4-Pro, zai-org/GLM-5.2, Qwen/Qwen3.5-397B-A17B, BAAI/bge-m3, etc.",Website: "https://cloud.siliconflow.cn",- Icon: icon,+ Icon: siliconflowIcon,API: api.APIOpenAICompletions,Order: 14,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"siliconflow.cn"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,- types.ModelTypeASR: BaseURL,+ types.ModelTypeKnowledgeQA: SiliconflowBaseURL,+ types.ModelTypeEmbedding: SiliconflowBaseURL,+ types.ModelTypeRerank: SiliconflowBaseURL,+ types.ModelTypeVLLM: SiliconflowBaseURL,+ types.ModelTypeASR: SiliconflowBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -76,30 +72,29 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post:// file and model only — no response_format — and a file of// "时长不超过 1 小时,文件大小不超过 50MB".- MaxFileBytes: catalog.Ptr(50 << 20),+ MaxFileBytes: api.Ptr(50 << 20),},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://api-docs.siliconflow.cn/docs/api/embeddings-post: model,// input, encoding_format, and dimensions "仅 Qwen/Qwen3 系列支持"// — the bge-m3 entry turns it off. The input array schema says// "当前最大数组大小为 32" (maxItems 32).- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),- MaxBatchSize: catalog.Ptr(32),+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),+ MaxBatchSize: api.Ptr(32),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatEnableThinking),- ThinkingBudgetField: catalog.Ptr("thinking_budget"),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatEnableThinking),+ ThinkingBudgetField: api.Ptr("thinking_budget"),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/volcengine/vendor.go b/internal/models/providers/volcengine.gosimilarity index 81%rename from internal/models/vendors/volcengine/vendor.gorename to internal/models/providers/volcengine.goindex 783f928b8..ccbe18af2 100644--- a/internal/models/vendors/volcengine/vendor.go+++ b/internal/models/providers/volcengine.go@@ -1,4 +1,4 @@-// Package volcengine registers Volcengine Ark (Doubao) through its+// Package providers registers Volcengine Ark (Doubao) through its// OpenAI-compatible chat endpoint.//// Facts (https://www.volcengine.com/docs/82379/1494384 = Chat API reference,@@ -72,64 +72,60 @@//// unverified: prices in models.json come from the Ark pricing console, which// the public docs do not render.-package volcengine+package providersimport (_ "embed""strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/volcengine.svg+var volcengineIcon []byte-//go:embed icon.svg-var icon []byte+// VolcengineID is the provider identifier stored on model rows.+const VolcengineID = "volcengine"-// ID is the provider identifier stored on model rows.-const ID = "volcengine"+// VolcengineBaseURL is the OpenAI-compatible Ark chat endpoint.+const VolcengineBaseURL = "https://ark.cn-beijing.volces.com/api/v3"-// BaseURL is the OpenAI-compatible Ark chat endpoint.-const BaseURL = "https://ark.cn-beijing.volces.com/api/v3"--// EmbeddingBaseURL is the Ark multimodal embedding endpoint.-const EmbeddingBaseURL = "https://ark.cn-beijing.volces.com/api/v3/embeddings/multimodal"+// VolcengineEmbeddingBaseURL is the Ark multimodal embedding endpoint.+const VolcengineEmbeddingBaseURL = "https://ark.cn-beijing.volces.com/api/v3/embeddings/multimodal"const (- multimodalEmbeddingPath = "/api/v3/embeddings/multimodal"- textEmbeddingPath = "/api/v3/embeddings"+ volcengineMultimodalEmbeddingPath = "/api/v3/embeddings/multimodal"+ volcengineTextEmbeddingPath = "/api/v3/embeddings")-// RerankBaseURL is the Knowledge Base managed rerank endpoint.-const RerankBaseURL = "https://api-knowledgebase.mlp.cn-beijing.volces.com"+// VolcengineRerankBaseURL is the Knowledge Base managed rerank endpoint.+const VolcengineRerankBaseURL = "https://api-knowledgebase.mlp.cn-beijing.volces.com"-// AnthropicBaseURL is the documented Anthropic Messages surface. It is not+// VolcengineAnthropicBaseURL is the documented Anthropic Messages surface. It is not// the default for this vendor; operators who want it configure it explicitly.-const AnthropicBaseURL = "https://ark.cn-beijing.volces.com/api/compatible/v1"+const VolcengineAnthropicBaseURL = "https://ark.cn-beijing.volces.com/api/compatible/v1"-func init() {+func newVolcengineProvider() *Definition {rerankOnly := []types.ModelType{types.ModelTypeRerank}- catalog.Register(&catalog.Vendor{- ID: ID,+ return &Definition{+ ID: VolcengineID,Name: "Volcengine Ark",Names: map[string]string{"zh-CN": "火山引擎 Volcengine"},Description: "doubao-seed-2-1-pro-260628, deepseek-v4-pro-ga-260813, " +"doubao-embedding-vision-250615, doubao-seed-rerank, etc.",Website: "https://console.volcengine.com/ark",- Icon: icon,+ Icon: volcengineIcon,API: api.APIOpenAICompletions,Order: 12,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"volces.com", "volcengine"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: EmbeddingBaseURL,- types.ModelTypeRerank: RerankBaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: VolcengineBaseURL,+ types.ModelTypeEmbedding: VolcengineEmbeddingBaseURL,+ types.ModelTypeRerank: VolcengineRerankBaseURL,+ types.ModelTypeVLLM: VolcengineBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -139,7 +135,7 @@ func init() {},// Rerank is signed with an IAM access-key pair, so the first// credential is an Access Key ID rather than an Ark bearer token.- CredentialLabels: []catalog.CredentialLabel{{+ CredentialLabels: []CredentialLabel{{Label: "Access Key ID",Labels: map[string]string{"zh-CN": "Access Key ID(AK/SK 签名)"},Placeholder: "Volcengine IAM access key id (AKLT...)",@@ -149,7 +145,7 @@ func init() {ModelTypes: rerankOnly,Required: true,}},- ExtraFields: []catalog.ExtraField{+ ExtraFields: []ExtraField{{Key: "secret_key",Label: "Secret Key",@@ -191,7 +187,7 @@ func init() {// multimodal URL that was the default, .../api/v3 like chat, and the// bare host. All of them name the same service, so the request is// placed from the host.- Endpoint: func(r catalog.EndpointRequest) (string, map[string]string) {+ Endpoint: func(r EndpointRequest) (string, map[string]string) {if r.ModelType != types.ModelTypeEmbedding {return "", nil}@@ -202,11 +198,11 @@ func init() {if r.EmbeddingAPI == api.EmbeddingOpenAI {// The retired doubao-embedding text models, whose archived// reference still names this endpoint.- return root + textEmbeddingPath, nil+ return root + volcengineTextEmbeddingPath, nil}- return root + multimodalEmbeddingPath, nil+ return root + volcengineMultimodalEmbeddingPath, nil},- Compat: catalog.VendorCompat{+ Compat: VendorCompat{// https://docs.volcengine.com/docs/ark/multimodal-vectorization-api:// the only embedding API Ark still lists. It fuses everything in// one request into a single vector, so a request carries one text.@@ -215,23 +211,23 @@ func init() {// curl sends it. `instructions` is documented too and deliberately// not declared: like Jina's task it changes the document vectors// (Tencent/WeKnora#1401).- Embeddings: catalog.EmbeddingsCompat{- SendEncodingFormat: catalog.Ptr(true),- DimensionsField: catalog.Ptr("dimensions"),- MaxBatchSize: catalog.Ptr(1),+ Embeddings: api.EmbeddingsCompat{+ SendEncodingFormat: api.Ptr(true),+ DimensionsField: api.Ptr("dimensions"),+ MaxBatchSize: api.Ptr(1),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// datas "数组长度不超过 200"// (https://docs.volcengine.com/docs/vector_database_vikingdb/Rerank).// The pre-catalog client split at 50, a constant of its own// rather than a documented ceiling.- MaxDocuments: catalog.Ptr(200),- MaxConcurrency: catalog.Ptr(4),+ MaxDocuments: api.Ptr(200),+ MaxConcurrency: api.Ptr(4),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),},},// Ark accepts all seven effort rungs on every model that supports the@@ -245,6 +241,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("xhigh"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/vendors/weknoracloud/vendor.go b/internal/models/providers/weknoracloud.gosimilarity index 73%rename from internal/models/vendors/weknoracloud/vendor.gorename to internal/models/providers/weknoracloud.goindex 9488ea3f5..46c64eaea 100644--- a/internal/models/vendors/weknoracloud/vendor.go+++ b/internal/models/providers/weknoracloud.go@@ -1,4 +1,4 @@-// Package weknoracloud registers the WeKnora managed model service.+// Package providers registers the WeKnora managed model service.//// unverified: this is a first-party endpoint with no published API// reference — https://weknora.weixin.qq.com/docs documents the WeKnora@@ -35,53 +35,48 @@//// unverified: PromptCacheAccounting is kept false; the gateway is not// documented to report prompt-cache counters, and none have been observed.-package weknoracloud+package providersimport (_ "embed""net/http""strings"- "github.com/google/uuid"-"github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"modelutils "github.com/Tencent/WeKnora/internal/models/utils""github.com/Tencent/WeKnora/internal/types"+ "github.com/google/uuid")-//go:embed models.json-var modelsJSON []byte--//go:embed icon.svg-var icon []byte+//go:embed assets/weknoracloud.svg+var weKnoraCloudIcon []byte-// ID is the provider identifier stored on model rows.-const ID = "weknoracloud"+// WeKnoraCloudID is the provider identifier stored on model rows.+const WeKnoraCloudID = "weknoracloud"-// BaseURL is the single service entry point; per-capability paths are+// WeKnoraCloudBaseURL is the single service entry point; per-capability paths are// appended by the Endpoint hook and the embedding / rerank clients.-const BaseURL = "https://weknora.weixin.qq.com"+const WeKnoraCloudBaseURL = "https://weknora.weixin.qq.com"-func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newWeKnoraCloudProvider() *Definition {+ return &Definition{+ ID: WeKnoraCloudID,Name: "WeKnora Cloud",Names: map[string]string{"zh-CN": "WeKnora 云服务"},Description: "WeKnora managed models: chat, embedding, rerank, vlm",Descriptions: map[string]string{"zh-CN": "WeKnora云服务,模型:chat, embedding, rerank, vlm"},- Website: BaseURL,- Icon: icon,+ Website: WeKnoraCloudBaseURL,+ Icon: weKnoraCloudIcon,API: api.APIOpenAICompletions,Order: 1,RequiresAuth: true,- Auth: catalog.AuthSigned,+ Auth: AuthSigned,URLPatterns: []string{"weknora.weixin.qq.com"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: BaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: WeKnoraCloudBaseURL,+ types.ModelTypeEmbedding: WeKnoraCloudBaseURL,+ types.ModelTypeRerank: WeKnoraCloudBaseURL,+ types.ModelTypeVLLM: WeKnoraCloudBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -89,27 +84,27 @@ func init() {types.ModelTypeRerank,types.ModelTypeVLLM,},- Compat: catalog.VendorCompat{- Embeddings: catalog.EmbeddingsCompat{+ Compat: VendorCompat{+ Embeddings: api.EmbeddingsCompat{// The OpenAI body on the service's own path, signed like the// rest of it.- Path: catalog.Ptr("/api/v1/embeddings"),- DimensionsField: catalog.Ptr("dimensions"),- RequestTimeout: catalog.Ptr(60),+ Path: api.Ptr("/api/v1/embeddings"),+ DimensionsField: api.Ptr("dimensions"),+ RequestTimeout: api.Ptr(60),},- Rerank: catalog.RerankCompat{- Path: catalog.Ptr("/api/v1/rerank"),+ Rerank: api.RerankCompat{+ Path: api.Ptr("/api/v1/rerank"),// The only rerank vendor that has ever had a client deadline// here. Without it a hung endpoint holds the retrieval stage// for as long as the caller's context allows.- RequestTimeout: catalog.Ptr(60),+ RequestTimeout: api.Ptr(60),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- SupportsMultiContent: catalog.Ptr(false),- PromptCacheAccounting: catalog.Ptr(false),+ OpenAICompletions: api.OpenAICompletionsCompat{+ SupportsMultiContent: api.Ptr(false),+ PromptCacheAccounting: api.Ptr(false),},},- Signer: func(creds catalog.Credentials) api.AuthFunc {+ Signer: func(creds api.Credentials) api.AuthFunc {return func(req *http.Request, body []byte) {headers := modelutils.Sign(creds.AppID, creds.AppSecret, uuid.NewString(), string(body))for k, v := range headers {@@ -117,7 +112,7 @@ func init() {}}},- Endpoint: func(r catalog.EndpointRequest) (string, map[string]string) {+ Endpoint: func(r EndpointRequest) (string, map[string]string) {switch r.ModelType {case types.ModelTypeEmbedding, types.ModelTypeRerank, types.ModelTypeASR:// Those clients build their own paths; fall back.@@ -127,7 +122,6 @@ func init() {},// AppID / AppSecret are written by the dedicated initialization// endpoint; only structural checks happen there.- Validate: func(_ *catalog.Config) error { return nil },- Models: catalog.MustParseModels(modelsJSON),- })+ Validate: func(_ *Config) error { return nil },+ }}diff --git a/internal/models/vendors/zhipu/vendor.go b/internal/models/providers/zhipu.gosimilarity index 75%rename from internal/models/vendors/zhipu/vendor.gorename to internal/models/providers/zhipu.goindex 3b4e5d69b..01cd84e19 100644--- a/internal/models/vendors/zhipu/vendor.go+++ b/internal/models/providers/zhipu.go@@ -1,4 +1,4 @@-// Package zhipu registers Zhipu AI's BigModel open platform.+// Package providers registers Zhipu AI's BigModel open platform.//// Facts (https://docs.bigmodel.cn/api-reference/模型-api/对话补全):// - chat completions live at POST /paas/v4/chat/completions under@@ -51,56 +51,52 @@// unverified: context windows, max output tokens and prices of individual// entries beyond the GLM-5 / 5.2 / 5.3 / 4.7 model pages, and the// glm-4.7-flash zero price.-package zhipu+package providersimport (_ "embed""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/Tencent/WeKnora/internal/types")-//go:embed models.json-var modelsJSON []byte+//go:embed assets/zhipu.svg+var zhipuIcon []byte-//go:embed icon.svg-var icon []byte+// ZhipuID is the provider identifier stored on model rows.+const ZhipuID = "zhipu"-// ID is the provider identifier stored on model rows.-const ID = "zhipu"+// ZhipuBaseURL is the OpenAI-compatible chat / embedding endpoint.+const ZhipuBaseURL = "https://open.bigmodel.cn/api/paas/v4"-// BaseURL is the OpenAI-compatible chat / embedding endpoint.-const BaseURL = "https://open.bigmodel.cn/api/paas/v4"+// ZhipuRerankBaseURL is the rerank endpoint.+const ZhipuRerankBaseURL = "https://open.bigmodel.cn/api/paas/v4/rerank"-// RerankBaseURL is the rerank endpoint.-const RerankBaseURL = "https://open.bigmodel.cn/api/paas/v4/rerank"+// ZhipuAnthropicBaseURL is the Anthropic Messages compatibility facade.+const ZhipuAnthropicBaseURL = "https://open.bigmodel.cn/api/anthropic"-// AnthropicBaseURL is the Anthropic Messages compatibility facade.-const AnthropicBaseURL = "https://open.bigmodel.cn/api/anthropic"--func init() {- catalog.Register(&catalog.Vendor{- ID: ID,+func newZhipuProvider() *Definition {+ return &Definition{+ ID: ZhipuID,Name: "Zhipu BigModel",Names: map[string]string{"zh-CN": "智谱 BigModel"},Description: "glm-5.3, glm-5.2, glm-4.7, embedding-3, rerank; " +- "Anthropic-compatible facade at " + AnthropicBaseURL,+ "Anthropic-compatible facade at " + ZhipuAnthropicBaseURL,Descriptions: map[string]string{- "zh-CN": "glm-5.3, glm-5.2, glm-4.7, embedding-3, rerank;Anthropic 兼容接口 " + AnthropicBaseURL,+ "zh-CN": "glm-5.3, glm-5.2, glm-4.7, embedding-3, rerank;Anthropic 兼容接口 " + ZhipuAnthropicBaseURL,},Website: "https://open.bigmodel.cn",- Icon: icon,+ Icon: zhipuIcon,API: api.APIOpenAICompletions,Order: 11,RequiresAuth: true,- Auth: catalog.AuthBearer,+ Auth: AuthBearer,URLPatterns: []string{"open.bigmodel.cn", "zhipu"},DefaultBaseURLs: map[types.ModelType]string{- types.ModelTypeKnowledgeQA: BaseURL,- types.ModelTypeEmbedding: BaseURL,- types.ModelTypeRerank: RerankBaseURL,- types.ModelTypeVLLM: BaseURL,+ types.ModelTypeKnowledgeQA: ZhipuBaseURL,+ types.ModelTypeEmbedding: ZhipuBaseURL,+ types.ModelTypeRerank: ZhipuRerankBaseURL,+ types.ModelTypeVLLM: ZhipuBaseURL,},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA,@@ -109,37 +105,37 @@ func init() {types.ModelTypeVLLM,types.ModelTypeASR,},- Compat: catalog.VendorCompat{- Transcriptions: catalog.TranscriptionsCompat{+ Compat: VendorCompat{+ Transcriptions: api.TranscriptionsCompat{// https://docs.bigmodel.cn/api-reference/模型-api/语音转文本:// POST {base}/audio/transcriptions, multipart file + model// (glm-asr-2512), answering {text}. The file is ".wav / .mp3",// at most 25 MB and 30 seconds — the duration cannot be checked// here without decoding, so a longer file is the vendor's error.- MaxFileBytes: catalog.Ptr(25 << 20),+ MaxFileBytes: api.Ptr(25 << 20),// No language field; prompt and hotwords are its only hints.Formats: []string{"wav", "mp3"},},- Embeddings: catalog.EmbeddingsCompat{+ Embeddings: api.EmbeddingsCompat{// https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入: model,// input, dimensions — no encoding_format. embedding-2 is fixed at// 1024 and its entry turns dimensions off; embedding-3 takes at// most 64 inputs per request.- DimensionsField: catalog.Ptr("dimensions"),+ DimensionsField: api.Ptr("dimensions"),},- Rerank: catalog.RerankCompat{+ Rerank: api.RerankCompat{// The reference gives 最大长度为 4096 字符 for the query and for each// document, and caps documents at 128 per request.- SendReturnDocs: catalog.Ptr(true),- MaxDocuments: catalog.Ptr(128),- MaxQueryChars: catalog.Ptr(4096),- MaxDocumentChars: catalog.Ptr(4096),+ SendReturnDocs: api.Ptr(true),+ MaxDocuments: api.Ptr(128),+ MaxQueryChars: api.Ptr(4096),+ MaxDocumentChars: api.Ptr(4096),},- OpenAICompletions: catalog.OpenAICompletionsCompat{- MaxTokensField: catalog.Ptr("max_tokens"),- ThinkingFormat: catalog.Ptr(catalog.ThinkingFormatThinkingType),- SupportsReasoningEffort: catalog.Ptr(true),- PromptCacheAccounting: catalog.Ptr(true),+ OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ SupportsReasoningEffort: api.Ptr(true),+ PromptCacheAccounting: api.Ptr(true),// "默认 auto 且仅支持 auto": none / required / named function// are rejected.ToolChoiceModes: []string{"auto"},@@ -154,6 +150,5 @@ func init() {api.ReasoningXHigh: api.StringPtr("xhigh"),api.ReasoningMax: api.StringPtr("max"),},- Models: catalog.MustParseModels(modelsJSON),- })+ }}diff --git a/internal/models/rerank/catalog_matrix_test.go b/internal/models/rerank/catalog_matrix_test.gonew file mode 100644index 000000000..799d59034--- /dev/null+++ b/internal/models/rerank/catalog_matrix_test.go@@ -0,0 +1,89 @@+package rerank++import (+ "context"+ "net/url"+ "strings"+ "testing"++ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++func TestEveryCatalogRerankTransport(t *testing.T) {+ for _, v := range modelruntime.List() {+ for _, m := range v.Models() {+ if m.Type != types.ModelTypeRerank {+ continue+ }+ names := append([]string{m.ID}, m.Aliases...)+ if m.ID == "" {+ names[0] = strings.ReplaceAll(m.Match, "*", "snapshot")+ }+ for _, name := range names {+ t.Run(v.ID+"/"+name, func(t *testing.T) {+ u := newUpstream(t)+ base, err := url.Parse(v.GetDefaultURL(types.ModelTypeRerank))+ require.NoError(t, err)+ cfg := &RerankerConfig{+ Source: types.ModelSourceRemote,+ Provider: v.ID,+ ModelName: name,+ ModelID: "row-id",+ BaseURL: u.url + base.Path,+ APIKey: "row-key",+ AppID: "app",+ AppSecret: "secret",+ }+ client, err := newReranker(cfg)+ if strings.Contains(string(m.Compat), "unsupported_reason") {+ require.ErrorContains(t, err, "does not serve")+ require.Empty(t, u.requests)+ return+ }+ require.NoError(t, err)+ result, err := client.Rerank(context.Background(), "q", []string{"a", "中文"})+ require.NoError(t, err)+ require.Len(t, result, 2)+ require.NotEmpty(t, u.requests)+ })+ }+ }+ }+}++func TestStoredRerankSpecReachesWire(t *testing.T) {+ u := newUpstream(t)+ row := &types.Model{+ ID: "stable-id",+ Name: "custom",+ Source: types.ModelSourceRemote,+ Parameters: types.ModelParameters{+ Provider: "generic",+ BaseURL: u.url,+ APIKey: "model-key",+ Spec: &types.ModelSpecOverride{+ Compat: map[string]any{+ "path": "/custom-rerank",+ "send_top_n": true,+ "extra_body": map[string]any{+ "custom_flag": true,+ },+ },+ },+ },+ }+ client, err := newReranker(ConfigFromModel(row, "", ""))+ require.NoError(t, err)+ _, err = client.Rerank(context.Background(), "q", []string{"a", "bb"})+ require.NoError(t, err)+ require.Len(t, u.requests, 1)+ req := u.requests[0]+ require.Equal(t, "/custom-rerank", req.path)+ require.Equal(t, true, req.body["custom_flag"])+ require.Equal(t, float64(2), req.body["top_n"])+ row.Parameters.Spec.Compat = map[string]any{"misspelled_option": true}+ _, err = newReranker(ConfigFromModel(row, "", ""))+ require.ErrorContains(t, err, "unknown field")+}diff --git a/internal/models/rerank/lkeap_reranker.go b/internal/models/rerank/lkeap_reranker.goindex e17adfb70..1b714717d 100644--- a/internal/models/rerank/lkeap_reranker.go+++ b/internal/models/rerank/lkeap_reranker.go@@ -1,107 +1,36 @@package rerankimport (- "context"- "fmt""strings""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"- lkeap "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lkeap/v20240522"+ "github.com/Tencent/WeKnora/internal/models/api/tencentlkeap"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime")+// Tencent action defaults retained for existing callers.const (- // LKEAPRerankEndpoint 腾讯云知识引擎原子能力 Rerank API 域名- LKEAPRerankEndpoint = "lkeap.tencentcloudapi.com"- // LKEAPDefaultRegion RunRerank 支持的地域,默认广州- LKEAPDefaultRegion = "ap-guangzhou"- // LKEAPDefaultRerankModel 默认 rerank 模型名- LKEAPDefaultRerankModel = "lke-reranker-base"+ LKEAPRerankEndpoint = tencentlkeap.LKEAPRerankEndpoint+ LKEAPDefaultRegion = tencentlkeap.LKEAPDefaultRegion+ LKEAPDefaultRerankModel = tencentlkeap.LKEAPDefaultRerankModel)-// lkeapEndpoint and lkeapScheme are where the SDK sends RunRerank: the public-// API host, as it has always been, whatever the row's base URL says. They are-// variables only so a test can point the SDK at a local server.-var (- lkeapEndpoint = LKEAPRerankEndpoint- lkeapScheme = "HTTPS"-)--// lkeapClient calls Tencent Cloud's RunRerank action through the official-// SDK, which owns the TC3 signing this API requires. It implements-// api.Reranker and nothing else: the per-request ceilings (60 documents,-// 2000 characters for Query plus Docs together) are declared on the vendor-// and enforced by protocolReranker, like every other vendor's.-type lkeapClient struct {- modelName string- client *lkeap.Client-}--func newLKEAPClient(config *RerankerConfig, resolved *catalog.Resolved) (api.Reranker, error) {- secretID := strings.TrimSpace(config.APIKey)- secretKey := strings.TrimSpace(config.AppSecret)- if secretKey == "" && config.ExtraConfig != nil {- secretKey = strings.TrimSpace(config.ExtraConfig["secret_key"])- }- if secretID == "" || secretKey == "" {- return nil, fmt.Errorf("secret_id and secret_key are required for LKEAP rerank (set API Key and Secret Key)")- }-- region := LKEAPDefaultRegion- if config.ExtraConfig != nil {- if r := strings.TrimSpace(config.ExtraConfig["region"]); r != "" {- region = r- }- }-- credential := common.NewCredential(secretID, secretKey)- cpf := profile.NewClientProfile()- cpf.HttpProfile.Endpoint = lkeapEndpoint- cpf.HttpProfile.Scheme = lkeapScheme-- client, err := lkeap.NewClient(credential, region, cpf)- if err != nil {- return nil, fmt.Errorf("create LKEAP client: %w", err)- }-- modelName := strings.TrimSpace(resolved.RemoteModel)- if modelName == "" {- modelName = LKEAPDefaultRerankModel- }- return &lkeapClient{modelName: modelName, client: client}, nil-}--// Rerank scores one batch. RunRerank answers a bare score list in input-// order rather than an indexed, sorted result set.-func (r *lkeapClient) Rerank(- ctx context.Context, query string, documents []string,-) ([]api.RerankResult, error) {- req := lkeap.NewRunRerankRequest()- req.Query = common.StringPtr(query)- req.Docs = common.StringPtrs(documents)- req.Model = common.StringPtr(r.modelName)-- resp, err := r.client.RunRerankWithContext(ctx, req)- if err != nil {- return nil, fmt.Errorf("LKEAP RunRerank: %w", err)- }- if resp == nil || resp.Response == nil || len(resp.Response.ScoreList) == 0 {- return nil, fmt.Errorf("LKEAP rerank API returned empty score list")- }- scores := resp.Response.ScoreList- if len(scores) != len(documents) {- return nil, fmt.Errorf("LKEAP rerank score count mismatch: got %d scores for %d documents",- len(scores), len(documents))- }-- results := make([]api.RerankResult, len(documents))- for i, score := range scores {- results[i] = api.RerankResult{Index: i, Text: documents[i]}- if score != nil {- results[i].Score = *score- }- }- return results, nil+// Test composition may route the action SDK to a local stand-in.+var lkeapEndpoint, lkeapScheme = LKEAPRerankEndpoint, "HTTPS"++func newLKEAPClient(config *RerankerConfig, resolved *modelruntime.Resolved) (api.Reranker, error) {+ secret := strings.TrimSpace(config.AppSecret)+ if secret == "" {+ secret = config.ExtraConfig["secret_key"]+ }+ return tencentlkeap.New(+ tencentlkeap.Config{+ SecretID: config.APIKey,+ SecretKey: secret,+ Region: config.ExtraConfig["region"],+ Model: resolved.RemoteModel,+ Endpoint: lkeapEndpoint,+ Scheme: lkeapScheme,+ },+ )}diff --git a/internal/models/rerank/protocol.go b/internal/models/rerank/protocol.goindex 63d580b54..2ed81da30 100644--- a/internal/models/rerank/protocol.go+++ b/internal/models/rerank/protocol.go@@ -9,7 +9,6 @@ import ("github.com/Tencent/WeKnora/internal/logger""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""golang.org/x/sync/errgroup")@@ -19,7 +18,7 @@ import (// ceilings, and putting the returned scores on one scale.type protocolReranker struct {inner api.Reranker- settings catalog.RerankSettings+ settings api.RerankSettingsendpoint stringmodelName stringmodelID stringdiff --git a/internal/models/rerank/protocol_test.go b/internal/models/rerank/protocol_test.goindex 621256a9b..b9c545164 100644--- a/internal/models/rerank/protocol_test.go+++ b/internal/models/rerank/protocol_test.go@@ -9,7 +9,6 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog""github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -38,7 +37,7 @@ func (f *fakeProtocol) Rerank(return out, nil}-func newWrapped(inner api.Reranker, settings catalog.RerankSettings) *protocolReranker {+func newWrapped(inner api.Reranker, settings api.RerankSettings) *protocolReranker {return &protocolReranker{inner: inner, settings: settings,endpoint: "https://example.invalid", modelName: "m", modelID: "id",@@ -50,7 +49,7 @@ func newWrapped(inner api.Reranker, settings catalog.RerankSettings) *protocolRe// original slice, not into the batch.func TestBatchingSplitsAndRestoresGlobalIndices(t *testing.T) {fake := &fakeProtocol{}- r := newWrapped(fake, catalog.RerankSettings{MaxDocuments: 2, MaxConcurrency: 1})+ r := newWrapped(fake, api.RerankSettings{MaxDocuments: 2, MaxConcurrency: 1})docs := []string{"d0", "d1", "d2", "d3", "d4"}got, err := r.Rerank(context.Background(), "q", docs)@@ -67,7 +66,7 @@ func TestBatchingSplitsAndRestoresGlobalIndices(t *testing.T) {func TestBatchingIsSkippedWhenTheVendorDeclaresNoLimit(t *testing.T) {fake := &fakeProtocol{}- r := newWrapped(fake, catalog.RerankSettings{})+ r := newWrapped(fake, api.RerankSettings{})_, err := r.Rerank(context.Background(), "q", []string{"a", "b", "c", "d"})require.NoError(t, err)@@ -78,7 +77,7 @@ func TestBatchingIsSkippedWhenTheVendorDeclaresNoLimit(t *testing.T) {// so beats sending a prefix and returning a number for text nobody asked// about.func TestAnOversizedDocumentIsAnError(t *testing.T) {- r := newWrapped(&fakeProtocol{}, catalog.RerankSettings{MaxDocumentChars: 10})+ r := newWrapped(&fakeProtocol{}, api.RerankSettings{MaxDocumentChars: 10})_, err := r.Rerank(context.Background(), "q", []string{"ok", strings.Repeat("x", 99)})require.Error(t, err)@@ -86,7 +85,7 @@ func TestAnOversizedDocumentIsAnError(t *testing.T) {}func TestBatchErrorsPropagate(t *testing.T) {- r := newWrapped(&fakeProtocol{err: fmt.Errorf("upstream exploded")}, catalog.RerankSettings{})+ r := newWrapped(&fakeProtocol{err: fmt.Errorf("upstream exploded")}, api.RerankSettings{})_, err := r.Rerank(context.Background(), "q", []string{"a"})require.Error(t, err)@@ -95,7 +94,7 @@ func TestBatchErrorsPropagate(t *testing.T) {func TestEmptyInputMakesNoRequest(t *testing.T) {fake := &fakeProtocol{}- r := newWrapped(fake, catalog.RerankSettings{})+ r := newWrapped(fake, api.RerankSettings{})got, err := r.Rerank(context.Background(), "q", nil)require.NoError(t, err)@@ -142,7 +141,7 @@ func TestProbabilityScoresPassThroughUntouched(t *testing.T) {// so the query is checked on its own before any request goes out.func TestAnOversizedQueryIsAnError(t *testing.T) {fake := &fakeProtocol{}- r := newWrapped(fake, catalog.RerankSettings{MaxQueryChars: 10})+ r := newWrapped(fake, api.RerankSettings{MaxQueryChars: 10})_, err := r.Rerank(context.Background(), strings.Repeat("q", 11), []string{"d"})require.Error(t, err)@@ -151,7 +150,7 @@ func TestAnOversizedQueryIsAnError(t *testing.T) {}func TestAQueryWithinTheLimitPasses(t *testing.T) {- r := newWrapped(&fakeProtocol{}, catalog.RerankSettings{MaxQueryChars: 10})+ r := newWrapped(&fakeProtocol{}, api.RerankSettings{MaxQueryChars: 10})_, err := r.Rerank(context.Background(), strings.Repeat("中", 10), []string{"d"})require.NoError(t, err, "runes, not bytes")}@@ -161,7 +160,7 @@ func TestAQueryWithinTheLimitPasses(t *testing.T) {// caller would see the best of the first batch only.func TestMergedBatchesAreRankedGlobally(t *testing.T) {// Scores are the position within the batch, so batch 2 holds the highest.- r := newWrapped(&fakeProtocol{}, catalog.RerankSettings{MaxDocuments: 2, MaxConcurrency: 1})+ r := newWrapped(&fakeProtocol{}, api.RerankSettings{MaxDocuments: 2, MaxConcurrency: 1})got, err := r.Rerank(context.Background(), "q", []string{"d0", "d1", "d2", "d3", "d4"})require.NoError(t, err)diff --git a/internal/models/rerank/provider_detection_test.go b/internal/models/rerank/provider_detection_test.goindex 0353d89ba..d223e880b 100644--- a/internal/models/rerank/provider_detection_test.go+++ b/internal/models/rerank/provider_detection_test.go@@ -3,13 +3,14 @@ package rerankimport ("testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime")// TestDetectByURLSeesVendorCatalog guards the blank import of-// internal/models/vendors in reranker.go.+// runtime composition.//-// catalog.DetectByURL returns "generic" for every URL while the catalog is+// modelruntime.DetectByURL returns "generic" for every URL while the catalog is// empty. Without the vendor packages linked in, a stored rerank row that// carries no provider id resolves to the generic Cohere client: LKEAP and// Volcengine lose their signed SDK clients and Aliyun its native protocol.@@ -20,10 +21,10 @@ func TestDetectByURLSeesVendorCatalog(t *testing.T) {"https://api.jina.ai/v1": "jina","https://open.bigmodel.cn/api/paas/v4": "zhipu","https://dashscope.aliyuncs.com/compatible-mode/v1": "aliyun",- "https://some-self-hosted-gateway.example.internal/v1": catalog.GenericID,+ "https://some-self-hosted-gateway.example.internal/v1": providers.GenericID,}for baseURL, want := range cases {- if got := catalog.DetectByURL(baseURL); got != want {+ if got := modelruntime.DetectByURL(baseURL); got != want {t.Errorf("DetectByURL(%q) = %q, want %q", baseURL, got, want)}}diff --git a/internal/models/rerank/reranker.go b/internal/models/rerank/reranker.goindex bc551dfbc..1e4f6d60d 100644--- a/internal/models/rerank/reranker.go+++ b/internal/models/rerank/reranker.go@@ -1,3 +1,4 @@+// Package rerank adapts rerank protocols to application batching and score semantics.package rerankimport (@@ -11,12 +12,12 @@ import ("github.com/Tencent/WeKnora/internal/models/api/cohererank""github.com/Tencent/WeKnora/internal/models/api/dashscoperank""github.com/Tencent/WeKnora/internal/models/api/nimrerank"- "github.com/Tencent/WeKnora/internal/models/catalog"- // catalog.Resolve answers from the vendor catalog, which is empty until+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"++ // modelruntime.Resolve answers from the vendor catalog, which is empty until// the vendor packages have run their init. Without this import every row// resolves to the generic vendor: LKEAP and Volcengine would lose their// signed clients and Aliyun its native protocol.- _ "github.com/Tencent/WeKnora/internal/models/vendors""github.com/Tencent/WeKnora/internal/types")@@ -94,7 +95,8 @@ type RerankerConfig struct {ModelName stringSource types.ModelSourceModelID string- Provider string // Provider identifier: openai, aliyun, zhipu, siliconflow, jina, generic+ Provider string // Provider identifier: openai, aliyun, zhipu, siliconflow, jina, generic+ Spec *types.ModelSpecOverride `json:"spec,omitempty"`ExtraConfig map[string]string// CustomHeaders 允许在调用远程 API 时附加自定义 HTTP 请求头(类似 OpenAI Python SDK 的 extra_headers)。CustomHeaders map[string]string@@ -116,6 +118,7 @@ func ConfigFromModel(m *types.Model, appID, appSecret string) *RerankerConfig {ModelName: m.Name,Source: m.Source,Provider: m.Parameters.Provider,+ Spec: m.Parameters.Spec,ExtraConfig: m.Parameters.ExtraConfig,CustomHeaders: m.Parameters.CustomHeaders,AppID: appID,@@ -143,12 +146,13 @@ func newReranker(config *RerankerConfig) (Reranker, error) {if config == nil {return nil, fmt.Errorf("rerank config is nil")}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: config.Provider,Model: config.ModelName,BaseURL: config.BaseURL,ModelType: types.ModelTypeRerank,Extra: config.ExtraConfig,+ Override: config.Spec,})if err != nil {return nil, err@@ -158,50 +162,15 @@ func newReranker(config *RerankerConfig) (Reranker, error) {}vendor := resolved.Vendor- creds := catalog.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret}- if creds.APIKey == "" {- creds.APIKey = vendor.DefaultAPIKey- }- // A signing vendor with no identity pair would otherwise send unsigned- // requests and fail at the far end, which is a worse error than this one.- if vendor.Auth == catalog.AuthSigned {- if creds.AppID == "" {- return nil, fmt.Errorf("%s rerank: AppID is required", vendor.Name)- }- if creds.AppSecret == "" {- return nil, fmt.Errorf("%s rerank: AppSecret is required", vendor.Name)- }- }- // Vendor headers first so a user header cannot silently replace a vendor- // beta flag, matching chat.NewRemoteChat.- headers := make(map[string]string, len(vendor.Headers)+len(config.CustomHeaders))- for k, v := range vendor.Headers {- headers[k] = v- }- for k, v := range config.CustomHeaders {- headers[k] = v- }- endpoint := api.Endpoint{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelID: config.ModelID,- Auth: vendor.AuthFunc(vendor.API, creds),- Headers: headers,- // Most vendors have always run without a client deadline here and let- // the caller's context govern; the ones that declare a timeout get it.- Client: newRerankHTTPClient(- time.Duration(resolved.Rerank.RequestTimeout) * time.Second,- ),- }- if vendor.Endpoint != nil {- if url, query := vendor.Endpoint(catalog.EndpointRequest{- BaseURL: resolved.BaseURL,- Model: resolved.RemoteModel,- ModelType: types.ModelTypeRerank,- Extra: config.ExtraConfig,- }); url != "" {- endpoint.URL, endpoint.Query = url, query- }+ endpoint, err := resolved.Endpoint(types.ModelTypeRerank, modelruntime.Connection{+ ModelID: config.ModelID,+ Credentials: api.Credentials{APIKey: config.APIKey, AppID: config.AppID, AppSecret: config.AppSecret},+ Headers: config.CustomHeaders,+ Extra: config.ExtraConfig,+ Client: newRerankHTTPClient(time.Duration(resolved.Rerank.RequestTimeout) * time.Second),+ })+ if err != nil {+ return nil, err}var client api.Rerankerdiff --git a/internal/models/rerank/sdk_clients_test.go b/internal/models/rerank/sdk_clients_test.goindex b8d8c1b3b..eb0bc8b4c 100644--- a/internal/models/rerank/sdk_clients_test.go+++ b/internal/models/rerank/sdk_clients_test.go@@ -5,10 +5,10 @@ import ("encoding/json""net/http""net/http/httptest"- "strings""testing"- "github.com/Tencent/WeKnora/internal/models/catalog"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+"github.com/stretchr/testify/assert""github.com/stretchr/testify/require")@@ -45,7 +45,7 @@ func TestVolcengineClientOutboundShape(t *testing.T) {client, err := newVolcengineClient(&RerankerConfig{APIKey: "AKLT-test", AppSecret: "secret-test"},- &catalog.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},+ &modelruntime.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},)require.NoError(t, err)@@ -80,7 +80,7 @@ func TestVolcengineClientSurfacesAnInBodyErrorCode(t *testing.T) {client, err := newVolcengineClient(&RerankerConfig{APIKey: "AKLT-test", AppSecret: "secret-test"},- &catalog.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},+ &modelruntime.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},)require.NoError(t, err)@@ -100,7 +100,7 @@ func TestVolcengineClientRejectsAScoreCountMismatch(t *testing.T) {client, err := newVolcengineClient(&RerankerConfig{APIKey: "AKLT-test", AppSecret: "secret-test"},- &catalog.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},+ &modelruntime.Resolved{BaseURL: server.URL, RemoteModel: "doubao-seed-rerank"},)require.NoError(t, err)@@ -114,7 +114,7 @@ func TestVolcengineClientRequiresAKAndSK(t *testing.T) {{AppSecret: "sk"},{APIKey: "ak"},} {- _, err := newVolcengineClient(cfg, &catalog.Resolved{BaseURL: "https://example.invalid"})+ _, err := newVolcengineClient(cfg, &modelruntime.Resolved{BaseURL: "https://example.invalid"})require.Error(t, err)assert.Contains(t, err.Error(), "access key and secret key are required")}@@ -125,7 +125,7 @@ func TestLKEAPClientRequiresCredentials(t *testing.T) {{AppSecret: "sk"},{APIKey: "id"},} {- _, err := newLKEAPClient(cfg, &catalog.Resolved{})+ _, err := newLKEAPClient(cfg, &modelruntime.Resolved{})require.Error(t, err)assert.Contains(t, err.Error(), "secret_id and secret_key are required")}@@ -136,20 +136,21 @@ func TestLKEAPClientRequiresCredentials(t *testing.T) {func TestLKEAPClientTakesTheSecretKeyFromExtraConfig(t *testing.T) {client, err := newLKEAPClient(&RerankerConfig{APIKey: "AKIDxxx", ExtraConfig: map[string]string{"secret_key": "sk"}},- &catalog.Resolved{RemoteModel: "lke-reranker-base"},+ &modelruntime.Resolved{RemoteModel: "lke-reranker-base"},)require.NoError(t, err)require.NotNil(t, client)}func TestLKEAPClientFallsBackToTheDefaultModel(t *testing.T) {+ upstream := newUpstream(t)client, err := newLKEAPClient(&RerankerConfig{APIKey: "AKIDxxx", AppSecret: "sk"},- &catalog.Resolved{},+ &modelruntime.Resolved{},)require.NoError(t, err)- inner, ok := client.(*lkeapClient)- require.True(t, ok)- assert.Equal(t, LKEAPDefaultRerankModel, inner.modelName)- assert.False(t, strings.Contains(inner.modelName, " "))+ _, err = client.Rerank(context.Background(), "q", []string{"d"})+ require.NoError(t, err)+ require.Len(t, upstream.requests, 1)+ assert.Equal(t, LKEAPDefaultRerankModel, upstream.requests[0].body["Model"])}diff --git a/internal/models/rerank/volcengine_reranker.go b/internal/models/rerank/volcengine_reranker.goindex 2401b716d..eb311ec38 100644--- a/internal/models/rerank/volcengine_reranker.go+++ b/internal/models/rerank/volcengine_reranker.go@@ -1,114 +1,36 @@package rerankimport (- "context"- "fmt""strings""time""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"- "github.com/volcengine/vikingdb-go-sdk/knowledge"- knowledgemodel "github.com/volcengine/vikingdb-go-sdk/knowledge/model"+ "github.com/Tencent/WeKnora/internal/models/api/volcengineknowledge"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime")const (- volcengineRerankDefaultModel = "doubao-seed-rerank"- volcengineRerankDefaultRegion = "cn-beijing"- // The console's default instruction, verbatim: "如需对齐控制台效果,请使用- // 相同指令" (https://docs.volcengine.com/docs/vector_database_vikingdb/Rerank).- volcengineRerankDefaultInstruction = "Whether the document answers the query " +- "or matches the content retrieval intent"+ volcengineRerankDefaultModel = volcengineknowledge.DefaultModel+ volcengineRerankDefaultRegion = volcengineknowledge.DefaultRegion+ volcengineRerankDefaultInstruction = volcengineknowledge.DefaultInstruction)-// volcengineClient calls the managed Knowledge Service rerank through the-// vikingdb SDK, which owns the AK/SK signing. It implements api.Reranker and-// nothing else: the 200-document ceiling and the batch concurrency are-// declared on the vendor and enforced by protocolReranker.-type volcengineClient struct {- modelName string- instruction string- client *knowledge.Client-}--func newVolcengineClient(config *RerankerConfig, resolved *catalog.Resolved) (api.Reranker, error) {- accessKey := strings.TrimSpace(config.APIKey)- secretKey := strings.TrimSpace(config.AppSecret)- if secretKey == "" && config.ExtraConfig != nil {- secretKey = strings.TrimSpace(config.ExtraConfig["secret_key"])- }- if accessKey == "" || secretKey == "" {- return nil, fmt.Errorf("access key and secret key are required for Volcengine rerank")- }-- // The catalog supplies the vendor's Knowledge Service host when the row- // names none.- baseURL := resolved.BaseURL-- modelName := strings.TrimSpace(resolved.RemoteModel)- if modelName == "" {- modelName = volcengineRerankDefaultModel- }- region := volcengineRerankDefaultRegion- instruction := volcengineRerankDefaultInstruction- if config.ExtraConfig != nil {- if value := strings.TrimSpace(config.ExtraConfig["region"]); value != "" {- region = value- }- if value := strings.TrimSpace(config.ExtraConfig["instruction"]); value != "" {- instruction = value- }- }-- client, err := knowledge.New(- knowledge.AuthIAM(accessKey, secretKey),- knowledge.WithEndpoint(baseURL),- knowledge.WithRegion(region),- knowledge.WithTimeout(30*time.Second),- knowledge.WithHTTPClient(newRerankHTTPClient(30*time.Second)),- knowledge.WithMaxRetries(1),+func newVolcengineClient(config *RerankerConfig, resolved *modelruntime.Resolved) (api.Reranker, error) {+ secret := strings.TrimSpace(config.AppSecret)+ if secret == "" {+ secret = config.ExtraConfig["secret_key"]+ }+ return volcengineknowledge.New(+ volcengineknowledge.Config{+ AccessKey: config.APIKey,+ SecretKey: secret,+ BaseURL: resolved.BaseURL,+ Model: resolved.RemoteModel,+ Region: config.ExtraConfig["region"],+ Instruction: config.ExtraConfig["instruction"],+ Client: newRerankHTTPClient(+ 30 * time.Second,+ ),+ },)- if err != nil {- return nil, fmt.Errorf("create Volcengine rerank client: %w", err)- }- return &volcengineClient{modelName: modelName, instruction: instruction, client: client}, nil-}--// Rerank scores one batch. Every document is paired with the same query and-// instruction, and the reply is a score list in input order.-func (r *volcengineClient) Rerank(- ctx context.Context, query string, documents []string,-) ([]api.RerankResult, error) {- data := make([]knowledgemodel.RerankDataItem, len(documents))- for i := range documents {- data[i] = knowledgemodel.RerankDataItem{Query: query, Content: &documents[i]}- }- request := knowledgemodel.RerankRequest{- Datas: data,- RerankModel: &r.modelName,- RerankInstruction: &r.instruction,- }-- response, err := r.client.Rerank(ctx, request)- if err != nil {- return nil, fmt.Errorf("call Volcengine rerank: %w", err)- }- if response == nil || response.Data == nil {- return nil, fmt.Errorf("Volcengine rerank returned an empty response")- }- if response.Code != 0 {- return nil, fmt.Errorf("Volcengine rerank API error %d: %s", response.Code, response.Message)- }- if len(response.Data.Scores) != len(documents) {- return nil, fmt.Errorf(- "Volcengine rerank score count mismatch: got %d scores for %d documents",- len(response.Data.Scores), len(documents),- )- }-- results := make([]api.RerankResult, len(documents))- for i, score := range response.Data.Scores {- results[i] = api.RerankResult{Index: i, Score: score, Text: documents[i]}- }- return results, nil}diff --git a/internal/models/rerank/wire_test.go b/internal/models/rerank/wire_test.goindex 600c96765..bb6b1ddd9 100644--- a/internal/models/rerank/wire_test.go+++ b/internal/models/rerank/wire_test.go@@ -13,7 +13,8 @@ import ("testing""unicode/utf8"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -210,7 +211,7 @@ func TestRerankWireFormatPerVendor(t *testing.T) {{name: "gpustack sends the row's truncation budget and answers logits", provider: "gpustack",model: "bge-reranker-v2-m3", base: "/v1",- extra: map[string]string{catalog.ExtraTruncatePromptTokens: "256"},+ extra: map[string]string{models.ExtraTruncatePromptTokens: "256"},cohereLogs: true,wantPath: "/v1/rerank", wantAuth: [2]string{"Authorization", "Bearer k"},wantBody: cohere("bge-reranker-v2-m3", three, map[string]any{"truncate_prompt_tokens": float64(256)}),@@ -351,7 +352,7 @@ func TestRerankWireFormatPerVendor(t *testing.T) {// OpenAI has no rerank API, so the vendor does not offer the type.func TestOpenAIDoesNotOfferRerank(t *testing.T) {- v, ok := catalog.Get("openai")+ v, ok := modelruntime.Get("openai")require.True(t, ok)assert.False(t, v.SupportsType(types.ModelTypeRerank))}diff --git a/internal/models/catalog/catalog_test.go b/internal/models/runtime/catalog_test.gosimilarity index 65%rename from internal/models/catalog/catalog_test.gorename to internal/models/runtime/catalog_test.goindex bfc675e8b..fcecaafa5 100644--- a/internal/models/catalog/catalog_test.go+++ b/internal/models/runtime/catalog_test.go@@ -1,10 +1,13 @@-package catalog+package runtime_testimport ("encoding/json""testing"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -12,16 +15,18 @@ import (func registerTestVendors(t *testing.T) {t.Helper()- t.Cleanup(reset())- Register(&Vendor{- ID: GenericID, Name: "Custom", API: api.APIOpenAICompletions,+ before := modelruntime.SnapshotCurrent()+ t.Cleanup(func() { modelruntime.RestoreSnapshot(before) })+ modelruntime.Register(&providers.Definition{+ ID: providers.GenericID, Name: "Custom", API: api.APIOpenAICompletions,DefaultBaseURLs: map[types.ModelType]string{},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA},- Compat: VendorCompat{OpenAICompletions: OpenAICompletionsCompat{- MaxTokensField: Ptr("max_tokens"), ThinkingFormat: Ptr(ThinkingFormatChatTemplateKwargs),+ Compat: providers.VendorCompat{OpenAICompletions: api.OpenAICompletionsCompat{+ MaxTokensField: api.Ptr("max_tokens"),+ ThinkingFormat: api.Ptr(api.ThinkingFormatChatTemplateKwargs),}},})- Register(&Vendor{+ modelruntime.Register(&providers.Definition{ID: "acme", Name: "Acme", Names: map[string]string{"zh-CN": "极目"},API: api.APIOpenAICompletions,RequiresAuth: true,@@ -31,29 +36,28 @@ func registerTestVendors(t *testing.T) {types.ModelTypeRerank: "https://api.acme.ai/rerank",},ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA, types.ModelTypeRerank},- Compat: VendorCompat{OpenAICompletions: OpenAICompletionsCompat{- ThinkingFormat: Ptr(ThinkingFormatThinkingType),- SupportsReasoningEffort: Ptr(true),- MaxTokensField: Ptr("max_tokens"),+ Compat: providers.VendorCompat{OpenAICompletions: api.OpenAICompletionsCompat{+ ThinkingFormat: api.Ptr(api.ThinkingFormatThinkingType),+ SupportsReasoningEffort: api.Ptr(true),+ MaxTokensField: api.Ptr("max_tokens"),}},ThinkingLevels: api.ThinkingLevelMap{api.ReasoningMax: api.StringPtr("max")},- Models: []ModelSpec{- {- ID: "acme-pro", Name: "Acme Pro", Reasoning: true,- Input: []string{"text", "image"}, ContextWindow: 200000,- Compat: json.RawMessage(`{"supports_temperature": false}`),- },- {ID: "acme-r1", Reasoning: true, ThinkingLevels: api.ThinkingLevelMap{api.ReasoningOff: nil}},- {Match: "acme-lite*", Reasoning: false, Compat: json.RawMessage(`{"thinking_format": "none"}`)},- {Match: "acme-lite-vision*", Input: []string{"text", "image"}},- {ID: "acme-embed", Type: types.ModelTypeEmbedding, Dimension: 1024},- {- ID: "acme-claude", API: api.APIAnthropicMessages, Reasoning: true,- Compat: json.RawMessage(`{"thinking_mode": "adaptive", "supports_effort": true}`),- },+ }, []models.ModelSpec{+ {+ ID: "acme-pro", Name: "Acme Pro", Reasoning: true,+ Input: []string{"text", "image"}, ContextWindow: 200000,+ Compat: json.RawMessage(`{"supports_temperature": false}`),},- })- Register(&Vendor{+ {ID: "acme-r1", Reasoning: true, ThinkingLevels: api.ThinkingLevelMap{api.ReasoningOff: nil}},+ {Match: "acme-lite*", Reasoning: false, Compat: json.RawMessage(`{"thinking_format": "none"}`)},+ {Match: "acme-lite-vision*", Input: []string{"text", "image"}},+ {ID: "acme-embed", Type: types.ModelTypeEmbedding, Dimension: 1024},+ {+ ID: "acme-claude", API: api.APIAnthropicMessages, Reasoning: true,+ Compat: json.RawMessage(`{"thinking_mode": "adaptive", "supports_effort": true}`),+ },+ }...)+ modelruntime.Register(&providers.Definition{ID: "tencent-lkeap", Name: "LKEAP", API: api.APIOpenAICompletions,URLPatterns: []string{"api.lkeap.cloud.tencent.com", "tencent"},DefaultBaseURLs: map[types.ModelType]string{@@ -65,7 +69,7 @@ func registerTestVendors(t *testing.T) {func TestFindModel_ExactAliasAndGlob(t *testing.T) {registerTestVendors(t)- v, _ := Get("acme")+ v, _ := modelruntime.Get("acme")chat := types.ModelTypeKnowledgeQAm, ok := v.FindModel("ACME-PRO", chat)@@ -88,7 +92,7 @@ func TestFindModel_ExactAliasAndGlob(t *testing.T) {// model that accepts images, so it sees the chat entries.func TestFindModel_IsTyped(t *testing.T) {registerTestVendors(t)- v, _ := Get("acme")+ v, _ := modelruntime.Get("acme")_, ok := v.FindModel("acme-embed", types.ModelTypeKnowledgeQA)assert.False(t, ok, "a chat row must not pick up an embedding entry")@@ -108,7 +112,13 @@ func TestFindModel_IsTyped(t *testing.T) {func TestResolve_ModelNameInsideAChatGlobStillResolvesForOtherTypes(t *testing.T) {registerTestVendors(t)for _, modelType := range []types.ModelType{types.ModelTypeEmbedding, types.ModelTypeRerank} {- r, err := Resolve(Ref{Provider: "acme", Model: "acme-lite-embed", ModelType: modelType})+ r, err := modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-lite-embed",+ ModelType: modelType,+ },+ )require.NoError(t, err, modelType)assert.False(t, r.Cataloged, modelType)}@@ -116,22 +126,22 @@ func TestResolve_ModelNameInsideAChatGlobStillResolvesForOtherTypes(t *testing.Tfunc TestDetectByURL_LongestPatternWins(t *testing.T) {registerTestVendors(t)- assert.Equal(t, "tencent-lkeap", DetectByURL("https://api.lkeap.cloud.tencent.com/v1"))- assert.Equal(t, "acme", DetectByURL("https://api.acme.ai/v1"))- assert.Equal(t, GenericID, DetectByURL("http://localhost:8000/v1"))- assert.Equal(t, GenericID, DetectByURL(""))+ assert.Equal(t, "tencent-lkeap", modelruntime.DetectByURL("https://api.lkeap.cloud.tencent.com/v1"))+ assert.Equal(t, "acme", modelruntime.DetectByURL("https://api.acme.ai/v1"))+ assert.Equal(t, providers.GenericID, modelruntime.DetectByURL("http://localhost:8000/v1"))+ assert.Equal(t, providers.GenericID, modelruntime.DetectByURL(""))}func TestResolve_MergesVendorModelAndOverrideLayers(t *testing.T) {registerTestVendors(t)- r, err := Resolve(Ref{Provider: "acme", Model: "acme-pro"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro"})require.NoError(t, err)assert.True(t, r.Cataloged)assert.Equal(t, api.APIOpenAICompletions, r.API)assert.Equal(t, "https://api.acme.ai/v1", r.BaseURL, "default base URL is filled in")assert.Equal(t, "max_tokens", r.OpenAICompletions.MaxTokensField)- assert.Equal(t, ThinkingFormatThinkingType, r.OpenAICompletions.ThinkingFormat)+ assert.Equal(t, api.ThinkingFormatThinkingType, r.OpenAICompletions.ThinkingFormat)assert.True(t, r.OpenAICompletions.SupportsReasoningEffort)assert.False(t, r.OpenAICompletions.SupportsTemperature, "model compat overrides the protocol default")assert.True(t, r.OpenAICompletions.SupportsUsageInStreaming, "untouched defaults survive")@@ -147,7 +157,7 @@ func TestResolve_MergesVendorModelAndOverrideLayers(t *testing.T) {// Row-level override wins over everything.on := true- r, err = Resolve(Ref{+ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro", BaseURL: "https://proxy.example.com/v1/",Override: &types.ModelSpecOverride{ContextWindow: 1000,@@ -167,18 +177,23 @@ func TestResolve_MergesVendorModelAndOverrideLayers(t *testing.T) {func TestResolve_UnknownModelAndVendorDegradeToGeneric(t *testing.T) {registerTestVendors(t)- r, err := Resolve(Ref{Provider: "acme", Model: "brand-new"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "brand-new"})require.NoError(t, err)assert.False(t, r.Cataloged)assert.Equal(t, "brand-new", r.Spec.ID)- assert.Equal(t, ThinkingFormatThinkingType, r.OpenAICompletions.ThinkingFormat, "vendor defaults still apply")-- r, err = Resolve(Ref{Provider: "nope", Model: "x", BaseURL: "http://localhost:8000/v1"})+ assert.Equal(+ t,+ api.ThinkingFormatThinkingType,+ r.OpenAICompletions.ThinkingFormat,+ "vendor defaults still apply",+ )++ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "nope", Model: "x", BaseURL: "http://localhost:8000/v1"})require.NoError(t, err)- assert.Equal(t, GenericID, r.Vendor.ID)- assert.Equal(t, ThinkingFormatChatTemplateKwargs, r.OpenAICompletions.ThinkingFormat)+ assert.Equal(t, providers.GenericID, r.Vendor.ID)+ assert.Equal(t, api.ThinkingFormatChatTemplateKwargs, r.OpenAICompletions.ThinkingFormat)- r, err = Resolve(Ref{Model: "x", BaseURL: "https://api.acme.ai/v1"})+ r, err = modelruntime.Resolve(modelruntime.Ref{Model: "x", BaseURL: "https://api.acme.ai/v1"})require.NoError(t, err)assert.Equal(t, "acme", r.Vendor.ID, "provider detected from URL when empty")}@@ -186,43 +201,73 @@ func TestResolve_UnknownModelAndVendorDegradeToGeneric(t *testing.T) {func TestResolve_ProtocolInference(t *testing.T) {registerTestVendors(t)- r, err := Resolve(Ref{Provider: "acme", Model: "acme-claude"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-claude"})require.NoError(t, err)assert.Equal(t, api.APIAnthropicMessages, r.API)- assert.Equal(t, AnthropicThinkingAdaptive, r.AnthropicMessages.ThinkingMode)+ assert.Equal(t, api.AnthropicThinkingAdaptive, r.AnthropicMessages.ThinkingMode)assert.True(t, r.AnthropicMessages.SupportsEffort)assert.Equal(t, "thinking.adaptive", r.Capabilities().ThinkingFormat)- r, err = Resolve(Ref{Provider: "acme", Model: "acme-pro", BaseURL: "https://api.acme.ai/anthropic"})+ r, err = modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-pro",+ BaseURL: "https://api.acme.ai/anthropic",+ },+ )require.NoError(t, err)assert.Equal(t, api.APIAnthropicMessages, r.API, "/anthropic suffix switches protocol")- r, err = Resolve(Ref{Provider: "acme", Model: "acme-pro", Extra: map[string]string{ExtraAPI: "openai-responses"}})+ r, err = modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-pro",+ Extra: map[string]string{+ models.ExtraAPI: "openai-responses",+ },+ },+ )require.NoError(t, err)assert.Equal(t, api.APIOpenAIResponses, r.API, "extra_config.api forces the protocol")- _, err = Resolve(Ref{Provider: "acme", Model: "acme-pro", Extra: map[string]string{ExtraAPI: "bogus"}})+ _, err = modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-pro",+ Extra: map[string]string{+ models.ExtraAPI: "bogus",+ },+ },+ )require.Error(t, err)}func TestResolve_LegacyThinkingControlAndRemoteModelName(t *testing.T) {registerTestVendors(t)- r, err := Resolve(Ref{Provider: "acme", Model: "acme-pro", Extra: map[string]string{- ExtraThinkingControl: "enable_thinking",- ExtraRemoteModelName: "acme-pro-2026",+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro", Extra: map[string]string{+ models.ExtraThinkingControl: "enable_thinking",+ models.ExtraRemoteModelName: "acme-pro-2026",}})require.NoError(t, err)- assert.Equal(t, ThinkingFormatEnableThinking, r.OpenAICompletions.ThinkingFormat)+ assert.Equal(t, api.ThinkingFormatEnableThinking, r.OpenAICompletions.ThinkingFormat)assert.Equal(t, "acme-pro-2026", r.RemoteModel)- r, err = Resolve(Ref{Provider: "acme", Model: "acme-pro", Extra: map[string]string{ExtraThinkingControl: "none"}})+ r, err = modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-pro",+ Extra: map[string]string{+ models.ExtraThinkingControl: "none",+ },+ },+ )require.NoError(t, err)assert.Empty(t, r.Capabilities().ThinkingLevels, "none disables the selector")}func TestResolve_AlwaysOnModelCannotBeSwitchedOff(t *testing.T) {registerTestVendors(t)- r, err := Resolve(Ref{Provider: "acme", Model: "acme-r1"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-r1"})require.NoError(t, err)assert.False(t, r.ThinkingLevels.Supports(api.ReasoningOff))assert.NotContains(t, r.Capabilities().ThinkingLevels, api.ReasoningOff)@@ -230,16 +275,22 @@ func TestResolve_AlwaysOnModelCannotBeSwitchedOff(t *testing.T) {func TestResolve_RejectsUnknownCompatKeys(t *testing.T) {registerTestVendors(t)- _, err := Resolve(Ref{Provider: "acme", Model: "acme-pro", Override: &types.ModelSpecOverride{- Compat: map[string]any{"max_token_field": "max_tokens"},- }})+ _, err := modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "acme",+ Model: "acme-pro",+ Override: &types.ModelSpecOverride{+ Compat: map[string]any{"max_token_field": "max_tokens"},+ },+ },+ )require.Error(t, err)assert.Contains(t, err.Error(), "max_token_field")}func TestModelsByType(t *testing.T) {registerTestVendors(t)- v, _ := Get("acme")+ v, _ := modelruntime.Get("acme")chat := v.ModelsByType(types.ModelTypeKnowledgeQA)ids := make([]string, 0, len(chat))for _, m := range chat {@@ -277,9 +328,9 @@ func TestApplyOverlay(t *testing.T) {}}}`- require.NoError(t, ApplyOverlay([]byte(overlay), t.TempDir()))+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlay), t.TempDir()))- acme, ok := Get("acme")+ acme, ok := modelruntime.Get("acme")require.True(t, ok)assert.Equal(t, "https://acme.internal/v1", acme.GetDefaultURL(types.ModelTypeKnowledgeQA))assert.Equal(t, "https://api.acme.ai/rerank", acme.GetDefaultURL(types.ModelTypeRerank), "other URLs untouched")@@ -288,30 +339,39 @@ func TestApplyOverlay(t *testing.T) {assert.Equal(t, "max", acme.ThinkingLevels.Value(api.ReasoningXHigh))assert.Equal(t, "max", acme.ThinkingLevels.Value(api.ReasoningMax), "existing levels kept")- r, err := Resolve(Ref{Provider: "acme", Model: "acme-ultra"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-ultra"})require.NoError(t, err)assert.True(t, r.Cataloged)assert.Equal(t, 400000, r.Spec.ContextWindow)- r, err = Resolve(Ref{Provider: "acme", Model: "acme-pro"})+ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro"})require.NoError(t, err)assert.Equal(t, 123, r.Spec.ContextWindow)assert.True(t, r.OpenAICompletions.SupportsTemperature, "model_overrides compat merges over the built-in compat")- lab, ok := Get("my-vllm")+ lab, ok := modelruntime.Get("my-vllm")require.True(t, ok)assert.Equal(t, "实验室 vLLM", lab.LocalizedName("zh-CN"))assert.Equal(t, "Lab vLLM", lab.LocalizedName("en-US"))assert.False(t, lab.RequiresAuth)- r, err = Resolve(Ref{Provider: "my-vllm", Model: "Qwen/Qwen3-32B"})+ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "my-vllm", Model: "Qwen/Qwen3-32B"})require.NoError(t, err)- assert.Equal(t, ThinkingFormatChatTemplateKwargs, r.OpenAICompletions.ThinkingFormat)+ assert.Equal(t, api.ThinkingFormatChatTemplateKwargs, r.OpenAICompletions.ThinkingFormat)assert.Equal(t, "max_tokens", r.OpenAICompletions.MaxTokensField)assert.True(t, r.Spec.Reasoning)assert.Equal(t, "http://vllm.lab:8000/v1", r.BaseURL)- assert.Error(t, ApplyOverlay([]byte(`{"providers": {"x": {"bogus": 1}}}`), t.TempDir()), "unknown keys rejected")- assert.Error(t, ApplyOverlay([]byte(`{"providers": {"x": {"api": "nope"}}}`), t.TempDir()))+ assert.Error(+ t,+ modelruntime.ApplyOverlay(+ []byte(+ `{"providers": {"x": {"bogus": 1}}}`,+ ),+ t.TempDir(),+ ),+ "unknown keys rejected",+ )+ assert.Error(t, modelruntime.ApplyOverlay([]byte(`{"providers": {"x": {"api": "nope"}}}`), t.TempDir()))}func TestThinkingLevelMap(t *testing.T) {diff --git a/internal/models/runtime/compat.go b/internal/models/runtime/compat.gonew file mode 100644index 000000000..9ad559b97--- /dev/null+++ b/internal/models/runtime/compat.go@@ -0,0 +1,73 @@+package runtime++import (+ "bytes"+ "encoding/json"+ "fmt"+ "reflect"++ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+)++// ApplyCompat writes the set fields of an overlay struct onto a settings struct+// with matching field names, dereferencing pointers. Slices and maps+// replace the default wholesale (no element merge) except map[string]any+// ExtraBody-style fields, which merge key by key.+func ApplyCompat(settings any, compat any) {+ sv := reflect.ValueOf(settings).Elem()+ cv := reflect.ValueOf(compat).Elem()+ ct := cv.Type()+ for i := 0; i < cv.NumField(); i++ {+ field := ct.Field(i)+ if !field.IsExported() {+ continue+ }+ target := sv.FieldByName(field.Name)+ if !target.IsValid() {+ panic(fmt.Sprintf("catalog: overlay field %s.%s has no settings counterpart", ct.Name(), field.Name))+ }+ f := cv.Field(i)+ switch f.Kind() {+ case reflect.Pointer:+ if f.IsNil() {+ continue+ }+ if target.Kind() == reflect.Pointer {+ target.Set(configcopy.Value(f))+ } else {+ target.Set(configcopy.Value(f.Elem()))+ }+ case reflect.Slice:+ if f.Len() > 0 {+ target.Set(configcopy.Value(f))+ }+ case reflect.Map:+ if f.Len() == 0 {+ continue+ }+ if target.IsNil() {+ target.Set(reflect.MakeMap(target.Type()))+ }+ iter := f.MapRange()+ for iter.Next() {+ target.SetMapIndex(iter.Key(), configcopy.Value(iter.Value()))+ }+ }+ }+}++// DecodeCompat unmarshals a flat compat object into the overlay type for an+// API. Unknown keys are rejected so typos in models.json surface early.+func DecodeCompat(raw json.RawMessage, into any) error {+ if len(raw) == 0 {+ return nil+ }+ dec := json.NewDecoder(bytesReader(raw))+ dec.DisallowUnknownFields()+ if err := dec.Decode(into); err != nil {+ return fmt.Errorf("decode compat: %w", err)+ }+ return nil+}++func bytesReader(b []byte) *bytes.Reader { return bytes.NewReader(b) }diff --git a/internal/models/runtime/connection.go b/internal/models/runtime/connection.gonew file mode 100644index 000000000..c55e2da71--- /dev/null+++ b/internal/models/runtime/connection.go@@ -0,0 +1,78 @@+package runtime++import (+ "fmt"+ "net/http"+ "strings"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/providers"+ "github.com/Tencent/WeKnora/internal/types"+)++// Connection contains only one configured model's credentials and transport+// settings. It is never cached in the provider registry or model catalog.+type Connection struct {+ ModelID string+ Credentials api.Credentials+ Headers map[string]string+ Extra map[string]string+ Client *http.Client+}++// Endpoint assembles authentication, headers and vendor endpoint routing for+// every capability. Protocol clients receive the result without knowing vendors.+func (r *Resolved) Endpoint(kind types.ModelType, c Connection) (api.Endpoint, error) {+ v := r.Vendor+ creds := c.Credentials+ if creds.APIKey == "" {+ creds.APIKey = v.DefaultAPIKey+ }+ protocol := v.API+ label := strings.ToLower(string(kind))+ if kind == types.ModelTypeKnowledgeQA || kind == types.ModelTypeVLLM {+ protocol, label = r.API, "provider"+ }+ if v.AuthStyleFor(protocol) == providers.AuthSigned {+ if creds.AppID == "" {+ return api.Endpoint{}, fmt.Errorf("%s %s: AppID is required", v.Name, label)+ }+ if creds.AppSecret == "" {+ return api.Endpoint{}, fmt.Errorf("%s %s: AppSecret is required", v.Name, label)+ }+ } else if v.RequiresAuth && protocol == api.APIAnthropicMessages &&+ (kind == types.ModelTypeKnowledgeQA || kind == types.ModelTypeVLLM) && strings.TrimSpace(creds.APIKey) == "" {+ return api.Endpoint{}, fmt.Errorf("%s provider: API key is required", v.Name)+ }+ headers := make(map[string]string, len(v.Headers)+len(c.Headers))+ for k, val := range v.Headers {+ headers[k] = val+ }+ for k, val := range c.Headers {+ headers[k] = val+ }+ ep := api.Endpoint{+ BaseURL: r.BaseURL, Model: r.RemoteModel, ModelID: c.ModelID,+ Auth: v.AuthFunc(protocol, creds), Headers: headers, Client: c.Client,+ }+ if v.Endpoint != nil {+ req := providers.EndpointRequest{+ BaseURL: r.BaseURL,+ Model: r.RemoteModel,+ ModelType: kind,+ API: protocol,+ Extra: c.Extra,+ }+ if kind == types.ModelTypeEmbedding {+ req.EmbeddingAPI = r.EmbeddingAPI+ }+ // Preserve historical rerank hook input; its routing uses ModelType.+ if kind == types.ModelTypeRerank {+ req.API = ""+ }+ if url, query := v.Endpoint(req); url != "" {+ ep.URL, ep.Query = url, query+ }+ }+ return ep, nil+}diff --git a/internal/models/runtime/icon_test.go b/internal/models/runtime/icon_test.gonew file mode 100644index 000000000..f1ee6974e--- /dev/null+++ b/internal/models/runtime/icon_test.go@@ -0,0 +1,26 @@+package runtime++import (+ "testing"++ "github.com/stretchr/testify/assert"+)++func TestLooksLikeSVG(t *testing.T) {+ for _, in := range []string{+ `<svg xmlns="http://www.w3.org/2000/svg"></svg>`,+ " \n<svg/>",+ "\ufeff<?xml version=\"1.0\"?>\n<!-- brand mark --><svg >x</svg>",+ "<?xml version=\"1.0\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"x.dtd\"><svg>y</svg>",+ "<SVG></SVG>",+ } {+ assert.True(t, looksLikeSVG([]byte(in)), "want SVG: %q", in)+ }+ for _, in := range []string{+ "", " ", "<svg", "<svgx>", "not markup at all",+ "<html><svg></svg></html>", "<?xml version=\"1.0\"?>", "<!-- unterminated",+ "root:x:0:0::/root:/bin/sh",+ } {+ assert.False(t, looksLikeSVG([]byte(in)), "want not SVG: %q", in)+ }+}diff --git a/internal/models/runtime/legacy.go b/internal/models/runtime/legacy.gonew file mode 100644index 000000000..5ecb00ae6--- /dev/null+++ b/internal/models/runtime/legacy.go@@ -0,0 +1,38 @@+package runtime++import (+ "strings"++ "github.com/Tencent/WeKnora/internal/models/api"+)++// inferAPIFromURL preserves protocol selection for legacy URLs.+func inferAPIFromURL(baseURL string, current api.API) api.API {+ lower := strings.ToLower(strings.TrimRight(baseURL, "/"))+ switch {+ case strings.HasSuffix(lower, "/anthropic") || strings.HasSuffix(lower, "/anthropic/v1"):+ return api.APIAnthropicMessages+ case current == api.APIGoogleGenerativeAI &&+ (strings.HasSuffix(lower, "/openai") || strings.Contains(lower, "/openai/")):+ return api.APIOpenAICompletions+ }+ return current+}++// applyLegacyThinkingControl maps the pre-catalog thinking_control value+// onto the new settings. Unknown non-empty values keep the historical+// fallback (chat_template_kwargs).+func applyLegacyThinkingControl(s *api.OpenAICompletionsSettings, value string) {+ switch strings.ToLower(strings.TrimSpace(value)) {+ case "":+ return+ case "none":+ s.ThinkingFormat = api.ThinkingFormatNone+ case "enable_thinking":+ s.ThinkingFormat = api.ThinkingFormatEnableThinking+ case "thinking_type":+ s.ThinkingFormat = api.ThinkingFormatThinkingType+ default:+ s.ThinkingFormat = api.ThinkingFormatChatTemplateKwargs+ }+}diff --git a/internal/models/catalog/legacy_rows_test.go b/internal/models/runtime/legacy_rows_test.gosimilarity index 90%rename from internal/models/catalog/legacy_rows_test.gorename to internal/models/runtime/legacy_rows_test.goindex f51f4cba9..102a8c137 100644--- a/internal/models/catalog/legacy_rows_test.go+++ b/internal/models/runtime/legacy_rows_test.go@@ -1,4 +1,4 @@-package catalog_test+package runtime_test// Backward-compatibility guard for model rows written before the vendor// catalog existed (internal/models/provider). Every shape in this file is one@@ -10,8 +10,8 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"- "github.com/Tencent/WeKnora/internal/models/catalog"- _ "github.com/Tencent/WeKnora/internal/models/vendors"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -32,7 +32,7 @@ var legacyProviderIDs = []string{// wrong thinking encoding).func TestLegacyProviderIDsStillRegistered(t *testing.T) {for _, id := range legacyProviderIDs {- if _, ok := catalog.Get(id); !ok {+ if _, ok := modelruntime.Get(id); !ok {t.Errorf("provider id %q was writable by the old code but has no vendor now", id)}}@@ -176,16 +176,16 @@ func legacyRows() []legacyRow {}// TestLegacyRowsValidateAndResolve is the core guarantee: opening an existing-// model in the UI and saving it (PUT /models/{id} runs catalog.ValidateRow)+// model in the UI and saving it (PUT /models/{id} runs modelruntime.ValidateRow)// must not 400, and the chat path must still resolve the row.func TestLegacyRowsValidateAndResolve(t *testing.T) {for _, row := range legacyRows() {t.Run(row.name, func(t *testing.T) {params := row.params- if err := catalog.ValidateRow(row.model, row.typ, ¶ms); err != nil {+ if err := modelruntime.ValidateRow(row.model, row.typ, ¶ms); err != nil {t.Fatalf("ValidateRow rejected a row the old code accepted: %v", err)}- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: params.Provider, Model: row.model, BaseURL: params.BaseURL,ModelType: row.typ, Extra: params.ExtraConfig, Override: params.Spec,})@@ -222,8 +222,8 @@ func TestLegacyRowsValidateAndResolve(t *testing.T) {// shipped model id — which is what the old model picker wrote — is known to// resolve.func TestEveryCataloguedModelResolves(t *testing.T) {- for _, v := range catalog.List() {- for _, m := range v.Models {+ for _, v := range modelruntime.List() {+ for _, m := range v.Models() {if m.ID == "" {continue}@@ -236,7 +236,7 @@ func TestEveryCataloguedModelResolves(t *testing.T) {if modelType == "" {modelType = types.ModelTypeKnowledgeQA}- if err := catalog.ValidateRow(m.ID, modelType, &types.ModelParameters{Provider: v.ID}); err != nil {+ if err := modelruntime.ValidateRow(m.ID, modelType, &types.ModelParameters{Provider: v.ID}); err != nil {t.Errorf("%s/%s: ValidateRow: %v", v.ID, m.ID, err)}}@@ -248,14 +248,14 @@ func TestEveryCataloguedModelResolves(t *testing.T) {// the only ones the old frontend wrote (frontend/src/utils/thinkingControl.ts),// but an unrecognized non-empty value historically fell back to// chat_template_kwargs and must keep doing so.-var legacyThinkingControl = map[string]catalog.ThinkingFormat{- "none": catalog.ThinkingFormatNone,- "enable_thinking": catalog.ThinkingFormatEnableThinking,- "thinking_type": catalog.ThinkingFormatThinkingType,- "chat_template_kwargs": catalog.ThinkingFormatChatTemplateKwargs,- "enabled": catalog.ThinkingFormatChatTemplateKwargs,- "ENABLE_THINKING": catalog.ThinkingFormatEnableThinking,- " thinking_type ": catalog.ThinkingFormatThinkingType,+var legacyThinkingControl = map[string]api.ThinkingFormat{+ "none": api.ThinkingFormatNone,+ "enable_thinking": api.ThinkingFormatEnableThinking,+ "thinking_type": api.ThinkingFormatThinkingType,+ "chat_template_kwargs": api.ThinkingFormatChatTemplateKwargs,+ "enabled": api.ThinkingFormatChatTemplateKwargs,+ "ENABLE_THINKING": api.ThinkingFormatEnableThinking,+ " thinking_type ": api.ThinkingFormatThinkingType,}// TestLegacyThinkingControlMapping pins extra_config.thinking_control to the@@ -265,7 +265,7 @@ var legacyThinkingControl = map[string]catalog.ThinkingFormat{func TestLegacyThinkingControlMapping(t *testing.T) {for value, want := range legacyThinkingControl {t.Run(value, func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: "generic", Model: "Qwen/Qwen3-32B",BaseURL: "http://vllm.internal:8000/v1", ModelType: types.ModelTypeKnowledgeQA,Extra: map[string]string{"thinking_control": value},@@ -285,14 +285,14 @@ func TestLegacyThinkingControlMapping(t *testing.T) {// an operator who explicitly picked an encoding must keep it even when the// catalog marks the model non-reasoning.func TestLegacyThinkingControlSurvivesCatalogSilencing(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: "openai", Model: "gpt-4o", ModelType: types.ModelTypeKnowledgeQA,Extra: map[string]string{"thinking_control": "chat_template_kwargs"},})if err != nil {t.Fatalf("Resolve: %v", err)}- if resolved.OpenAICompletions.ThinkingFormat != catalog.ThinkingFormatChatTemplateKwargs {+ if resolved.OpenAICompletions.ThinkingFormat != api.ThinkingFormatChatTemplateKwargs {t.Fatalf("explicit thinking_control was overridden by the catalog: %q",resolved.OpenAICompletions.ThinkingFormat)}@@ -303,7 +303,7 @@ func TestLegacyThinkingControlSurvivesCatalogSilencing(t *testing.T) {// self-hosted case) keeps its thinking switch, which is what old rows relied// on, while a catalogued non-reasoning model loses it.func TestUncataloguedModelKeepsThinkingSwitch(t *testing.T) {- unknown, err := catalog.Resolve(catalog.Ref{+ unknown, err := modelruntime.Resolve(modelruntime.Ref{Provider: "generic", Model: "acme/llama-3.1-70b-finetune",BaseURL: "http://vllm.internal:8000/v1", ModelType: types.ModelTypeKnowledgeQA,})@@ -313,7 +313,7 @@ func TestUncataloguedModelKeepsThinkingSwitch(t *testing.T) {if unknown.Cataloged {t.Fatal("expected the fine-tune to be uncatalogued")}- if unknown.OpenAICompletions.ThinkingFormat != catalog.ThinkingFormatChatTemplateKwargs {+ if unknown.OpenAICompletions.ThinkingFormat != api.ThinkingFormatChatTemplateKwargs {t.Fatalf("uncatalogued model lost its thinking switch: %q",unknown.OpenAICompletions.ThinkingFormat)}@@ -322,7 +322,7 @@ func TestUncataloguedModelKeepsThinkingSwitch(t *testing.T) {// TestLegacyRemoteModelNameHonoured pins extra_config.remote_model_name, which// the old chat and embedding paths both read.func TestLegacyRemoteModelNameHonoured(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: "generic", Model: "display-name", BaseURL: "http://vllm.internal:8000/v1",ModelType: types.ModelTypeKnowledgeQA,Extra: map[string]string{"remote_model_name": "Qwen/Qwen3-32B"},@@ -339,15 +339,15 @@ func TestLegacyRemoteModelNameHonoured(t *testing.T) {// naming a provider this build does not ship degrades to the generic// OpenAI-compatible baseline instead of failing the write.func TestUnknownProviderFallsBackToGeneric(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: "a-vendor-from-the-future", Model: "m",BaseURL: "https://example.com/v1", ModelType: types.ModelTypeKnowledgeQA,})if err != nil {t.Fatalf("Resolve: %v", err)}- if resolved.Vendor.ID != catalog.GenericID {- t.Fatalf("unknown provider resolved to %q, want %q", resolved.Vendor.ID, catalog.GenericID)+ if resolved.Vendor.ID != providers.GenericID {+ t.Fatalf("unknown provider resolved to %q, want %q", resolved.Vendor.ID, providers.GenericID)}if resolved.API != api.APIOpenAICompletions {t.Fatalf("unknown provider resolved to protocol %q", resolved.API)@@ -389,7 +389,7 @@ func TestLegacyStoredBaseURLSelectsSameProtocol(t *testing.T) {}for _, tc := range cases {t.Run(tc.provider+" "+tc.baseURL, func(t *testing.T) {- resolved, err := catalog.Resolve(catalog.Ref{+ resolved, err := modelruntime.Resolve(modelruntime.Ref{Provider: tc.provider, Model: "some-model", BaseURL: tc.baseURL,ModelType: types.ModelTypeKnowledgeQA,})@@ -420,7 +420,7 @@ func TestLegacyStoredBaseURLSelectsSameProtocol(t *testing.T) {// sharp, the fix is to ignore an unparseable extra_config.api in Resolve and// keep the strict check for Spec.API, which no old row can carry.func TestLegacyFreeFormAPIExtraKeyIsRejected(t *testing.T) {- err := catalog.ValidateRow("gpt-4o", types.ModelTypeKnowledgeQA, &types.ModelParameters{+ err := modelruntime.ValidateRow("gpt-4o", types.ModelTypeKnowledgeQA, &types.ModelParameters{Provider: "openai", BaseURL: "https://api.openai.com/v1",ExtraConfig: map[string]string{"api": "v1"},})diff --git a/internal/models/catalog/overlay.go b/internal/models/runtime/overlay.gosimilarity index 73%rename from internal/models/catalog/overlay.gorename to internal/models/runtime/overlay.goindex a222c5464..8d7d23273 100644--- a/internal/models/catalog/overlay.go+++ b/internal/models/runtime/overlay.go@@ -1,14 +1,19 @@-package catalog+package runtimeimport ("encoding/json""fmt"+ "io""os""path/filepath""regexp""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+ "github.com/Tencent/WeKnora/internal/models/providers""github.com/Tencent/WeKnora/internal/types")@@ -35,12 +40,12 @@ type OverlayProvider struct {BaseURLs map[string]string `json:"base_urls,omitempty"`// APIKey is the deployment-level key used when a model row stores none.// Supports ${ENV} / $ENV interpolation.- APIKey string `json:"api_key,omitempty"`- Headers map[string]string `json:"headers,omitempty"`- Auth AuthStyle `json:"auth,omitempty"`- RequiresAuth *bool `json:"requires_auth,omitempty"`- ModelTypes []string `json:"model_types,omitempty"`- URLPatterns []string `json:"url_patterns,omitempty"`+ APIKey string `json:"api_key,omitempty"`+ Headers map[string]string `json:"headers,omitempty"`+ Auth providers.AuthStyle `json:"auth,omitempty"`+ RequiresAuth *bool `json:"requires_auth,omitempty"`+ ModelTypes []string `json:"model_types,omitempty"`+ URLPatterns []string `json:"url_patterns,omitempty"`// Icon is a path to an SVG file (relative to the overlay file) or an// inline "<svg ...>" string.Icon string `json:"icon,omitempty"`@@ -56,7 +61,7 @@ type OverlayProvider struct {ModelOverrides map[string]ModelSpecPatch `json:"model_overrides,omitempty"`}-// ModelSpecPatch is a partial ModelSpec.+// ModelSpecPatch is a partial models.ModelSpec.type ModelSpecPatch struct {Name string `json:"name,omitempty"`API api.API `json:"api,omitempty"`@@ -64,7 +69,7 @@ type ModelSpecPatch struct {Input []string `json:"input,omitempty"`ContextWindow int `json:"context_window,omitempty"`MaxOutputTokens int `json:"max_output_tokens,omitempty"`- Cost *ModelCost `json:"cost,omitempty"`+ Cost *models.ModelCost `json:"cost,omitempty"`ThinkingLevels api.ThinkingLevelMap `json:"thinking_levels,omitempty"`Compat json.RawMessage `json:"compat,omitempty"`Aliases []string `json:"aliases,omitempty"`@@ -83,32 +88,14 @@ func interpolateEnv(s string) string {})}-var frontendTypes = map[string]types.ModelType{- "chat": types.ModelTypeKnowledgeQA,- "embedding": types.ModelTypeEmbedding,- "rerank": types.ModelTypeRerank,- "vlm": types.ModelTypeVLLM,- "vllm": types.ModelTypeVLLM,- "asr": types.ModelTypeASR,-}--// ParseModelType accepts both frontend ("chat") and backend ("KnowledgeQA")-// spellings.-func ParseModelType(s string) (types.ModelType, bool) {- if t, ok := frontendTypes[strings.ToLower(strings.TrimSpace(s))]; ok {- return t, true- }- switch types.ModelType(s) {- case types.ModelTypeKnowledgeQA, types.ModelTypeEmbedding, types.ModelTypeRerank,- types.ModelTypeVLLM, types.ModelTypeASR:- return types.ModelType(s), true- }- return "", false-}-// LoadOverlay reads config/models.json (or the path in MODELS_CONFIG) and// applies it to the registry. A missing file is not an error.-func LoadOverlay(configDir string) error {+func (rt *Runtime) LoadOverlay(configDir string) error {+ return rt.loadOverlayValidated(configDir, nil)+}++// loadOverlayValidated validates every candidate before publishing a generation.+func (rt *Runtime) loadOverlayValidated(configDir string, validate func(*Provider) error) error {path := os.Getenv("MODELS_CONFIG")if path == "" {path = filepath.Join(configDir, "models.json")@@ -120,54 +107,70 @@ func LoadOverlay(configDir string) error {}return fmt.Errorf("read %s: %w", path, err)}- return ApplyOverlay(data, filepath.Dir(path))+ return rt.applyOverlayValidated(data, filepath.Dir(path), validate)}// ApplyOverlay applies overlay JSON to the registry. baseDir resolves// relative icon paths.-func ApplyOverlay(data []byte, baseDir string) error {+func (rt *Runtime) ApplyOverlay(data []byte, baseDir string) error {+ return rt.applyOverlayValidated(data, baseDir, nil)+}++// applyOverlayValidated rebuilds the overlay and validates it transactionally.+// The validator must not access the live registry while the writer lock is held.+func (rt *Runtime) applyOverlayValidated(data []byte, baseDir string, validate func(*Provider) error) error {var file OverlayFiledec := json.NewDecoder(bytesReader(data))dec.DisallowUnknownFields()if err := dec.Decode(&file); err != nil {return fmt.Errorf("parse models overlay: %w", err)}+ if err := dec.Decode(new(any)); err != io.EOF {+ return fmt.Errorf("parse models overlay: expected a single JSON document")+ }+ // Build a fresh generation under the registry lock, then publish once.+ // A failure leaves both the current generation and built-in baseline intact.+ rt.mu.Lock()+ defer rt.mu.Unlock()+ next := cloneProviders(rt.builtins)for id, p := range file.Providers {id = strings.ToLower(strings.TrimSpace(id))if id == "" {- continue+ return fmt.Errorf("provider id is empty")}- vendor, exists := Get(id)+ vendor, exists := next[id]if !exists {- vendor = &Vendor{+ vendor = &Provider{Definition: &providers.Definition{ID: id,Name: id,API: api.APIOpenAICompletions,DefaultBaseURLs: map[types.ModelType]string{},- ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA},- RequiresAuth: true,- Auth: AuthBearer,- Order: 1000,- }- } else {- copied := *vendor- vendor = &copied- vendor.Models = append([]ModelSpec(nil), vendor.Models...)- urls := make(map[types.ModelType]string, len(vendor.DefaultBaseURLs))- for k, v := range vendor.DefaultBaseURLs {- urls[k] = v- }- vendor.DefaultBaseURLs = urls+ ModelTypes: []types.ModelType{+ types.ModelTypeKnowledgeQA,+ },+ RequiresAuth: true,+ Auth: providers.AuthBearer,+ Order: 1000,+ }, catalog: catalog.New(nil)}}if err := applyOverlayProvider(vendor, p, baseDir); err != nil {return fmt.Errorf("provider %s: %w", id, err)}- Register(vendor)+ normalizeProvider(vendor)+ if validate != nil {+ if err := validate(vendor); err != nil {+ return fmt.Errorf("provider %s: %w", id, err)+ }+ }+ next[id] = vendor}+ rt.providers = next+return nil}-func applyOverlayProvider(v *Vendor, p OverlayProvider, baseDir string) error {+func applyOverlayProvider(v *Provider, p OverlayProvider, baseDir string) error {+ entries := v.Models()if p.Name != "" {v.Name = p.Name}@@ -193,7 +196,7 @@ func applyOverlayProvider(v *Vendor, p OverlayProvider, baseDir string) error {v.DefaultBaseURLs[types.ModelTypeKnowledgeQA] = interpolateEnv(p.BaseURL)}for k, u := range p.BaseURLs {- t, ok := ParseModelType(k)+ t, ok := models.ParseModelType(k)if !ok {return fmt.Errorf("unknown model type %q in base_urls", k)}@@ -218,7 +221,7 @@ func applyOverlayProvider(v *Vendor, p OverlayProvider, baseDir string) error {if len(p.ModelTypes) > 0 {v.ModelTypes = v.ModelTypes[:0]for _, s := range p.ModelTypes {- t, ok := ParseModelType(s)+ t, ok := models.ParseModelType(s)if !ok {return fmt.Errorf("unknown model type %q", s)}@@ -239,13 +242,13 @@ func applyOverlayProvider(v *Vendor, p OverlayProvider, baseDir string) error {var err errorswitch v.API {case api.APIOpenAICompletions:- err = decodeCompat(p.Compat, &v.Compat.OpenAICompletions)+ err = DecodeCompat(p.Compat, &v.Compat.OpenAICompletions)case api.APIOpenAIResponses:- err = decodeCompat(p.Compat, &v.Compat.OpenAIResponses)+ err = DecodeCompat(p.Compat, &v.Compat.OpenAIResponses)case api.APIAnthropicMessages:- err = decodeCompat(p.Compat, &v.Compat.AnthropicMessages)+ err = DecodeCompat(p.Compat, &v.Compat.AnthropicMessages)case api.APIGoogleGenerativeAI:- err = decodeCompat(p.Compat, &v.Compat.GoogleGenerativeAI)+ err = DecodeCompat(p.Compat, &v.Compat.GoogleGenerativeAI)}if err != nil {return err@@ -262,29 +265,38 @@ func applyOverlayProvider(v *Vendor, p OverlayProvider, baseDir string) error {v.ThinkingLevels = levels}for _, raw := range p.Models {- if err := upsertOverlayModel(v, raw); err != nil {+ if err := upsertOverlayModel(&entries, raw); err != nil {return err}}for id, patch := range p.ModelOverrides {+ matches := 0+ for _, m := range entries {+ if strings.EqualFold(m.ID, id) {+ matches+++ }+ }+ if matches > 1 {+ return fmt.Errorf("model_overrides %s matches multiple types; use models with an explicit type", id)+ }found := false- for i := range v.Models {- if strings.EqualFold(v.Models[i].ID, id) {- // Clone first, for the same reason as upsertOverlayModel: the- // entry's slices are shared with the built-in definition.- spec := cloneModelSpec(v.Models[i])+ for i := range entries {+ if strings.EqualFold(entries[i].ID, id) {+ // Keep the candidate entry independent while applying the patch.+ spec := cloneModelSpec(entries[i])applyPatch(&spec, patch)- v.Models[i] = spec+ entries[i] = specfound = truebreak}}if !found {- spec := ModelSpec{ID: id}+ spec := models.ModelSpec{ID: id}applyPatch(&spec, patch)- v.Models = append(v.Models, spec)+ entries = append(entries, spec)}}+ v.catalog = catalog.New(entries)return nil}@@ -408,16 +420,18 @@ func skipPast(s, end string) string {// A new id creates a full entry. An id that already exists is *patched*, not// replaced: both config/models.json.example and the docs present `models` as// the way to restate a known model with corrected facts, and most fields of-// ModelSpec cannot tell "absent" from "zero" — Reasoning is a plain bool, so+// models.ModelSpec cannot tell "absent" from "zero" — Reasoning is a plain bool, so// an entry that only fixes context_window used to silently turn reasoning// off and drop thinking levels, compat and input along with it. Unmarshaling// the operator's JSON onto a copy of the stored entry leaves every key they// did not write exactly as it was.-func upsertOverlayModel(v *Vendor, raw json.RawMessage) error {+func upsertOverlayModel(target *[]models.ModelSpec, raw json.RawMessage) error {+ entries := *target+ defer func() { *target = entries }()// Decode strictly first: this is what rejects typos and wrong types, the// same guarantee the rest of the overlay gives. The value is used only// for the id, since the merge below re-reads the raw bytes.- var spec ModelSpec+ var spec models.ModelSpecdec := json.NewDecoder(bytesReader(raw))dec.DisallowUnknownFields()if err := dec.Decode(&spec); err != nil {@@ -426,41 +440,42 @@ func upsertOverlayModel(v *Vendor, raw json.RawMessage) error {if spec.ID == "" {return fmt.Errorf("model without id")}- for i := range v.Models {- if !strings.EqualFold(v.Models[i].ID, spec.ID) {+ if spec.Type == "" {+ matches := 0+ for _, m := range entries {+ if strings.EqualFold(m.ID, spec.ID) {+ matches+++ }+ }+ if matches > 1 {+ return fmt.Errorf("model %s matches multiple types; specify type", spec.ID)+ }+ }+ for i := range entries {+ if !strings.EqualFold(entries[i].ID, spec.ID) {continue}- // cloneModelSpec first: the vendor's Models slice was only shallow- // copied, so unmarshaling into the entry's slices/maps in place would- // write through to the built-in vendor's package-level definition.- merged := cloneModelSpec(v.Models[i])+ if spec.Type != "" && catalog.EntryType(entries[i].Type) != catalog.EntryType(spec.Type) {+ continue+ }+ // Decode into an owned entry so a failed patch never modifies the catalog.+ merged := cloneModelSpec(entries[i])if err := json.Unmarshal(raw, &merged); err != nil {return fmt.Errorf("model %s: %w", spec.ID, err)}- v.Models[i] = merged+ entries[i] = mergedreturn nil}- v.Models = append(v.Models, spec)+ entries = append(entries, spec)return nil}// cloneModelSpec deep-copies the reference-typed fields of a spec.-func cloneModelSpec(m ModelSpec) ModelSpec {- out := m- out.Input = append([]string(nil), m.Input...)- out.Aliases = append([]string(nil), m.Aliases...)- out.Compat = append(json.RawMessage(nil), m.Compat...)- if m.ThinkingLevels != nil {- levels := make(api.ThinkingLevelMap, len(m.ThinkingLevels))- for k, v := range m.ThinkingLevels {- levels[k] = v- }- out.ThinkingLevels = levels- }- return out+func cloneModelSpec(m models.ModelSpec) models.ModelSpec {+ return configcopy.Clone(m)}-func applyPatch(m *ModelSpec, p ModelSpecPatch) {+func applyPatch(m *models.ModelSpec, p ModelSpecPatch) {if p.Name != "" {m.Name = p.Name}@@ -520,30 +535,9 @@ func mergeRawObjects(a, b json.RawMessage) json.RawMessage {return out}-// ModelsFile is the schema of a vendor's embedded models.json.-type ModelsFile struct {- Vendor string `json:"vendor"`- Source string `json:"source,omitempty"`- Models []ModelSpec `json:"models"`-}+// ApplyOverlay and LoadOverlay retain the legacy unvalidated composition API.+// Application configuration uses Initialize/Reload, which validate before publication.+func ApplyOverlay(data []byte, baseDir string) error { return Default().ApplyOverlay(data, baseDir) }-// MustParseModels decodes an embedded models.json; vendors call it from-// package init, so a malformed file fails the build's tests immediately.-func MustParseModels(data []byte) []ModelSpec {- var file ModelsFile- dec := json.NewDecoder(bytesReader(data))- dec.DisallowUnknownFields()- if err := dec.Decode(&file); err != nil {- panic(fmt.Sprintf("catalog: invalid models.json: %v", err))- }- // The file-level source is the vendor's model documentation, and most- // entries omit their own because that page covers them. Pushing it down- // means every entry can answer "where is this documented" — the editor- // links to it from the model picker.- for i := range file.Models {- if file.Models[i].Source == "" {- file.Models[i].Source = file.Source- }- }- return file.Models-}+// LoadOverlay loads deployment JSON into the default runtime without resolution validation.+func LoadOverlay(configDir string) error { return Default().LoadOverlay(configDir) }diff --git a/internal/models/catalog/overlay_test.go b/internal/models/runtime/overlay_test.gosimilarity index 67%rename from internal/models/catalog/overlay_test.gorename to internal/models/runtime/overlay_test.goindex 8ebd8ddf8..f999d081a 100644--- a/internal/models/catalog/overlay_test.go+++ b/internal/models/runtime/overlay_test.go@@ -1,4 +1,4 @@-package catalog+package runtime_testimport ("os"@@ -7,6 +7,7 @@ import ("testing""github.com/Tencent/WeKnora/internal/models/api"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -23,9 +24,9 @@ func TestApplyOverlay_ModelsUpsertPatchesExistingEntry(t *testing.T) {{"id": "acme-pro", "max_output_tokens": 8192},{"id": "acme-r1", "context_window": 128000}]}}}`- require.NoError(t, ApplyOverlay([]byte(overlay), t.TempDir()))+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlay), t.TempDir()))- r, err := Resolve(Ref{Provider: "acme", Model: "acme-pro"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro"})require.NoError(t, err)assert.True(t, r.Spec.Reasoning, "omitted reasoning must not turn thinking off")assert.Equal(t, []string{"text", "image"}, r.Spec.Input, "omitted input survives")@@ -33,7 +34,7 @@ func TestApplyOverlay_ModelsUpsertPatchesExistingEntry(t *testing.T) {assert.Equal(t, 8192, r.Spec.MaxOutputTokens, "the field that was written is applied")assert.False(t, r.OpenAICompletions.SupportsTemperature, "omitted compat survives")- r, err = Resolve(Ref{Provider: "acme", Model: "acme-r1"})+ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-r1"})require.NoError(t, err)assert.True(t, r.Spec.Reasoning)assert.Equal(t, 128000, r.Spec.ContextWindow)@@ -46,17 +47,17 @@ func TestApplyOverlay_ModelsUpsertPatchesExistingEntry(t *testing.T) {// with the vendor package's own (package-level) models.json data.func TestApplyOverlay_ModelsUpsertDoesNotMutateBuiltinVendor(t *testing.T) {registerTestVendors(t)- builtin, ok := Get("acme")+ builtin, ok := modelruntime.Get("acme")require.True(t, ok)overlay := `{"providers": {"acme": {"models": [{"id": "acme-pro", "input": ["audio"]}]}}}`- require.NoError(t, ApplyOverlay([]byte(overlay), t.TempDir()))+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlay), t.TempDir()))- require.Equal(t, "acme-pro", builtin.Models[0].ID)- assert.Equal(t, []string{"text", "image"}, builtin.Models[0].Input,+ require.Equal(t, "acme-pro", builtin.Models()[0].ID)+ assert.Equal(t, []string{"text", "image"}, builtin.Models()[0].Input,"the built-in spec must be untouched by the overlay")- r, err := Resolve(Ref{Provider: "acme", Model: "acme-pro"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro"})require.NoError(t, err)assert.Equal(t, []string{"audio"}, r.Spec.Input, "the written field is still applied")}@@ -67,13 +68,13 @@ func TestApplyOverlay_ModelsUpsertExplicitFalseAndNewEntries(t *testing.T) {{"id": "acme-pro", "reasoning": false},{"id": "acme-ultra", "context_window": 400000}]}}}`- require.NoError(t, ApplyOverlay([]byte(overlay), t.TempDir()))+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlay), t.TempDir()))- r, err := Resolve(Ref{Provider: "acme", Model: "acme-pro"})+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-pro"})require.NoError(t, err)assert.False(t, r.Spec.Reasoning, "an explicit false still turns reasoning off")- r, err = Resolve(Ref{Provider: "acme", Model: "acme-ultra"})+ r, err = modelruntime.Resolve(modelruntime.Ref{Provider: "acme", Model: "acme-ultra"})require.NoError(t, err)assert.True(t, r.Cataloged, "an unknown id creates a full entry")assert.Equal(t, 400000, r.Spec.ContextWindow)@@ -84,10 +85,10 @@ func TestApplyOverlay_ModelsEntryValidation(t *testing.T) {registerTestVendors(t)dir := t.TempDir()assert.ErrorContains(t,- ApplyOverlay([]byte(`{"providers": {"acme": {"models": [{"id": "x", "bogus": 1}]}}}`), dir),+ modelruntime.ApplyOverlay([]byte(`{"providers": {"acme": {"models": [{"id": "x", "bogus": 1}]}}}`), dir),"bogus", "unknown keys inside a model entry are still rejected")assert.ErrorContains(t,- ApplyOverlay([]byte(`{"providers": {"acme": {"models": [{"context_window": 1}]}}}`), dir),+ modelruntime.ApplyOverlay([]byte(`{"providers": {"acme": {"models": [{"context_window": 1}]}}}`), dir),"model without id")}@@ -106,13 +107,13 @@ func TestApplyOverlay_IconAcceptsInlineAndContainedFiles(t *testing.T) {require.NoError(t, os.MkdirAll(filepath.Join(dir, "icons"), 0o755))require.NoError(t, os.WriteFile(filepath.Join(dir, "icons", "lab.svg"), []byte(testSVG), 0o600))- require.NoError(t, ApplyOverlay([]byte(overlayWithIcon("icons/lab.svg")), dir))- lab, ok := Get("lab")+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("icons/lab.svg")), dir))+ lab, ok := modelruntime.Get("lab")require.True(t, ok)assert.Equal(t, testSVG, string(lab.Icon))- require.NoError(t, ApplyOverlay([]byte(overlayWithIcon("<svg><rect/></svg>")), dir))- lab, _ = Get("lab")+ require.NoError(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("<svg><rect/></svg>")), dir))+ lab, _ = modelruntime.Get("lab")assert.Equal(t, "<svg><rect/></svg>", string(lab.Icon))}@@ -125,22 +126,22 @@ func TestApplyOverlay_IconRejectsUncontainedPaths(t *testing.T) {outside := filepath.Join(t.TempDir(), "secret.svg")require.NoError(t, os.WriteFile(outside, []byte(testSVG), 0o600))- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon(outside)), dir),+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon(outside)), dir),"absolute paths are not allowed")- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("/etc/passwd")), dir),+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("/etc/passwd")), dir),"absolute paths are not allowed")- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("../secret.svg")), dir),+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("../secret.svg")), dir),"escapes the overlay directory")- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("icons/../../secret.svg")), dir),+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("icons/../../secret.svg")), dir),"escapes the overlay directory")link := filepath.Join(dir, "link.svg")if err := os.Symlink(outside, link); err == nil {- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("link.svg")), dir),+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("link.svg")), dir),"escapes the overlay directory", "a symlink out of the directory is still out of it")}- _, exists := Get("lab")+ _, exists := modelruntime.Get("lab")assert.False(t, exists, "a rejected icon must not register the provider")}@@ -149,38 +150,20 @@ func TestApplyOverlay_IconRejectsNonSVGAndOversizedFiles(t *testing.T) {dir := t.TempDir()require.NoError(t, os.WriteFile(filepath.Join(dir, "passwd.svg"), []byte("root:x:0:0:root:/root:/bin/sh\n"), 0o600))- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("passwd.svg")), dir), "not an SVG document")+ assert.ErrorContains(t,+ modelruntime.ApplyOverlay([]byte(overlayWithIcon("passwd.svg")), dir), "not an SVG document")require.NoError(t, os.WriteFile(filepath.Join(dir, "png.svg"), []byte("\x89PNG\r\n\x1a\n"), 0o600))- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("png.svg")), dir), "not an SVG document")+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("png.svg")), dir), "not an SVG document")- big := append([]byte(`<svg xmlns="http://www.w3.org/2000/svg">`), make([]byte, maxIconBytes)...)+ big := append([]byte(`<svg xmlns="http://www.w3.org/2000/svg">`), make([]byte, 256*1024)...)require.NoError(t, os.WriteFile(filepath.Join(dir, "big.svg"), big, 0o600))- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("big.svg")), dir), "limit is")+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("big.svg")), dir), "limit is")require.NoError(t, os.MkdirAll(filepath.Join(dir, "dir.svg"), 0o755))- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("dir.svg")), dir), "not a regular file")-- assert.ErrorContains(t, ApplyOverlay([]byte(overlayWithIcon("missing.svg")), dir), "read icon")-}+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("dir.svg")), dir), "not a regular file")-func TestLooksLikeSVG(t *testing.T) {- for _, in := range []string{- testSVG,- " \n<svg/>",- "\ufeff<?xml version=\"1.0\"?>\n<!-- brand mark --><svg >x</svg>",- "<?xml version=\"1.0\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"x.dtd\"><svg>y</svg>",- "<SVG></SVG>",- } {- assert.True(t, looksLikeSVG([]byte(in)), "want SVG: %q", in)- }- for _, in := range []string{- "", " ", "<svg", "<svgx>", "not markup at all",- "<html><svg></svg></html>", "<?xml version=\"1.0\"?>", "<!-- unterminated",- "root:x:0:0::/root:/bin/sh",- } {- assert.False(t, looksLikeSVG([]byte(in)), "want not SVG: %q", in)- }+ assert.ErrorContains(t, modelruntime.ApplyOverlay([]byte(overlayWithIcon("missing.svg")), dir), "read icon")}// The icon path is relative to the overlay file's own directory.@@ -192,8 +175,8 @@ func TestLoadOverlay_ResolvesIconRelativeToConfigDir(t *testing.T) {[]byte(overlayWithIcon("lab.svg")), 0o600))t.Setenv("MODELS_CONFIG", "")- require.NoError(t, LoadOverlay(dir))- lab, ok := Get("lab")+ require.NoError(t, modelruntime.LoadOverlay(dir))+ lab, ok := modelruntime.Get("lab")require.True(t, ok)assert.Equal(t, testSVG, string(lab.Icon))assert.Equal(t, []types.ModelType{types.ModelTypeKnowledgeQA}, lab.ModelTypes)diff --git a/internal/models/runtime/refactor_test.go b/internal/models/runtime/refactor_test.gonew file mode 100644index 000000000..8eef2d240--- /dev/null+++ b/internal/models/runtime/refactor_test.go@@ -0,0 +1,234 @@+package runtime_test++import (+ "context"+ "encoding/json"+ "net/http"+ "sync"+ "testing"++ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++func TestExplicitChatProtocolSurvivesVendorPreference(t *testing.T) {+ for _, protocol := range []api.API{api.APIOpenAICompletions, api.APIOpenAIResponses} {+ r, err := modelruntime.Resolve(+ modelruntime.Ref{+ Provider: "openai",+ Model: "gpt-5",+ BaseURL: "https://api.openai.com/v1",+ Override: &types.ModelSpecOverride{+ API: string(+ protocol,+ ),+ },+ },+ )+ require.NoError(t, err)+ require.Equal(t, protocol, r.API)+ }+}++func TestProtocolOverrideDoesNotDecodeCatalogCompatAsAnotherProtocol(t *testing.T) {+ r, err := modelruntime.Resolve(modelruntime.Ref{+ Provider: "aliyun", Model: "qwen-plus",+ Override: &types.ModelSpecOverride{+ API: string(api.APIAnthropicMessages),+ Compat: map[string]any{"thinking_mode": "adaptive"},+ },+ })+ require.NoError(t, err)+ require.Equal(t, api.APIAnthropicMessages, r.API)+ require.Equal(t, api.AnthropicThinkingAdaptive, r.AnthropicMessages.ThinkingMode)+}++func TestEveryProviderKeepsModelCredentialsIsolated(t *testing.T) {+ for _, v := range modelruntime.List() {+ t.Run(v.ID, func(t *testing.T) {+ r, err := modelruntime.Resolve(+ modelruntime.Ref{+ Provider: v.ID,+ Model: "test",+ BaseURL: "https://example.com/v1",+ },+ )+ require.NoError(t, err)+ for _, key := range []string{"first-model-key", "second-model-key", "first-model-key"} {+ ep, err := r.Endpoint(+ types.ModelTypeKnowledgeQA,+ modelruntime.Connection{+ ModelID: key,+ Credentials: api.Credentials{+ APIKey: key,+ AppID: key,+ AppSecret: key,+ },+ Headers: map[string]string{+ "X-Model": key,+ },+ },+ )+ require.NoError(t, err)+ req, err := http.NewRequestWithContext(context.Background(), "POST", "https://example.com/v1", nil)+ require.NoError(t, err)+ ep.Auth(req, []byte(`{}`))+ switch v.AuthStyleFor(r.API) {+ case providers.AuthBearer:+ require.Equal(t, "Bearer "+key, req.Header.Get("Authorization"))+ case providers.AuthAPIKeyHeader:+ require.Equal(t, key, req.Header.Get("api-key"))+ case providers.AuthXAPIKey:+ require.Equal(t, key, req.Header.Get("x-api-key"))+ case providers.AuthGoogleAPIKey:+ require.Equal(t, key, req.Header.Get("x-goog-api-key"))+ case providers.AuthSigned:+ require.Equal(t, key, req.Header.Get("X-APPID"))+ }+ require.Equal(t, key, ep.ModelID)+ require.Equal(t, key, ep.Headers["X-Model"])+ }+ })+ }+}++func TestOverlayReloadRestoresBaselineAndRollsBackFailure(t *testing.T) {+ before := modelruntime.SnapshotCurrent()+ t.Cleanup(func() { modelruntime.RestoreSnapshot(before) })+ original, _ := modelruntime.Get("openai")+ require.NoError(t, modelruntime.ApplyOverlay([]byte(`{+ "providers": {+ "openai": {+ "base_url": "https://relay.example/v1",+ "models": [+ {+ "id": "gpt-5",+ "cost": {+ "input": 999+ }+ }+ ]+ },+ "temporary": {+ "name": "Temporary"+ }+ }+}`), ""))+ changed, _ := modelruntime.Get("openai")+ require.Equal(t, "https://relay.example/v1", changed.GetDefaultURL(types.ModelTypeKnowledgeQA))+ require.Error(+ t,+ modelruntime.ApplyOverlay(+ []byte(+ `{"providers":{"openai":{"base_url":"https://wrong.example"},"broken":{"api":"typo"}}}`,+ ),+ "",+ ),+ )+ current, _ := modelruntime.Get("openai")+ require.Equal(t, changed.DefaultBaseURLs, current.DefaultBaseURLs)+ require.Equal(t, changed.Models(), current.Models())+ require.Error(t, modelruntime.ApplyOverlay([]byte(`{"providers":{}} {"providers":{}}`), ""))+ require.NoError(t, modelruntime.ApplyOverlay([]byte(`{"providers":{}}`), ""))+ restored, _ := modelruntime.Get("openai")+ require.Equal(t, original.DefaultBaseURLs, restored.DefaultBaseURLs)+ require.Equal(t, original.Models(), restored.Models())+ _, exists := modelruntime.Get("temporary")+ require.False(t, exists)+}++func TestConcurrentOverlayAndModelResolution(t *testing.T) {+ before := modelruntime.SnapshotCurrent()+ t.Cleanup(func() { modelruntime.RestoreSnapshot(before) })+ var wg sync.WaitGroup+ for i := 0; i < 4; i++ {+ wg.Add(1)+ go func() {+ defer wg.Done()+ for j := 0; j < 30; j++ {+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "openai", Model: "gpt-5"})+ if err != nil || r.RemoteModel != "gpt-5" {+ t.Errorf("resolve during reload: %v", err)+ return+ }+ }+ }()+ }+ for i := 0; i < 20; i++ {+ require.NoError(+ t,+ modelruntime.ApplyOverlay(+ []byte(+ `{"providers":{"openai":{"headers":{"X-Deployment":"one"}}}}`,+ ),+ "",+ ),+ )+ }+ wg.Wait()+}++func TestEveryProviderDefinitionCanBeReloaded(t *testing.T) {+ before := modelruntime.SnapshotCurrent()+ t.Cleanup(func() { modelruntime.RestoreSnapshot(before) })+ entries := map[string]any{}+ for _, v := range modelruntime.List() {+ entries[v.ID] = map[string]any{}+ }+ data, err := json.Marshal(map[string]any{"providers": entries})+ require.NoError(t, err)+ require.NoError(t, modelruntime.Reload(data, ""))+ require.ErrorContains(+ t,+ modelruntime.Reload(+ []byte(+ `{"providers":{"openai":{"models":[{"id":"gpt-5","compat":{"typo":true}}]}}}`,+ ),+ "",+ ),+ "unknown field",+ )+ r, err := modelruntime.Resolve(modelruntime.Ref{Provider: "openai", Model: "gpt-5"})+ require.NoError(t, err)+ require.Equal(t, "gpt-5", r.RemoteModel)+}++func TestOverlayCanDeclareSameModelNameForDifferentCapabilities(t *testing.T) {+ before := modelruntime.SnapshotCurrent()+ t.Cleanup(func() { modelruntime.RestoreSnapshot(before) })+ require.NoError(t, modelruntime.Reload([]byte(`{+ "providers": {+ "generic": {+ "models": [+ {+ "id": "shared-name",+ "type": "KnowledgeQA",+ "context_window": 64000+ },+ {+ "id": "shared-name",+ "type": "Embedding",+ "dimension": 768,+ "compat": {+ "dimensions_field": "dimensions"+ }+ }+ ]+ }+ }+}`), ""))+ chat, err := modelruntime.Resolve(modelruntime.Ref{+ Provider: "generic", Model: "shared-name", ModelType: types.ModelTypeKnowledgeQA,+ })+ require.NoError(t, err)+ require.Equal(t, 64000, chat.Spec.ContextWindow)+ embed, err := modelruntime.Resolve(modelruntime.Ref{+ Provider: "generic", Model: "shared-name", ModelType: types.ModelTypeEmbedding,+ })+ require.NoError(t, err)+ require.Equal(t, 768, embed.Spec.Dimension)+ require.Equal(t, "dimensions", embed.Embeddings.DimensionsField)+}diff --git a/internal/models/runtime/registry.go b/internal/models/runtime/registry.gonew file mode 100644index 000000000..c7606f30f--- /dev/null+++ b/internal/models/runtime/registry.go@@ -0,0 +1,210 @@+package runtime++import (+ "sort"+ "strings"+ "sync"++ "github.com/Tencent/WeKnora/internal/models"+ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+ "github.com/Tencent/WeKnora/internal/models/providers"+ "github.com/Tencent/WeKnora/internal/types"+)++// Provider combines a provider definition with a catalog from the same runtime+// generation. Public queries return owned definitions; the catalog is immutable.+type Provider struct {+ *providers.Definition+ catalog *catalog.Catalog+}++// Models returns owned entries from this view, including hidden rules.+func (p *Provider) Models() []models.ModelSpec { return p.catalog.Models() }++// ModelsByType returns visible entries for the requested capability.+func (p *Provider) ModelsByType(kind types.ModelType) []models.ModelSpec {+ return p.catalog.ModelsByType(kind)+}++// FindModel matches an exact ID, alias or family within this view.+func (p *Provider) FindModel(name string, kind types.ModelType) (models.ModelSpec, bool) {+ return p.catalog.FindModel(name, kind)+}++// Resolve uses this view's definition and catalog even after the runtime reloads.+func (p *Provider) Resolve(ref Ref) (*Resolved, error) {+ return resolveWithVendor(ref, p)+}++func (p *Provider) clone() *Provider {+ return &Provider{Definition: configcopy.Clone(p.Definition), catalog: p.catalog}+}++// Runtime owns provider definitions, model catalogs and deployment overrides.+// Separate instances can be configured without changing any other instance.+type Runtime struct {+ mu sync.RWMutex+ providers map[string]*Provider+ builtins map[string]*Provider+}++// New explicitly composes fresh built-in definitions and independent catalogs.+func New() *Runtime {+ rt := &Runtime{providers: map[string]*Provider{}, builtins: map[string]*Provider{}}+ for _, definition := range providers.Builtins() {+ rt.Register(definition, catalog.BuiltinModels(definition.ID)...)+ }+ return rt+}++// Default is the application runtime used by the existing model factories.+// New is available to callers that need an isolated configuration.+func Default() *Runtime { return sharedRuntime }++var sharedRuntime = New()++// Register adds an owned built-in definition and its independently supplied+// catalog. Deployment overrides never mutate this baseline.+func (rt *Runtime) Register(definition *providers.Definition, entries ...models.ModelSpec) {+ if definition == nil || definition.ID == "" {+ panic("runtime: provider without id")+ }+ p := &Provider{Definition: configcopy.Clone(definition), catalog: catalog.New(entries)}+ normalizeProvider(p)+ rt.mu.Lock()+ defer rt.mu.Unlock()+ rt.providers[p.ID] = p+ rt.builtins[p.ID] = p.clone()+}++func normalizeProvider(p *Provider) {+ if p.API == "" {+ p.API = api.APIOpenAICompletions+ }+ if p.Auth == "" {+ p.Auth = providers.AuthBearer+ }+ if p.RerankAPI == "" && p.SupportsType(types.ModelTypeRerank) {+ p.RerankAPI = api.RerankCohere+ }+ if p.EmbeddingAPI == "" && p.SupportsType(types.ModelTypeEmbedding) {+ p.EmbeddingAPI = api.EmbeddingOpenAI+ }+ if p.TranscriptionAPI == "" && p.SupportsType(types.ModelTypeASR) {+ p.TranscriptionAPI = api.TranscriptionOpenAI+ }+ entries := p.Models()+ for i := range entries {+ if entries[i].Type == "" {+ entries[i].Type = types.ModelTypeKnowledgeQA+ }+ if entries[i].API == "" && entries[i].Type == types.ModelTypeKnowledgeQA {+ entries[i].API = p.API+ }+ }+ p.catalog = catalog.New(entries)+}++// Get returns an owned provider view from the current generation.+func (rt *Runtime) Get(id string) (*Provider, bool) {+ rt.mu.RLock()+ defer rt.mu.RUnlock()+ p, ok := rt.providers[strings.ToLower(strings.TrimSpace(id))]+ if !ok {+ return nil, false+ }+ return p.clone(), true+}++// selectProvider retains one immutable generation for the entire resolution.+// Its result stays private; Resolve copies the connection definition before+// returning it to callers, without copying the full model catalog.+func (rt *Runtime) selectProvider(id, baseURL string) *Provider {+ rt.mu.RLock()+ defer rt.mu.RUnlock()+ id = strings.ToLower(strings.TrimSpace(id))+ if id == "" {+ id = detectByURL(rt.providers, baseURL)+ }+ if p, ok := rt.providers[id]; ok {+ return p+ }+ return rt.providers[providers.GenericID]+}++func detectByURL(definitions map[string]*Provider, baseURL string) string {+ id, bestLen, bestOrder := providers.GenericID, 0, int(^uint(0)>>1)+ lower := strings.ToLower(baseURL)+ for candidate, p := range definitions {+ for _, pattern := range p.URLPatterns {+ if pattern != "" && strings.Contains(lower, strings.ToLower(pattern)) &&+ (len(pattern) > bestLen || len(pattern) == bestLen &&+ (p.Order < bestOrder || p.Order == bestOrder && candidate < id)) {+ id, bestLen, bestOrder = candidate, len(pattern), p.Order+ }+ }+ }+ return id+}++// DetectByURL applies legacy provider inference without exposing registry state.+func (rt *Runtime) DetectByURL(baseURL string) string {+ rt.mu.RLock()+ defer rt.mu.RUnlock()+ return detectByURL(rt.providers, baseURL)+}++// List returns owned provider views from one generation, ordered by Order and ID.+func (rt *Runtime) List() []*Provider {+ rt.mu.RLock()+ defer rt.mu.RUnlock()+ out := make([]*Provider, 0, len(rt.providers))+ for _, p := range rt.providers {+ out = append(out, p.clone())+ }+ sort.Slice(out, func(i, j int) bool {+ if out[i].Order != out[j].Order {+ return out[i].Order < out[j].Order+ }+ return out[i].ID < out[j].ID+ })+ return out+}++// ListByType returns owned views supporting the requested capability.+func (rt *Runtime) ListByType(kind types.ModelType) []*Provider {+ out := make([]*Provider, 0)+ for _, p := range rt.List() {+ if p.SupportsType(kind) {+ out = append(out, p)+ }+ }+ return out+}++func cloneProviders(in map[string]*Provider) map[string]*Provider {+ out := make(map[string]*Provider, len(in))+ for id, p := range in {+ out[id] = p.clone()+ }+ return out+}++// Register adds a built-in definition and separate catalog to the default runtime.+func Register(definition *providers.Definition, entries ...models.ModelSpec) {+ Default().Register(definition, entries...)+}++// Get queries the default runtime.+func Get(id string) (*Provider, bool) { return Default().Get(id) }++// List queries the default runtime.+func List() []*Provider { return Default().List() }++// ListByType queries the default runtime for one capability.+func ListByType(kind types.ModelType) []*Provider { return Default().ListByType(kind) }++// DetectByURL infers a legacy provider using the default runtime.+func DetectByURL(baseURL string) string { return Default().DetectByURL(baseURL) }diff --git a/internal/models/runtime/registry_test.go b/internal/models/runtime/registry_test.gonew file mode 100644index 000000000..de2952059--- /dev/null+++ b/internal/models/runtime/registry_test.go@@ -0,0 +1,133 @@+package runtime_test++import (+ "encoding/json"+ "fmt"+ "sync"+ "testing"++ "github.com/Tencent/WeKnora/internal/models"+ "github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"+ "github.com/Tencent/WeKnora/internal/types"+ "github.com/stretchr/testify/require"+)++func TestRuntimeOwnsDefinitionsAndQueryResults(t *testing.T) {+ rt := modelruntime.New()+ definition := &providers.Definition{+ ID: "owned", Name: "Owned", Auth: providers.AuthBearer,+ ModelTypes: []types.ModelType{types.ModelTypeKnowledgeQA},+ Headers: map[string]string{"X-Owner": "original"},+ Compat: providers.VendorCompat{OpenAICompletions: api.OpenAICompletionsCompat{+ ExtraBody: map[string]any{"nested": map[string]any{"value": "original", "empty": nil}},+ }},+ }+ entry := models.ModelSpec{+ ID: "sample", Input: []string{"text", "image"},+ Cost: &models.ModelCost{Input: 1},+ ThinkingLevels: api.ThinkingLevelMap{api.ReasoningHigh: api.StringPtr("high")},+ Compat: json.RawMessage(`{"supports_temperature":false}`),+ }+ rt.Register(definition, entry)+ definition.Headers["X-Owner"] = "input mutation"+ definition.Compat.OpenAICompletions.ExtraBody["nested"].(map[string]any)["value"] = "input mutation"+ entry.Input[0], entry.Cost.Input = "audio", 99++ p, ok := rt.Get("owned")+ require.True(t, ok)+ check := func() {+ t.Helper()+ resolved, err := rt.Resolve(modelruntime.Ref{Provider: "owned", Model: "sample"})+ require.NoError(t, err)+ require.Equal(t, "original", resolved.Vendor.Headers["X-Owner"])+ require.Equal(t, "original", resolved.OpenAICompletions.ExtraBody["nested"].(map[string]any)["value"])+ require.Nil(t, resolved.OpenAICompletions.ExtraBody["nested"].(map[string]any)["empty"])+ require.Equal(t, []string{"text", "image"}, resolved.Spec.Input)+ require.Equal(t, float64(1), resolved.Spec.Cost.Input)+ require.Equal(t, "high", *resolved.Spec.ThinkingLevels[api.ReasoningHigh])+ require.False(t, resolved.OpenAICompletions.SupportsTemperature)+ resolved.Vendor.Headers["X-Owner"] = "resolved mutation"+ resolved.OpenAICompletions.ExtraBody["nested"].(map[string]any)["value"] = "resolved mutation"+ }+ check()+ p.Headers["X-Owner"] = "query mutation"+ p.Compat.OpenAICompletions.ExtraBody["nested"].(map[string]any)["value"] = "query mutation"+ for _, entries := range [][]models.ModelSpec{p.Models(), p.ModelsByType(types.ModelTypeKnowledgeQA)} {+ entries[0].Input[0], entries[0].Cost.Input = "audio", 99+ *entries[0].ThinkingLevels[api.ReasoningHigh] = "changed"+ entries[0].Compat[0] = 'x'+ }+ for _, view := range rt.List() {+ if view.ID == "owned" {+ view.Headers["X-Owner"] = "list mutation"+ }+ }+ check()+ // Rebuilding from the baseline must not reintroduce any input/query mutations.+ require.NoError(t, rt.Reload([]byte(`{"providers":{}}`), ""))+ check()+}++func TestRuntimeInstancesAndRetainedViewsAreIndependent(t *testing.T) {+ first, second := modelruntime.New(), modelruntime.New()+ old, ok := first.Get("openai")+ require.True(t, ok)+ ref := modelruntime.Ref{Provider: "openai", Model: "gpt-5"}+ before, err := old.Resolve(ref)+ require.NoError(t, err)+ require.NoError(t, first.Reload([]byte(`{"providers":{"openai":{+ "base_url":"https://relay.example/v1", "models":[{"id":"gpt-5","context_window":12345}]+}}}`), ""))+ changed, err := first.Resolve(ref)+ require.NoError(t, err)+ require.Equal(t, "https://relay.example/v1", changed.BaseURL)+ require.Equal(t, 12345, changed.Spec.ContextWindow)+ for _, resolve := range []func(modelruntime.Ref) (*modelruntime.Resolved, error){old.Resolve, second.Resolve} {+ unchanged, err := resolve(ref)+ require.NoError(t, err)+ require.Equal(t, before.BaseURL, unchanged.BaseURL)+ require.Equal(t, before.Spec, unchanged.Spec)+ }+ require.NoError(t, first.Reload([]byte(`{"providers":{}}`), ""))+ restored, err := first.Resolve(ref)+ require.NoError(t, err)+ require.Equal(t, before.Spec, restored.Spec)+}++func TestResolveKeepsOneGenerationDuringReload(t *testing.T) {+ rt := modelruntime.New()+ overlay := func(generation int) []byte {+ return []byte(fmt.Sprintf(`{"providers":{"openai":{+ "base_url":"https://generation-%d.example/v1", "headers":{"X-Generation":"%d"},+ "models":[{"id":"gpt-5","context_window":%d}]+}}}`, generation, generation, generation))+ }+ require.NoError(t, rt.Reload(overlay(1), ""))+ var wg sync.WaitGroup+ for range 4 {+ wg.Add(1)+ go func() {+ defer wg.Done()+ for range 30 {+ resolved, err := rt.Resolve(modelruntime.Ref{Provider: "openai", Model: "gpt-5"})+ if err != nil {+ t.Errorf("resolve: %v", err)+ return+ }+ generation := resolved.Vendor.Headers["X-Generation"]+ if resolved.BaseURL != "https://generation-"+generation+".example/v1" ||+ fmt.Sprint(resolved.Spec.ContextWindow) != generation {+ t.Errorf("mixed provider/catalog generation: %s, %s, %d",+ generation, resolved.BaseURL, resolved.Spec.ContextWindow)+ }+ resolved.Vendor.Headers["X-Generation"] = "caller mutation"+ }+ }()+ }+ for generation := 2; generation < 12; generation++ {+ require.NoError(t, rt.Reload(overlay(generation), ""))+ }+ wg.Wait()+}diff --git a/internal/models/catalog/resolve.go b/internal/models/runtime/resolve.gosimilarity index 62%rename from internal/models/catalog/resolve.gorename to internal/models/runtime/resolve.goindex fa8542c22..7e821233e 100644--- a/internal/models/catalog/resolve.go+++ b/internal/models/runtime/resolve.go@@ -1,4 +1,4 @@-package catalog+package runtimeimport ("encoding/json"@@ -6,37 +6,14 @@ import ("strconv""strings"+ "github.com/Tencent/WeKnora/internal/models""github.com/Tencent/WeKnora/internal/models/api"+ "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/internal/configcopy"+ "github.com/Tencent/WeKnora/internal/models/providers""github.com/Tencent/WeKnora/internal/types")-// Extra-config keys honoured by Resolve. They predate the catalog and stay-// supported so existing model rows keep working unchanged.-const (- // ExtraAPI forces a protocol ("openai-responses", "anthropic-messages", ...).- ExtraAPI = "api"- // ExtraRemoteModelName sends a different model id on the wire.- ExtraRemoteModelName = "remote_model_name"- // ExtraAPIVersion is the Azure api-version query parameter.- ExtraAPIVersion = "api_version"- // ExtraThinkingControl is the legacy thinking encoding selector written- // by older UIs: none | enable_thinking | thinking_type | chat_template_kwargs.- ExtraThinkingControl = "thinking_control"- // ExtraTruncatePromptTokens is the vLLM-only server-side truncation- // budget for rerank, opt-in per row. It is never sent unless the operator- // set it: vendors that do not implement it reject the unknown field.- ExtraTruncatePromptTokens = "truncate_prompt_tokens"- // LegacyTruncatePromptTokens is the embedding truncation budget the- // pre-catalog OpenAI-compatible client sent whenever a row left it at 0.- LegacyTruncatePromptTokens = 511- // ExtraScoreScale overrides the vendor rerank score scale for one row.- // A self-hosted gateway serves whatever reranker was deployed behind it- // and the two families disagree: BGE-class models answer a 0..1- // probability, Qwen3-Reranker-class models an unbounded score. A vendor- // can only state what its own documentation shows.- ExtraScoreScale = "score_scale"-)-// Ref identifies one configured model.type Ref struct {Provider string@@ -55,9 +32,9 @@ type Ref struct {// Resolved is the fully merged view of one model: which vendor, which// protocol, which settings.type Resolved struct {- Vendor *Vendor+ Vendor *providers.Definition// Spec is the effective catalog entry (synthesized when unknown).- Spec ModelSpec+ Spec models.ModelSpec// Cataloged reports whether the model name matched a catalog entry.Cataloged boolAPI api.API@@ -66,37 +43,39 @@ type Resolved struct {RemoteModel stringThinkingLevels api.ThinkingLevelMap- OpenAICompletions OpenAICompletionsSettings- OpenAIResponses OpenAIResponsesSettings- AnthropicMessages AnthropicMessagesSettings- GoogleGenerativeAI GoogleGenerativeAISettings+ OpenAICompletions api.OpenAICompletionsSettings+ OpenAIResponses api.OpenAIResponsesSettings+ AnthropicMessages api.AnthropicMessagesSettings+ GoogleGenerativeAI api.GoogleGenerativeAISettings// RerankAPI and Rerank are filled only when the reference asked for a// rerank model. Chat resolution is on every request's hot path, so the// rerank overlay is not merged for it.RerankAPI api.RerankAPI- Rerank RerankSettings+ Rerank api.RerankSettings// EmbeddingAPI and Embeddings are filled only for an embedding reference,// for the same reason.EmbeddingAPI api.EmbeddingAPI- Embeddings EmbeddingsSettings+ Embeddings api.EmbeddingsSettings// TranscriptionAPI and Transcriptions are filled only for an ASR// reference.TranscriptionAPI api.TranscriptionAPI- Transcriptions TranscriptionsSettings+ Transcriptions api.TranscriptionsSettings}// Resolve merges the vendor, catalog entry, extra-config and per-row// overrides for a model reference. It never fails for unknown vendors or// models: they degrade to the generic OpenAI-compatible baseline.-func Resolve(ref Ref) (*Resolved, error) {- providerID := strings.ToLower(strings.TrimSpace(ref.Provider))- if providerID == "" {- providerID = DetectByURL(ref.BaseURL)- }- vendor := GetOrGeneric(providerID)+func Resolve(ref Ref) (*Resolved, error) { return Default().Resolve(ref) }++// Resolve merges one model against a single generation of this runtime.+func (rt *Runtime) Resolve(ref Ref) (*Resolved, error) {+ return resolveWithVendor(ref, rt.selectProvider(ref.Provider, ref.BaseURL))+}++func resolveWithVendor(ref Ref, vendor *Provider) (*Resolved, error) {if vendor == nil {return nil, fmt.Errorf("catalog: no vendors registered")}@@ -112,11 +91,12 @@ func Resolve(ref Ref) (*Resolved, error) {spec, cataloged := vendor.FindModel(ref.Model, modelType)if !cataloged {- spec = ModelSpec{ID: ref.Model, Type: entryType(modelType)}+ spec = models.ModelSpec{ID: ref.Model, Type: catalog.EntryType(modelType)}}if spec.API == "" {spec.API = vendor.API}+ catalogAPI := spec.APIif ref.Override != nil {applySpecOverride(&spec, ref.Override)}@@ -132,9 +112,9 @@ func Resolve(ref Ref) (*Resolved, error) {}resolvedAPI := spec.API- if forced := strings.TrimSpace(ref.Extra[ExtraAPI]); forced != "" {+ if forced := strings.TrimSpace(ref.Extra[models.ExtraAPI]); forced != "" {resolvedAPI = api.API(forced)- } else {+ } else if ref.Override == nil || ref.Override.API == "" {resolvedAPI = inferAPIFromURL(baseURL, resolvedAPI)if vendor.PreferAPI != nil {if preferred := vendor.PreferAPI(baseURL, spec); preferred != "" {@@ -160,7 +140,7 @@ func Resolve(ref Ref) (*Resolved, error) {}out := &Resolved{- Vendor: vendor,+ Vendor: configcopy.Clone(vendor.Definition),Spec: spec,Cataloged: cataloged,API: resolvedAPI,@@ -168,7 +148,7 @@ func Resolve(ref Ref) (*Resolved, error) {RemoteModel: ref.Model,ThinkingLevels: levels,}- if override := strings.TrimSpace(ref.Extra[ExtraRemoteModelName]); override != "" {+ if override := strings.TrimSpace(ref.Extra[models.ExtraRemoteModelName]); override != "" {out.RemoteModel = override}@@ -177,65 +157,65 @@ func Resolve(ref Ref) (*Resolved, error) {// Every protocol's settings are resolved so callers can inspect any of// them, but only the layers whose API matches contribute model/override// compat (a flat compat object is meaningless for another protocol).- completions := DefaultOpenAICompletions()- apply(&completions, &vendor.Compat.OpenAICompletions)+ completions := api.DefaultOpenAICompletions()+ ApplyCompat(&completions, &vendor.Compat.OpenAICompletions)if err := applyRawCompat(- &completions, &OpenAICompletionsCompat{}, spec.Compat, spec.API, api.APIOpenAICompletions,+ &completions, &api.OpenAICompletionsCompat{}, spec.Compat, catalogAPI, api.APIOpenAICompletions,); err != nil {return nil, err}if err := applyRawCompat(- &completions, &OpenAICompletionsCompat{}, overrideCompat, resolvedAPI, api.APIOpenAICompletions,+ &completions, &api.OpenAICompletionsCompat{}, overrideCompat, resolvedAPI, api.APIOpenAICompletions,); err != nil {return nil, err}- applyLegacyThinkingControl(&completions, ref.Extra[ExtraThinkingControl])+ applyLegacyThinkingControl(&completions, ref.Extra[models.ExtraThinkingControl])out.OpenAICompletions = completions- responses := DefaultOpenAIResponses()- apply(&responses, &vendor.Compat.OpenAIResponses)+ responses := api.DefaultOpenAIResponses()+ ApplyCompat(&responses, &vendor.Compat.OpenAIResponses)if err := applyRawCompat(- &responses, &OpenAIResponsesCompat{}, spec.Compat, spec.API, api.APIOpenAIResponses,+ &responses, &api.OpenAIResponsesCompat{}, spec.Compat, catalogAPI, api.APIOpenAIResponses,); err != nil {return nil, err}if err := applyRawCompat(- &responses, &OpenAIResponsesCompat{}, overrideCompat, resolvedAPI, api.APIOpenAIResponses,+ &responses, &api.OpenAIResponsesCompat{}, overrideCompat, resolvedAPI, api.APIOpenAIResponses,); err != nil {return nil, err}out.OpenAIResponses = responses- anthropic := DefaultAnthropicMessages()- apply(&anthropic, &vendor.Compat.AnthropicMessages)+ anthropic := api.DefaultAnthropicMessages()+ ApplyCompat(&anthropic, &vendor.Compat.AnthropicMessages)if err := applyRawCompat(- &anthropic, &AnthropicMessagesCompat{}, spec.Compat, spec.API, api.APIAnthropicMessages,+ &anthropic, &api.AnthropicMessagesCompat{}, spec.Compat, catalogAPI, api.APIAnthropicMessages,); err != nil {return nil, err}if err := applyRawCompat(- &anthropic, &AnthropicMessagesCompat{}, overrideCompat, resolvedAPI, api.APIAnthropicMessages,+ &anthropic, &api.AnthropicMessagesCompat{}, overrideCompat, resolvedAPI, api.APIAnthropicMessages,); err != nil {return nil, err}out.AnthropicMessages = anthropic- google := DefaultGoogleGenerativeAI()- apply(&google, &vendor.Compat.GoogleGenerativeAI)+ google := api.DefaultGoogleGenerativeAI()+ ApplyCompat(&google, &vendor.Compat.GoogleGenerativeAI)if err := applyRawCompat(- &google, &GoogleGenerativeAICompat{}, spec.Compat, spec.API, api.APIGoogleGenerativeAI,+ &google, &api.GoogleGenerativeAICompat{}, spec.Compat, catalogAPI, api.APIGoogleGenerativeAI,); err != nil {return nil, err}if err := applyRawCompat(- &google, &GoogleGenerativeAICompat{}, overrideCompat, resolvedAPI, api.APIGoogleGenerativeAI,+ &google, &api.GoogleGenerativeAICompat{}, overrideCompat, resolvedAPI, api.APIGoogleGenerativeAI,); err != nil {return nil, err}out.GoogleGenerativeAI = google// An explicit legacy thinking_control is the operator saying "this row// does think, send the switch this way", so it outranks the catalog.- if strings.TrimSpace(ref.Extra[ExtraThinkingControl]) == "" {+ if strings.TrimSpace(ref.Extra[models.ExtraThinkingControl]) == "" {out.silenceThinkingForNonReasoningModel()}@@ -256,10 +236,10 @@ func (r *Resolved) silenceThinkingForNonReasoningModel() {if !r.Cataloged || r.Spec.Reasoning {return}- r.OpenAICompletions.ThinkingFormat = ThinkingFormatNone+ r.OpenAICompletions.ThinkingFormat = api.ThinkingFormatNoner.OpenAICompletions.ThinkingBudgetField = ""r.OpenAICompletions.SupportsReasoningEffort = false- r.GoogleGenerativeAI.ThinkingMode = GoogleThinkingNone+ r.GoogleGenerativeAI.ThinkingMode = api.GoogleThinkingNoner.ThinkingLevels = api.ThinkingLevelMap{}for _, level := range api.ReasoningLadder {r.ThinkingLevels[level] = nil@@ -273,14 +253,14 @@ func applyRawCompat(settings any, overlayPtr any, raw json.RawMessage, layerAPI,if len(raw) == 0 || layerAPI != target {return nil}- if err := decodeCompat(raw, overlayPtr); err != nil {+ if err := DecodeCompat(raw, overlayPtr); err != nil {return fmt.Errorf("%s compat: %w", target, err)}- apply(settings, overlayPtr)+ ApplyCompat(settings, overlayPtr)return nil}-func applySpecOverride(spec *ModelSpec, o *types.ModelSpecOverride) {+func applySpecOverride(spec *models.ModelSpec, o *types.ModelSpecOverride) {if o == nil {return}@@ -301,53 +281,8 @@ func applySpecOverride(spec *ModelSpec, o *types.ModelSpecOverride) {}}-// inferAPIFromURL applies the two URL conventions vendors use to expose a-// second protocol on a sub-path: ".../openai" for an OpenAI-compatible-// facade (Gemini, LongCat, Novita) and ".../anthropic" for an Anthropic-// Messages facade (MiniMax, Zhipu, Moonshot, Volcengine coding plans).-func inferAPIFromURL(baseURL string, current api.API) api.API {- lower := strings.ToLower(strings.TrimRight(baseURL, "/"))- switch {- case strings.HasSuffix(lower, "/anthropic") || strings.HasSuffix(lower, "/anthropic/v1"):- return api.APIAnthropicMessages- case current == api.APIGoogleGenerativeAI &&- (strings.HasSuffix(lower, "/openai") || strings.Contains(lower, "/openai/")):- return api.APIOpenAICompletions- }- return current-}--// applyLegacyThinkingControl maps the pre-catalog thinking_control value-// onto the new settings. Unknown non-empty values keep the historical-// fallback (chat_template_kwargs).-func applyLegacyThinkingControl(s *OpenAICompletionsSettings, value string) {- switch strings.ToLower(strings.TrimSpace(value)) {- case "":- return- case "none":- s.ThinkingFormat = ThinkingFormatNone- case "enable_thinking":- s.ThinkingFormat = ThinkingFormatEnableThinking- case "thinking_type":- s.ThinkingFormat = ThinkingFormatThinkingType- default:- s.ThinkingFormat = ThinkingFormatChatTemplateKwargs- }-}--// Capabilities is the UI-facing summary of a resolved model.-type Capabilities struct {- Provider string `json:"provider"`- API api.API `json:"api"`- Cataloged bool `json:"cataloged"`- Reasoning bool `json:"reasoning"`- ThinkingLevels []api.ReasoningEffort `json:"thinking_levels"`- ThinkingFormat string `json:"thinking_format"`- Input []string `json:"input,omitempty"`- ContextWindow int `json:"context_window,omitempty"`- MaxOutputTokens int `json:"max_output_tokens,omitempty"`- MaxTokensField string `json:"max_tokens_field,omitempty"`-}+// Capabilities is the frontend contract, independent of runtime assembly.+type Capabilities = models.Capabilities// Capabilities summarizes the resolved model for API responses.func (r *Resolved) Capabilities() Capabilities {@@ -367,7 +302,7 @@ func (r *Resolved) Capabilities() Capabilities {case api.APIOpenAICompletions:caps.ThinkingFormat = string(r.OpenAICompletions.ThinkingFormat)caps.MaxTokensField = r.OpenAICompletions.MaxTokensField- if caps.ThinkingFormat == string(ThinkingFormatNone) {+ if caps.ThinkingFormat == string(api.ThinkingFormatNone) {caps.ThinkingLevels = []api.ReasoningEffort{}return caps}@@ -380,7 +315,7 @@ func (r *Resolved) Capabilities() Capabilities {case api.APIGoogleGenerativeAI:caps.ThinkingFormat = "thinkingConfig." + string(r.GoogleGenerativeAI.ThinkingMode)caps.MaxTokensField = "maxOutputTokens"- if r.GoogleGenerativeAI.ThinkingMode == GoogleThinkingNone {+ if r.GoogleGenerativeAI.ThinkingMode == api.GoogleThinkingNone {caps.ThinkingLevels = []api.ReasoningEffort{}return caps}@@ -396,7 +331,7 @@ func (r *Resolved) Capabilities() Capabilities {// rather than one per protocol, so the model entry's compat object is decoded// unconditionally instead of being matched against a protocol.func resolveRerank(- ref Ref, vendor *Vendor, spec ModelSpec, cataloged bool, baseURL string,+ ref Ref, vendor *Provider, spec models.ModelSpec, cataloged bool, baseURL string,) (*Resolved, error) {protocol := vendor.RerankAPIif protocol == "" {@@ -409,57 +344,54 @@ func resolveRerank(// Lowest precedence first: protocol default, vendor, model entry, row spec// override. extra_config is the operator speaking about this one row, so it// comes last.- settings := DefaultRerank()- apply(&settings, &vendor.Compat.Rerank)+ settings := api.DefaultRerank()+ ApplyCompat(&settings, &vendor.Compat.Rerank)if len(spec.Compat) > 0 {- overlay := &RerankCompat{}- if err := decodeCompat(spec.Compat, overlay); err != nil {+ overlay := &api.RerankCompat{}+ if err := DecodeCompat(spec.Compat, overlay); err != nil {return nil, fmt.Errorf("rerank compat: %w", err)}- apply(&settings, overlay)+ ApplyCompat(&settings, overlay)}if raw := ref.Override.CompatJSON(); len(raw) > 0 {- overlay := &RerankCompat{}- if err := decodeCompat(raw, overlay); err != nil {+ overlay := &api.RerankCompat{}+ if err := DecodeCompat(raw, overlay); err != nil {return nil, fmt.Errorf("rerank compat: %w", err)}- apply(&settings, overlay)+ ApplyCompat(&settings, overlay)}- if raw := strings.TrimSpace(ref.Extra[ExtraScoreScale]); raw != "" {+ if raw := strings.TrimSpace(ref.Extra[models.ExtraScoreScale]); raw != "" {scale := api.ScoreScale(strings.ToLower(raw))if scale != api.ScoreProbability && scale != api.ScoreLogit {return nil, fmt.Errorf("catalog: invalid %s in extra_config: %q (expected %q or %q)",- ExtraScoreScale, raw, api.ScoreProbability, api.ScoreLogit,+ models.ExtraScoreScale, raw, api.ScoreProbability, api.ScoreLogit,)}settings.ScoreScale = scale}- if raw := strings.TrimSpace(ref.Extra[ExtraTruncatePromptTokens]); raw != "" {+ if raw := strings.TrimSpace(ref.Extra[models.ExtraTruncatePromptTokens]); raw != "" {if !settings.AcceptsTruncatePromptTokens {return nil, fmt.Errorf("catalog: %s is a vLLM extension and %s does not implement it; "+"remove it from extra_config (it is accepted by self-hosted runtimes only)",- ExtraTruncatePromptTokens, vendor.ID,+ models.ExtraTruncatePromptTokens, vendor.ID,)}budget, err := strconv.Atoi(raw)if err != nil || budget <= 0 {- return nil, fmt.Errorf("catalog: invalid %s in extra_config: %q", ExtraTruncatePromptTokens, raw)+ return nil, fmt.Errorf("catalog: invalid %s in extra_config: %q", models.ExtraTruncatePromptTokens, raw)}settings.TruncatePromptTokens = budget}// Checked after every layer: a model entry is what declares a dialect// this build cannot speak.if settings.UnsupportedReason != "" {- return nil, fmt.Errorf(- "catalog: %s does not serve %q through a protocol this build implements: %s",- vendor.ID, spec.ID, settings.UnsupportedReason,- )+ return nil, &UnsupportedModelError{Provider: vendor.ID, Model: spec.ID, Reason: settings.UnsupportedReason}}out := &Resolved{- Vendor: vendor,+ Vendor: configcopy.Clone(vendor.Definition),Spec: spec,Cataloged: cataloged,BaseURL: baseURL,@@ -467,7 +399,7 @@ func resolveRerank(RerankAPI: protocol,Rerank: settings,}- if override := strings.TrimSpace(ref.Extra[ExtraRemoteModelName]); override != "" {+ if override := strings.TrimSpace(ref.Extra[models.ExtraRemoteModelName]); override != "" {out.RemoteModel = override}return out, nil@@ -477,7 +409,7 @@ func resolveRerank(// resolveRerank: protocol default, vendor, model entry, row spec override,// then extra_config, which is the operator speaking about this one row.func resolveEmbeddings(- ref Ref, vendor *Vendor, spec ModelSpec, cataloged bool, baseURL string,+ ref Ref, vendor *Provider, spec models.ModelSpec, cataloged bool, baseURL string,) (*Resolved, error) {protocol := vendor.EmbeddingAPIif protocol == "" {@@ -487,21 +419,21 @@ func resolveEmbeddings(return nil, fmt.Errorf("catalog: unknown embedding api %q for provider %s", protocol, vendor.ID)}- settings := DefaultEmbeddings()- apply(&settings, &vendor.Compat.Embeddings)+ settings := api.DefaultEmbeddings()+ ApplyCompat(&settings, &vendor.Compat.Embeddings)if len(spec.Compat) > 0 {- overlay := &EmbeddingsCompat{}- if err := decodeCompat(spec.Compat, overlay); err != nil {+ overlay := &api.EmbeddingsCompat{}+ if err := DecodeCompat(spec.Compat, overlay); err != nil {return nil, fmt.Errorf("embeddings compat: %w", err)}- apply(&settings, overlay)+ ApplyCompat(&settings, overlay)}if raw := ref.Override.CompatJSON(); len(raw) > 0 {- overlay := &EmbeddingsCompat{}- if err := decodeCompat(raw, overlay); err != nil {+ overlay := &api.EmbeddingsCompat{}+ if err := DecodeCompat(raw, overlay); err != nil {return nil, fmt.Errorf("embeddings compat: %w", err)}- apply(&settings, overlay)+ ApplyCompat(&settings, overlay)}// The row may carry a truncation budget, but the extension is vLLM's and// appears in no managed vendor's schema. Dropping it where the vendor@@ -517,7 +449,7 @@ func resolveEmbeddings(if settings.AcceptsTruncatePromptTokens {settings.TruncatePromptTokens = ref.TruncatePromptTokensif settings.TruncatePromptTokens <= 0 {- settings.TruncatePromptTokens = LegacyTruncatePromptTokens+ settings.TruncatePromptTokens = models.LegacyTruncatePromptTokens}}@@ -532,7 +464,7 @@ func resolveEmbeddings(settings.API = protocolout := &Resolved{- Vendor: vendor,+ Vendor: configcopy.Clone(vendor.Definition),Spec: spec,Cataloged: cataloged,BaseURL: baseURL,@@ -540,7 +472,7 @@ func resolveEmbeddings(EmbeddingAPI: protocol,Embeddings: settings,}- if override := strings.TrimSpace(ref.Extra[ExtraRemoteModelName]); override != "" {+ if override := strings.TrimSpace(ref.Extra[models.ExtraRemoteModelName]); override != "" {out.RemoteModel = override}return out, nil@@ -550,23 +482,23 @@ func resolveEmbeddings(// as resolveEmbeddings: protocol default, vendor compat, the catalog entry,// the row's own compat, then remote_model_name.func resolveTranscriptions(- ref Ref, vendor *Vendor, spec ModelSpec, cataloged bool, baseURL string,+ ref Ref, vendor *Provider, spec models.ModelSpec, cataloged bool, baseURL string,) (*Resolved, error) {protocol := vendor.TranscriptionAPIif protocol == "" {protocol = api.TranscriptionOpenAI}- settings := DefaultTranscriptions()- apply(&settings, &vendor.Compat.Transcriptions)+ settings := api.DefaultTranscriptions()+ ApplyCompat(&settings, &vendor.Compat.Transcriptions)for _, raw := range []json.RawMessage{spec.Compat, ref.Override.CompatJSON()} {if len(raw) == 0 {continue}- overlay := &TranscriptionsCompat{}- if err := decodeCompat(raw, overlay); err != nil {+ overlay := &api.TranscriptionsCompat{}+ if err := DecodeCompat(raw, overlay); err != nil {return nil, fmt.Errorf("transcriptions compat: %w", err)}- apply(&settings, overlay)+ ApplyCompat(&settings, overlay)}if settings.API != "" {protocol = settings.API@@ -576,7 +508,7 @@ func resolveTranscriptions(}settings.API = protocolswitch settings.LanguageParam {- case "", LanguageForm, LanguageHeader, LanguageASROptions:+ case "", api.LanguageForm, api.LanguageHeader, api.LanguageASROptions:default:return nil, fmt.Errorf("catalog: unknown language_param %q for %s/%s",settings.LanguageParam, vendor.ID, spec.ID)@@ -584,14 +516,11 @@ func resolveTranscriptions(// Checked after every layer: an entry may lift a vendor-wide refusal for// the one model that takes the audio in the request.if settings.UnsupportedReason != "" {- return nil, fmt.Errorf(- "catalog: %s does not serve %q through a protocol this build implements: %s",- vendor.ID, spec.ID, settings.UnsupportedReason,- )+ return nil, &UnsupportedModelError{Provider: vendor.ID, Model: spec.ID, Reason: settings.UnsupportedReason}}out := &Resolved{- Vendor: vendor,+ Vendor: configcopy.Clone(vendor.Definition),Spec: spec,Cataloged: cataloged,BaseURL: baseURL,@@ -599,7 +528,7 @@ func resolveTranscriptions(TranscriptionAPI: protocol,Transcriptions: settings,}- if override := strings.TrimSpace(ref.Extra[ExtraRemoteModelName]); override != "" {+ if override := strings.TrimSpace(ref.Extra[models.ExtraRemoteModelName]); override != "" {out.RemoteModel = override}return out, nildiff --git a/internal/models/runtime/runtime.go b/internal/models/runtime/runtime.gonew file mode 100644index 000000000..97dfccff6--- /dev/null+++ b/internal/models/runtime/runtime.go@@ -0,0 +1,78 @@+// Package runtime resolves one model's effective settings and assembles its+// authenticated endpoint. Provider definitions and catalog metadata are shared;+// model credentials and connection settings are resolved independently per row.+package runtime++import (+ "errors"+ "fmt"+ "strings"++ "github.com/Tencent/WeKnora/internal/models"+ "github.com/Tencent/WeKnora/internal/models/providers"+)++// Initialize is the application composition entry point. A failed deployment+// overlay leaves the previous catalog generation untouched.+func Initialize(configDir string) error { return Default().Initialize(configDir) }++// Initialize loads and validates deployment configuration for this instance.+func (rt *Runtime) Initialize(configDir string) error {+ return rt.loadOverlayValidated(configDir, validateDefinition)+}++// Reload replaces the deployment overlay without retaining removed overrides.+func Reload(data []byte, baseDir string) error { return Default().Reload(data, baseDir) }++// Reload validates and publishes a replacement deployment overlay for this instance.+func (rt *Runtime) Reload(data []byte, baseDir string) error {+ return rt.applyOverlayValidated(data, baseDir, validateDefinition)+}++func validateDefinition(v *Provider) error {+ switch v.Auth {+ case providers.AuthBearer, providers.AuthAPIKeyHeader, providers.AuthXAPIKey,+ providers.AuthGoogleAPIKey, providers.AuthNone, providers.AuthSigned:+ default:+ return fmt.Errorf("unknown auth style %q", v.Auth)+ }+ for _, kind := range v.ModelTypes {+ _, err := resolveWithVendor(Ref{Provider: v.ID, Model: "custom-model", ModelType: kind}, v)+ var unsupported *UnsupportedModelError+ if err != nil && !errors.As(err, &unsupported) {+ return err+ }+ }+ for _, entry := range v.Models() {+ name := entry.ID+ if name == "" {+ name = strings.ReplaceAll(entry.Match, "*", "snapshot")+ }+ _, err := resolveWithVendor(Ref{Provider: v.ID, Model: name, ModelType: entry.Type}, v)+ // Unsupported entries deliberately remain as tombstones for old rows; they+ // are hidden from pickers and must continue to produce a useful error.+ var unsupported *UnsupportedModelError+ if err != nil && (!errors.As(err, &unsupported) || (!entry.Deprecated && entry.ID != "")) {+ return err+ }+ if entry.ContextWindow < 0 || entry.MaxOutputTokens < 0 || entry.Dimension < 0 {+ return fmt.Errorf("model %s: negative model limit", name)+ }+ if _, valid := models.ParseModelType(string(entry.Type)); entry.Type != "" && !valid {+ return fmt.Errorf("model %s: unsupported type %q", name, entry.Type)+ }+ }+ return nil+}++// UnsupportedModelError records an intentional refusal for an unimplemented API.+type UnsupportedModelError struct{ Provider, Model, Reason string }++func (e *UnsupportedModelError) Error() string {+ return fmt.Sprintf(+ "catalog: %s does not serve %q through a protocol this build implements: %s",+ e.Provider,+ e.Model,+ e.Reason,+ )+}diff --git a/internal/models/runtime/snapshot.go b/internal/models/runtime/snapshot.gonew file mode 100644index 000000000..b90c1591d--- /dev/null+++ b/internal/models/runtime/snapshot.go@@ -0,0 +1,28 @@+package runtime++// Snapshot captures provider definitions and their model catalogs together.+// It also retains the built-in baseline used when replacing deployment overrides.+type Snapshot struct {+ current map[string]*Provider+ base map[string]*Provider+}++// SnapshotCurrent retains the current generation and its built-in baseline.+func (rt *Runtime) SnapshotCurrent() Snapshot {+ rt.mu.RLock()+ defer rt.mu.RUnlock()+ return Snapshot{cloneProviders(rt.providers), cloneProviders(rt.builtins)}+}++// RestoreSnapshot restores an owned copy for rollback or isolated tests.+func (rt *Runtime) RestoreSnapshot(s Snapshot) {+ rt.mu.Lock()+ defer rt.mu.Unlock()+ rt.providers, rt.builtins = cloneProviders(s.current), cloneProviders(s.base)+}++// SnapshotCurrent captures the default runtime for rollback or isolated tests.+func SnapshotCurrent() Snapshot { return Default().SnapshotCurrent() }++// RestoreSnapshot restores the default runtime.+func RestoreSnapshot(s Snapshot) { Default().RestoreSnapshot(s) }diff --git a/internal/models/catalog/validate.go b/internal/models/runtime/validate.gosimilarity index 94%rename from internal/models/catalog/validate.gorename to internal/models/runtime/validate.goindex 5955ae8e8..078ab4555 100644--- a/internal/models/catalog/validate.go+++ b/internal/models/runtime/validate.go@@ -1,4 +1,4 @@-package catalog+package runtimeimport ("fmt"@@ -14,7 +14,7 @@ import (// protocol, a bad compat key or an invalid thinking level is rejected where// it is written instead of surfacing as a failed chat call much later.//-// Every model type is checked: all of them are built from catalog.Resolve,+// Every model type is checked: all of them are built from runtime.Resolve,// so a row that does not resolve cannot be used and should fail the save// rather than the first call.func ValidateRow(modelName string, modelType types.ModelType, params *types.ModelParameters) error {diff --git a/internal/models/catalog/validate_test.go b/internal/models/runtime/validate_test.gosimilarity index 94%rename from internal/models/catalog/validate_test.gorename to internal/models/runtime/validate_test.goindex 68034a967..6c6fa3e6e 100644--- a/internal/models/catalog/validate_test.go+++ b/internal/models/runtime/validate_test.go@@ -1,10 +1,9 @@-package catalog_test+package runtime_testimport ("testing"- "github.com/Tencent/WeKnora/internal/models/catalog"- _ "github.com/Tencent/WeKnora/internal/models/vendors"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/types")@@ -102,7 +101,7 @@ func TestValidateRow(t *testing.T) {}for _, tc := range cases {t.Run(tc.name, func(t *testing.T) {- err := catalog.ValidateRow(tc.modelName, tc.modelType, tc.params)+ err := modelruntime.ValidateRow(tc.modelName, tc.modelType, tc.params)if tc.wantErr && err == nil {t.Fatalf("expected an error, got nil")}diff --git a/internal/models/vendors/aliyun/models.json b/internal/models/vendors/aliyun/models.jsondeleted file mode 100644index fd06a04dd..000000000--- a/internal/models/vendors/aliyun/models.json+++ /dev/null@@ -1,62 +0,0 @@-{- "vendor": "aliyun",- "source": "https://help.aliyun.com/zh/model-studio/deep-thinking",- "models": [- {"name": "Qwen3 family (hybrid thinking)", "match": "qwen3*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "Qwen3.5 family (hybrid thinking)", "match": "qwen3.5*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "Qwen3.6 family (hybrid thinking)", "match": "qwen3.6*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "Qwen3.7 family (hybrid thinking)", "match": "qwen3.7*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "Qwen3.8 family (hybrid thinking)", "match": "qwen3.8*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},- {"name": "qwen-plus family (hybrid thinking)", "match": "qwen-plus*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "qwen-max family (hybrid thinking)", "match": "qwen-max*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "qwen-turbo family (hybrid thinking)", "match": "qwen-turbo*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "qwen-flash family (hybrid thinking)", "match": "qwen-flash*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "DeepSeek V3 family on DashScope (hybrid thinking)", "match": "deepseek-v3*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "DeepSeek V4 family on DashScope (hybrid thinking)", "match": "deepseek-v4*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "Kimi K2 family on DashScope (hybrid thinking)", "match": "kimi-k2*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"name": "GLM-5 family on DashScope (hybrid thinking)", "match": "glm-5*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},-- {"id": "qwen3.8-max", "name": "Qwen3.8 Max", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.77744, "output": 5.33231, "cache_read": 0.22218, "cache_write": 2.22179}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "qwen3.8-flash", "name": "Qwen3.8 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.11875, "output": 0.40073, "cache_read": 0.01187, "cache_write": 0.14844}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "qwen3.7-max", "name": "Qwen3.7 Max", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 2.5, "output": 7.5, "cache_read": 0.5, "cache_write": 3.125}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.7-plus", "name": "Qwen3.7 Plus", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 64000, "cost": {"input": 0.5, "output": 3, "cache_read": 0.05, "cache_write": 0.625}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.7-flash", "name": "Qwen3.7 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.02962, "output": 0.1185, "cache_read": 0.002962, "cache_write": 0.03703}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.6-plus", "name": "Qwen3.6 Plus", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.5, "output": 3, "cache_read": 0.05, "cache_write": 0.625}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.6-flash", "name": "Qwen3.6 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.1875, "output": 1.125, "cache_write": 0.234375}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.5-plus", "name": "Qwen3.5 Plus", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.287, "output": 1.722}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3.5-flash", "name": "Qwen3.5 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.172, "output": 1.033}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3-max", "name": "Qwen3 Max", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 1.291, "output": 7.749}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen3-vl-plus", "name": "Qwen3 VL Plus", "reasoning": true, "input": ["text", "image"], "context_window": 262144, "max_output_tokens": 32768, "cost": {"input": 0.143353, "output": 1.433525}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen-plus", "name": "Qwen Plus", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 32768, "cost": {"input": 0.115, "output": 0.287, "cache_read": 0.012, "cache_write": 0.144}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen-max", "name": "Qwen Max", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 8192, "cost": {"input": 0.345, "output": 1.377}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen-turbo", "name": "Qwen Turbo", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 16384, "cost": {"input": 0.044, "output": 0.087}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen-flash", "name": "Qwen Flash", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 32768, "cost": {"input": 0.022, "output": 0.216}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "qwen-vl-max", "name": "Qwen VL Max", "reasoning": false, "input": ["text", "image"], "context_window": 131072, "max_output_tokens": 8192, "cost": {"input": 0.23, "output": 0.574}},- {"id": "qwen-vl-plus", "name": "Qwen VL Plus", "reasoning": false, "input": ["text", "image"], "context_window": 131072, "max_output_tokens": 8192, "cost": {"input": 0.115, "output": 0.287}},- {"id": "qwq-plus", "name": "QwQ Plus", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 8192, "cost": {"input": 0.23, "output": 0.574}, "thinking_levels": {"off": null}, "source": "https://help.aliyun.com/zh/model-studio/deep-thinking"},- {"id": "qwq-32b", "name": "QwQ 32B", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 8192, "cost": {"input": 0.287, "output": 0.861}, "thinking_levels": {"off": null}},- {"id": "deepseek-v4-pro", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 393216, "cost": {"input": 0.435, "output": 0.87, "cache_read": 0.003625}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"},- {"id": "deepseek-v4-flash", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 393216, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.0028}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"},- {"id": "deepseek-r1", "name": "DeepSeek R1", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 16384, "cost": {"input": 0.574, "output": 2.294}, "thinking_levels": {"off": null}, "source": "https://help.aliyun.com/zh/model-studio/deepseek-api"},- {"id": "kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image"], "context_window": 1048576, "max_output_tokens": 1048576, "cost": {"input": 2.827, "output": 14.133, "cache_read": 0.283}, "thinking_levels": {"off": null}},- {"id": "kimi-k2.6", "name": "Kimi K2.6", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 16384, "cost": {"input": 0.929, "output": 3.858}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},- {"id": "glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.1, "output": 3.851, "cache_read": 0.275}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3"},-- {"id": "qwen3.7-text-embedding", "name": "Qwen3.7 Text Embedding", "type": "Embedding", "dimension": 1024, "compat": {"max_batch_size": 20}, "source": "https://help.aliyun.com/zh/model-studio/embedding"},- {"id": "qwen3.7-text-embedding-flash", "name": "Qwen3.7 Text Embedding Flash", "type": "Embedding", "dimension": 1024, "compat": {"max_batch_size": 20}, "source": "https://help.aliyun.com/zh/model-studio/embedding"},- {"id": "text-embedding-v4", "name": "Tongyi text-embedding-v4", "type": "Embedding", "dimension": 1024, "compat": {"max_batch_size": 10}, "source": "https://help.aliyun.com/zh/model-studio/embedding"},- {"id": "text-embedding-v3", "name": "Tongyi text-embedding-v3", "type": "Embedding", "dimension": 1024, "compat": {"max_batch_size": 10}, "source": "https://help.aliyun.com/zh/model-studio/embedding"},- {"name": "text-embedding-v2 (fixed 1536 dimensions)", "match": "text-embedding-v2", "type": "Embedding", "compat": {"dimensions_field": "", "max_batch_size": 25}, "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai"},- {"name": "text-embedding-v1 (fixed 1536 dimensions)", "match": "text-embedding-v1", "type": "Embedding", "compat": {"dimensions_field": "", "max_batch_size": 25}, "source": "https://help.aliyun.com/zh/model-studio/embedding-interfaces-compatible-with-openai"},- {"id": "tongyi-embedding-vision-plus", "name": "Tongyi Embedding Vision Plus", "type": "Embedding", "dimension": 1152, "compat": {"api": "dashscope-embeddings", "dimensions_field": ""}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"name": "tongyi-embedding-vision-flash (fixed 768 dimensions)", "match": "tongyi-embedding-vision-flash", "type": "Embedding", "compat": {"api": "dashscope-embeddings", "dimensions_field": ""}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"name": "tongyi-embedding-vision snapshots", "match": "tongyi-embedding-vision*", "type": "Embedding", "compat": {"api": "dashscope-embeddings", "dimensions_field": "dimension", "max_batch_size": 20}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"name": "qwen3-vl-embedding (independent vectors by default)", "match": "qwen3-vl-embedding*", "type": "Embedding", "compat": {"api": "dashscope-embeddings", "dimensions_field": "dimension", "max_batch_size": 20}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"name": "qwen2.5-vl-embedding (fused vectors only)", "match": "qwen2.5-vl-embedding*", "type": "Embedding", "compat": {"api": "dashscope-embeddings", "dimensions_field": "dimension", "max_batch_size": 1}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"name": "multimodal-embedding-v1", "match": "multimodal-embedding*", "type": "Embedding", "compat": {"api": "dashscope-embeddings", "dimensions_field": "", "max_batch_size": 20}, "source": "https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference"},- {"id": "qwen3-rerank", "name": "Qwen3 Rerank (separate endpoint, not implemented)", "type": "Rerank", "deprecated": true, "compat": {"unsupported_reason": "qwen3-rerank speaks a different protocol (/compatible-api/v1/reranks, flat request, results at the top level) that no protocol package implements yet"}, "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"},- {"id": "gte-rerank-v2", "name": "GTE Rerank v2", "type": "Rerank", "source": "https://help.aliyun.com/zh/model-studio/text-rerank-api"},- {"id": "qwen3-asr-flash", "name": "Qwen3 ASR Flash", "type": "ASR", "compat": {"api": "openai-chat-audio", "max_encoded_bytes": 10485760, "language_param": "asr_options"}, "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference"},- {"name": "Other Alibaba recognition models (not callable with the audio in the request)", "match": "*", "type": "ASR", "compat": {"unsupported_reason": "Alibaba's other recognition models take a public file URL or run as asynchronous tasks; only qwen3-asr-flash accepts the audio in the request"}, "source": "https://help.aliyun.com/zh/model-studio/qwen-asr-api-reference"}- ]-}diff --git a/internal/models/vendors/all.go b/internal/models/vendors/all.godeleted file mode 100644index 2fa77dc76..000000000--- a/internal/models/vendors/all.go+++ /dev/null@@ -1,35 +0,0 @@-// Package vendors links every built-in vendor package so their init-// functions register with the catalog. Import it for side effects from the-// binary's entry point (and from tests that need the full catalog).-package vendors--import (- // Each vendor registers itself with the catalog in init.- _ "github.com/Tencent/WeKnora/internal/models/vendors/aliyun"- _ "github.com/Tencent/WeKnora/internal/models/vendors/anthropic"- _ "github.com/Tencent/WeKnora/internal/models/vendors/azure_openai"- _ "github.com/Tencent/WeKnora/internal/models/vendors/deepseek"- _ "github.com/Tencent/WeKnora/internal/models/vendors/gemini"- _ "github.com/Tencent/WeKnora/internal/models/vendors/generic"- _ "github.com/Tencent/WeKnora/internal/models/vendors/gpustack"- _ "github.com/Tencent/WeKnora/internal/models/vendors/hunyuan"- _ "github.com/Tencent/WeKnora/internal/models/vendors/jina"- _ "github.com/Tencent/WeKnora/internal/models/vendors/litellm"- _ "github.com/Tencent/WeKnora/internal/models/vendors/lkeap"- _ "github.com/Tencent/WeKnora/internal/models/vendors/longcat"- _ "github.com/Tencent/WeKnora/internal/models/vendors/mimo"- _ "github.com/Tencent/WeKnora/internal/models/vendors/minimax"- _ "github.com/Tencent/WeKnora/internal/models/vendors/modelscope"- _ "github.com/Tencent/WeKnora/internal/models/vendors/moonshot"- _ "github.com/Tencent/WeKnora/internal/models/vendors/novita"- _ "github.com/Tencent/WeKnora/internal/models/vendors/nvidia"- _ "github.com/Tencent/WeKnora/internal/models/vendors/openai"- _ "github.com/Tencent/WeKnora/internal/models/vendors/openrouter"- _ "github.com/Tencent/WeKnora/internal/models/vendors/qianfan"- _ "github.com/Tencent/WeKnora/internal/models/vendors/qiniu"- _ "github.com/Tencent/WeKnora/internal/models/vendors/requesty"- _ "github.com/Tencent/WeKnora/internal/models/vendors/siliconflow"- _ "github.com/Tencent/WeKnora/internal/models/vendors/volcengine"- _ "github.com/Tencent/WeKnora/internal/models/vendors/weknoracloud"- _ "github.com/Tencent/WeKnora/internal/models/vendors/zhipu"-)diff --git a/internal/models/vendors/anthropic/models.json b/internal/models/vendors/anthropic/models.jsondeleted file mode 100644index e1e684f23..000000000--- a/internal/models/vendors/anthropic/models.json+++ /dev/null@@ -1,17 +0,0 @@-{- "vendor": "anthropic",- "source": "https://docs.anthropic.com/en/docs/about-claude/models",- "models": [- {"id": "claude-fable-5-1", "name": "Claude Fable 5.1", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 10, "output": 50, "cache_read": 0.25, "cache_write": 12.5}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-opus-5", "name": "Claude Opus 5", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models", "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-sonnet-5", "name": "Claude Sonnet 5", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 2, "output": 10, "cache_read": 0.2, "cache_write": 2.5}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-fable-5", "name": "Claude Fable 5", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 10, "output": 50, "cache_read": 1, "cache_write": 12.5}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-opus-4-8", "name": "Claude Opus 4.8", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models", "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-opus-4-7", "name": "Claude Opus 4.7", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "source": "https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models", "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max"}},- {"id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 3, "output": 15, "cache_read": 0.3, "cache_write": 3.75}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "claude-opus-4-6", "name": "Claude Opus 4.6", "api": "anthropic-messages", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"thinking_mode": "adaptive", "supports_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "claude-opus-4-5", "name": "Claude Opus 4.5", "api": "anthropic-messages", "aliases": ["claude-opus-4-5-20251101"], "reasoning": true, "input": ["text", "image"], "context_window": 200000, "max_output_tokens": 64000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"supports_effort": true}, "source": "https://platform.claude.com/docs/en/build-with-claude/effort"},- {"id": "claude-sonnet-4-5", "name": "Claude Sonnet 4.5", "api": "anthropic-messages", "aliases": ["claude-sonnet-4-5-20250929"], "reasoning": true, "input": ["text", "image"], "context_window": 200000, "max_output_tokens": 64000, "cost": {"input": 3, "output": 15, "cache_read": 0.3, "cache_write": 3.75}, "source": "https://platform.claude.com/docs/en/models/sonnet-4-5/overview"},- {"id": "claude-haiku-4-5", "name": "Claude Haiku 4.5", "api": "anthropic-messages", "aliases": ["claude-haiku-4-5-20251001"], "reasoning": true, "input": ["text", "image"], "context_window": 200000, "max_output_tokens": 64000, "cost": {"input": 1, "output": 5, "cache_read": 0.1, "cache_write": 1.25}}- ]-}diff --git a/internal/models/vendors/azure_openai/models.json b/internal/models/vendors/azure_openai/models.jsondeleted file mode 100644index b21cd60f4..000000000--- a/internal/models/vendors/azure_openai/models.json+++ /dev/null@@ -1,17 +0,0 @@-{- "vendor": "azure_openai",- "source": "https://learn.microsoft.com/azure/ai-foundry/openai/how-to/reasoning",- "models": [- {"name": "GPT-6 deployments (reasoning, thinking always on)", "match": "gpt-6*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"name": "GPT-5 deployments (reasoning, no sampling parameters)", "match": "gpt-5*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low"}},- {"id": "gpt-5", "name": "GPT-5 deployment (thinking cannot be disabled)", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}, "source": "https://developers.openai.com/api/docs/models/gpt-5"},- {"id": "gpt-5-mini", "name": "GPT-5 Mini deployment (thinking cannot be disabled)", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}, "source": "https://developers.openai.com/api/docs/models/gpt-5-mini"},- {"id": "gpt-5-nano", "name": "GPT-5 Nano deployment (thinking cannot be disabled)", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}, "source": "https://developers.openai.com/api/docs/models/gpt-5-nano"},- {"name": "o1 deployments (always-on reasoning)", "match": "o1*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"name": "o3 deployments (always-on reasoning)", "match": "o3*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"name": "o4 deployments (always-on reasoning)", "match": "o4*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"name": "GPT-4o deployments", "match": "gpt-4o*", "reasoning": false, "input": ["text", "image"]},- {"name": "GPT-4.1 deployments", "match": "gpt-4.1*", "reasoning": false, "input": ["text", "image"]},- {"name": "text-embedding-3 deployments", "match": "text-embedding-3*", "type": "Embedding"}- ]-}diff --git a/internal/models/vendors/deepseek/models.json b/internal/models/vendors/deepseek/models.jsondeleted file mode 100644index bb92aabd3..000000000--- a/internal/models/vendors/deepseek/models.json+++ /dev/null@@ -1,59 +0,0 @@-{- "vendor": "deepseek",- "source": "https://api-docs.deepseek.com/quick_start/pricing",- "models": [- {- "id": "deepseek-v4-pro",- "name": "DeepSeek V4 Pro",- "reasoning": true,- "input": ["text"],- "context_window": 1000000,- "max_output_tokens": 384000,- "cost": {"input": 0.66, "output": 1.98, "cache_read": 0.022},- "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"},- "source": "https://api-docs.deepseek.com/quick_start/pricing"- },- {- "id": "deepseek-flash",- "name": "DeepSeek V4.1 Flash",- "reasoning": true,- "input": ["text", "image"],- "context_window": 1000000,- "max_output_tokens": 384000,- "cost": {"input": 0.15, "output": 0.6, "cache_read": 0.003},- "source": "https://api-docs.deepseek.com/quick_start/pricing"- },- {- "id": "deepseek-v4-flash",- "name": "DeepSeek V4 Flash (retired name, served by V4.1 Flash)",- "deprecated": true,- "reasoning": true,- "input": ["text", "image"],- "context_window": 1000000,- "max_output_tokens": 384000,- "cost": {"input": 0.15, "output": 0.6, "cache_read": 0.003},- "source": "https://api-docs.deepseek.com/quick_start/pricing"- },- {- "id": "deepseek-chat",- "name": "DeepSeek Chat (retired 2026-07-24, non-thinking alias)",- "deprecated": true,- "reasoning": false,- "input": ["text"],- "context_window": 128000,- "max_output_tokens": 8192,- "source": "https://api-docs.deepseek.com/news/news260424/"- },- {- "id": "deepseek-reasoner",- "name": "DeepSeek Reasoner (retired 2026-07-24, thinking alias)",- "deprecated": true,- "reasoning": true,- "input": ["text"],- "context_window": 128000,- "max_output_tokens": 65536,- "thinking_levels": {"off": null},- "source": "https://api-docs.deepseek.com/news/news260424/"- }- ]-}diff --git a/internal/models/vendors/gemini/models.json b/internal/models/vendors/gemini/models.jsondeleted file mode 100644index 028129309..000000000--- a/internal/models/vendors/gemini/models.json+++ /dev/null@@ -1,20 +0,0 @@-{- "vendor": "gemini",- "source": "https://ai.google.dev/gemini-api/docs/thinking",- "models": [- {"name": "Gemini 3 family (thinkingLevel)", "match": "gemini-3*", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.8-flash", "name": "Gemini 3.8 Flash", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.75, "output": 3.75, "cache_read": 0.075}, "compat": {"thinking_mode": "level"}, "source": "https://ai.google.dev/gemini-api/docs/thinking", "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.7-flash", "name": "Gemini 3.7 Flash", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.75, "output": 3.75, "cache_read": 0.075}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.6-flash", "name": "Gemini 3.6 Flash", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.75, "output": 3.75, "cache_read": 0.075}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.5-flash", "name": "Gemini 3.5 Flash", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 1.5, "output": 9, "cache_read": 0.15}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.5-flash-lite", "name": "Gemini 3.5 Flash Lite", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.3, "output": 2.5, "cache_read": 0.03}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro Preview", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 2, "output": 12, "cache_read": 0.2}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3.1-flash-lite", "name": "Gemini 3.1 Flash Lite", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.25, "output": 1.5, "cache_read": 0.025}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-3-flash-preview", "name": "Gemini 3 Flash Preview", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.5, "output": 3, "cache_read": 0.05}, "compat": {"thinking_mode": "level"}, "thinking_levels": {"off": null, "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}},- {"id": "gemini-2.5-pro", "name": "Gemini 2.5 Pro", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 1.25, "output": 10, "cache_read": 0.125}, "compat": {"thinking_mode": "budget"}, "thinking_levels": {"off": null}},- {"id": "gemini-2.5-flash", "name": "Gemini 2.5 Flash", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.3, "output": 2.5, "cache_read": 0.03}, "compat": {"thinking_mode": "budget"}},- {"id": "gemini-2.5-flash-lite", "name": "Gemini 2.5 Flash Lite", "api": "google-generative-ai", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.1, "output": 0.4, "cache_read": 0.01}, "compat": {"thinking_mode": "budget"}},- {"id": "gemini-embedding-001", "name": "Gemini Embedding 001", "type": "Embedding", "dimension": 3072, "context_window": 2048, "cost": {"input": 0.15, "output": 0}, "source": "https://ai.google.dev/gemini-api/docs/embeddings"},- {"id": "gemini-embedding-2", "name": "Gemini Embedding 2", "aliases": ["gemini-embedding-2-preview"], "type": "Embedding", "input": ["text", "image", "audio", "video"], "dimension": 3072, "context_window": 8192, "cost": {"input": 0.2, "output": 0}, "source": "https://ai.google.dev/gemini-api/docs/embeddings"}- ]-}diff --git a/internal/models/vendors/generic/models.json b/internal/models/vendors/generic/models.jsondeleted file mode 100644index 172c361b5..000000000--- a/internal/models/vendors/generic/models.json+++ /dev/null@@ -1,29 +0,0 @@-{- "vendor": "generic",- "source": "https://platform.openai.com/docs/guides/reasoning",- "models": [- {- "match": "gpt-5*",- "reasoning": true,- "compat": {"max_tokens_field": "max_completion_tokens", "supports_temperature": false, "thinking_format": "openai", "supports_reasoning_effort": true}- },- {- "match": "o1*",- "reasoning": true,- "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"},- "compat": {"max_tokens_field": "max_completion_tokens", "supports_temperature": false, "thinking_format": "openai", "supports_reasoning_effort": true}- },- {- "match": "o3*",- "reasoning": true,- "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"},- "compat": {"max_tokens_field": "max_completion_tokens", "supports_temperature": false, "thinking_format": "openai", "supports_reasoning_effort": true}- },- {- "match": "o4*",- "reasoning": true,- "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"},- "compat": {"max_tokens_field": "max_completion_tokens", "supports_temperature": false, "thinking_format": "openai", "supports_reasoning_effort": true}- }- ]-}diff --git a/internal/models/vendors/gpustack/models.json b/internal/models/vendors/gpustack/models.jsondeleted file mode 100644index 937a43280..000000000--- a/internal/models/vendors/gpustack/models.json+++ /dev/null@@ -1,4 +0,0 @@-{- "vendor": "gpustack",- "models": []-}diff --git a/internal/models/vendors/hunyuan/models.json b/internal/models/vendors/hunyuan/models.jsondeleted file mode 100644index e41bcf76a..000000000--- a/internal/models/vendors/hunyuan/models.json+++ /dev/null@@ -1,18 +0,0 @@-{- "vendor": "hunyuan",- "source": "https://cloud.tencent.com/document/product/1729/104753",- "models": [- {"name": "Hunyuan T1 family (always-on reasoning)", "match": "hunyuan-t1*", "reasoning": true, "input": ["text"], "thinking_levels": {"off": null}},- {"id": "hunyuan-t1-latest", "name": "Hunyuan T1", "reasoning": true, "input": ["text"], "context_window": 32000, "thinking_levels": {"off": null}},- {"id": "hunyuan-t1-vision-20250916", "name": "Hunyuan T1 Vision (deep thinking)", "reasoning": true, "input": ["text", "image"], "context_window": 28000, "max_output_tokens": 20000, "thinking_levels": {"off": null}, "source": "https://cloud.tencent.com/document/product/1729/104753"},- {"id": "hunyuan-turbos-latest", "name": "Hunyuan TurboS", "reasoning": false, "input": ["text"], "context_window": 32000, "max_output_tokens": 8000, "cost": {"input": 0.11, "output": 0.28}},- {"id": "hunyuan-a13b", "name": "Hunyuan A13B (hybrid thinking)", "reasoning": true, "input": ["text"], "context_window": 224000, "max_output_tokens": 32000, "source": "https://cloud.tencent.com/document/product/1729/104753"},- {"id": "hunyuan-2.0-thinking-20251109", "name": "Hunyuan 2.0 Thinking", "reasoning": true, "input": ["text"], "source": "https://cloud.tencent.com/document/product/1729/127293"},- {"id": "hunyuan-2.0-instruct-20251111", "name": "Hunyuan 2.0 Instruct", "reasoning": false, "input": ["text"], "source": "https://cloud.tencent.com/document/product/1729/127293"},- {"id": "hunyuan-vision-1.5-instruct", "name": "Hunyuan Vision 1.5 Instruct (fast thinking)", "reasoning": false, "input": ["text", "image"], "context_window": 24000, "max_output_tokens": 16000, "source": "https://cloud.tencent.com/document/product/1729/104753"},- {"id": "hunyuan-turbos-vision-video", "name": "Hunyuan TurboS Vision Video", "reasoning": false, "input": ["text", "image", "video"], "context_window": 24000, "max_output_tokens": 8000, "source": "https://cloud.tencent.com/document/product/1729/104753"},- {"id": "hunyuan-turbos-vision", "name": "Hunyuan TurboS Vision", "reasoning": false, "input": ["text", "image"], "context_window": 32000, "max_output_tokens": 8000},- {"id": "hunyuan-lite", "name": "Hunyuan Lite", "reasoning": false, "input": ["text"], "context_window": 256000, "max_output_tokens": 6000, "cost": {"input": 0, "output": 0}},- {"id": "hunyuan-embedding", "name": "Hunyuan Embedding", "type": "Embedding", "dimension": 1024, "source": "https://cloud.tencent.com/document/product/1729/111007"}- ]-}diff --git a/internal/models/vendors/jina/models.json b/internal/models/vendors/jina/models.jsondeleted file mode 100644index 2f41475ba..000000000--- a/internal/models/vendors/jina/models.json+++ /dev/null@@ -1,18 +0,0 @@-{- "vendor": "jina",- "source": "https://jina.ai/models/",- "models": [- {"id": "jina-embeddings-v5-omni-small", "name": "Jina Embeddings v5 Omni Small (multimodal)", "type": "Embedding", "input": ["text", "image"], "dimension": 1024, "context_window": 32768},- {"id": "jina-embeddings-v5-omni-nano", "name": "Jina Embeddings v5 Omni Nano (multimodal)", "type": "Embedding", "input": ["text", "image"], "dimension": 768, "context_window": 8192},- {"id": "jina-embeddings-v5-text-small", "name": "Jina Embeddings v5 Text Small", "type": "Embedding", "dimension": 1024, "context_window": 32768},- {"id": "jina-embeddings-v5-text-nano", "name": "Jina Embeddings v5 Text Nano", "type": "Embedding", "dimension": 768, "context_window": 8192},- {"id": "jina-embeddings-v4", "name": "Jina Embeddings v4", "type": "Embedding", "dimension": 2048, "context_window": 32768, "source": "https://jina.ai/models/jina-embeddings-v4/"},- {"id": "jina-embeddings-v3", "name": "Jina Embeddings v3", "type": "Embedding", "dimension": 1024, "context_window": 8192, "source": "https://jina.ai/models/jina-embeddings-v3/"},- {"id": "jina-code-embeddings-1.5b", "name": "Jina Code Embeddings 1.5B", "type": "Embedding", "dimension": 1536, "context_window": 32768},- {"id": "jina-code-embeddings-0.5b", "name": "Jina Code Embeddings 0.5B", "type": "Embedding", "dimension": 896, "context_window": 32768},- {"id": "jina-reranker-v3.5", "name": "Jina Reranker v3.5", "type": "Rerank", "context_window": 131072, "source": "https://jina.ai/reranker/"},- {"id": "jina-reranker-v3", "name": "Jina Reranker v3", "type": "Rerank", "context_window": 131072, "source": "https://jina.ai/models/jina-reranker-v3/"},- {"id": "jina-reranker-m0", "name": "Jina Reranker m0 (multimodal)", "type": "Rerank", "context_window": 10000, "source": "https://jina.ai/reranker/"},- {"id": "jina-reranker-v2-base-multilingual", "name": "Jina Reranker v2 Base Multilingual", "type": "Rerank", "context_window": 1024, "source": "https://jina.ai/reranker/"}- ]-}diff --git a/internal/models/vendors/litellm/models.json b/internal/models/vendors/litellm/models.jsondeleted file mode 100644index 4d95c662e..000000000--- a/internal/models/vendors/litellm/models.json+++ /dev/null@@ -1,4 +0,0 @@-{- "vendor": "litellm",- "models": []-}diff --git a/internal/models/vendors/lkeap/models.json b/internal/models/vendors/lkeap/models.jsondeleted file mode 100644index e511f4afe..000000000--- a/internal/models/vendors/lkeap/models.json+++ /dev/null@@ -1,16 +0,0 @@-{- "vendor": "lkeap",- "source": "https://cloud.tencent.com/document/product/1772/115963",- "models": [- {"name": "DeepSeek R1 family (always-on reasoning)", "match": "*deepseek-r1*", "reasoning": true, "input": ["text"], "thinking_levels": {"off": null}},- {"name": "DeepSeek V3 family (thinking switch)", "match": "*deepseek-v3*", "reasoning": true, "input": ["text"]},- {"id": "deepseek-v3.2", "name": "DeepSeek V3.2", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 32768, "source": "https://cloud.tencent.com/document/product/1772/115963"},- {"id": "deepseek-v3.1-terminus", "name": "DeepSeek V3.1 Terminus", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 32768, "source": "https://cloud.tencent.com/document/product/1772/115963"},- {"id": "deepseek-r1-0528", "name": "DeepSeek R1 (0528)", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 16384, "thinking_levels": {"off": null}, "source": "https://cloud.tencent.com/document/product/1772/115963"},- {"id": "deepseek-v3-0324", "name": "DeepSeek V3 (0324)", "reasoning": false, "input": ["text"], "context_window": 131072, "max_output_tokens": 16384, "source": "https://cloud.tencent.com/document/product/1772/115963"},- {"id": "deepseek-r1", "name": "DeepSeek R1", "reasoning": true, "input": ["text"], "context_window": 65536, "max_output_tokens": 16384, "thinking_levels": {"off": null}},- {"id": "deepseek-v3", "name": "DeepSeek V3", "reasoning": false, "input": ["text"], "context_window": 65536, "max_output_tokens": 16384},- {"id": "deepseek-v3.1", "name": "DeepSeek V3.1", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 32768},- {"id": "lke-reranker-base", "name": "LKE Reranker Base", "type": "Rerank", "source": "https://cloud.tencent.com/document/product/1772/115339"}- ]-}diff --git a/internal/models/vendors/longcat/models.json b/internal/models/vendors/longcat/models.jsondeleted file mode 100644index 7d28fcdc9..000000000--- a/internal/models/vendors/longcat/models.json+++ /dev/null@@ -1,9 +0,0 @@-{- "vendor": "longcat",- "source": "https://longcat.chat/platform/docs/zh/api/chat.html",- "models": [- {"id": "LongCat-2.0", "name": "LongCat 2.0", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.75, "output": 2.95, "cache_read": 0.015}, "source": "https://longcat.chat/platform/docs/zh/api/chat.html"},- {"id": "LongCat-Flash-Chat", "name": "LongCat Flash Chat (retired 2026-05-29)", "deprecated": true, "reasoning": false, "input": ["text"], "context_window": 262144, "max_output_tokens": 8192, "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html"},- {"id": "LongCat-Flash-Thinking", "name": "LongCat Flash Thinking (retired 2026-05-29)", "deprecated": true, "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 65536, "thinking_levels": {"off": null}, "source": "https://longcat.chat/platform/docs/zh/ChangeLog.html"}- ]-}diff --git a/internal/models/vendors/mimo/models.json b/internal/models/vendors/mimo/models.jsondeleted file mode 100644index b2d86cd20..000000000--- a/internal/models/vendors/mimo/models.json+++ /dev/null@@ -1,11 +0,0 @@-{- "vendor": "mimo",- "source": "https://mimo.mi.com/static/docs/quick-start/summary/model.md",- "models": [- {"id": "mimo-v2.5-pro", "name": "MiMo V2.5 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0.435, "output": 0.87, "cache_read": 0.0036}, "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"},- {"id": "mimo-v2.5", "name": "MiMo V2.5", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.0028}, "source": "https://mimo.mi.com/static/docs/price/pay-as-you-go.md"},- {"id": "mimo-v2.5-pro-ultraspeed", "name": "MiMo V2.5 Pro Ultraspeed", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 1.305, "output": 2.61, "cache_read": 0.0108}, "source": "https://mimo.mi.com/static/docs/news/latest/beta-extended.md"},- {"id": "mimo-v2-flash", "name": "MiMo V2 Flash (retired 2026-06-30)", "reasoning": true, "input": ["text"], "context_window": 256000, "max_output_tokens": 256000, "cost": {"input": 0.1, "output": 0.3, "cache_read": 0.01}, "deprecated": true, "source": "https://mimo.mi.com/static/docs/updates/deprecate.md"},- {"id": "mimo-v2.5-asr", "name": "MiMo V2.5 ASR", "type": "ASR", "source": "https://mimo.mi.com/docs/en-US/quick-start/usage-guide/audio/Speech-Recognition"}- ]-}diff --git a/internal/models/vendors/minimax/models.json b/internal/models/vendors/minimax/models.jsondeleted file mode 100644index b518a6906..000000000--- a/internal/models/vendors/minimax/models.json+++ /dev/null@@ -1,15 +0,0 @@-{- "vendor": "minimax",- "source": "https://platform.minimax.io/docs/api-reference/text-openai-api",- "models": [- {"id": "MiniMax-M3", "name": "MiniMax M3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 512000, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.06}, "source": "https://platform.minimax.io/docs/guides/text-generation"},- {"id": "MiniMax-M2.7", "name": "MiniMax M2.7", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.06, "cache_write": 0.375}, "thinking_levels": {"off": null}},- {"id": "MiniMax-M2.7-highspeed", "name": "MiniMax M2.7 Highspeed", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.6, "output": 2.4, "cache_read": 0.06, "cache_write": 0.375}, "thinking_levels": {"off": null}},- {"id": "MiniMax-M2.5", "name": "MiniMax M2.5", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.03, "cache_write": 0.375}, "thinking_levels": {"off": null}},- {"id": "MiniMax-M2.5-highspeed", "name": "MiniMax M2.5 Highspeed", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.6, "output": 2.4, "cache_read": 0.06, "cache_write": 0.375}, "thinking_levels": {"off": null}},- {"id": "MiniMax-M2.1", "name": "MiniMax M2.1", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.03, "cache_write": 0.375}, "thinking_levels": {"off": null}},- {"id": "MiniMax-M2.1-highspeed", "name": "MiniMax M2.1 Highspeed", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "thinking_levels": {"off": null}, "source": "https://platform.minimax.io/docs/guides/text-generation"},- {"id": "MiniMax-M2", "name": "MiniMax M2", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.3, "output": 1.2}, "thinking_levels": {"off": null}},- {"id": "asr-1.0", "name": "MiniMax ASR 1.0", "type": "ASR", "source": "https://platform.minimax.io/docs/api-reference/speech-to-text"}- ]-}diff --git a/internal/models/vendors/modelscope/models.json b/internal/models/vendors/modelscope/models.jsondeleted file mode 100644index 8d46efc51..000000000--- a/internal/models/vendors/modelscope/models.json+++ /dev/null@@ -1,17 +0,0 @@-{- "vendor": "modelscope",- "source": "https://modelscope.cn/docs/model-service/API-Inference/intro",- "models": [- {"id": "ZhipuAI/GLM-4.6", "name": "GLM-4.6", "reasoning": true, "input": ["text"], "context_window": 202752, "max_output_tokens": 98304, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.6"},- {"id": "ZhipuAI/GLM-4.5", "name": "GLM-4.5", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 98304, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/ZhipuAI/GLM-4.5"},- {"id": "Qwen/Qwen3-235B-A22B-Instruct-2507", "name": "Qwen3 235B-A22B Instruct 2507", "reasoning": false, "input": ["text"], "context_window": 262144, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Instruct-2507"},- {"id": "Qwen/Qwen3-235B-A22B-Thinking-2507", "name": "Qwen3 235B-A22B Thinking 2507", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "thinking_levels": {"off": null}, "source": "https://modelscope.cn/models/Qwen/Qwen3-235B-A22B-Thinking-2507"},- {"id": "Qwen/Qwen3-30B-A3B-Instruct-2507", "name": "Qwen3 30B-A3B Instruct 2507", "reasoning": false, "input": ["text"], "context_window": 262144, "max_output_tokens": 16384, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Instruct-2507"},- {"id": "Qwen/Qwen3-30B-A3B-Thinking-2507", "name": "Qwen3 30B-A3B Thinking 2507", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 32768, "cost": {"input": 0, "output": 0}, "thinking_levels": {"off": null}, "source": "https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Thinking-2507"},- {"id": "Qwen/Qwen3-Coder-30B-A3B-Instruct", "name": "Qwen3 Coder 30B-A3B Instruct", "reasoning": false, "input": ["text"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/Qwen/Qwen3-Coder-30B-A3B-Instruct"},- {"id": "Qwen/Qwen3-8B", "name": "Qwen3 8B (hybrid thinking)", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 32768, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/Qwen/Qwen3-8B"},- {"id": "Qwen/Qwen3-VL-235B-A22B-Instruct", "name": "Qwen3 VL 235B-A22B Instruct", "reasoning": false, "input": ["text", "image"], "context_window": 262144, "max_output_tokens": 32768, "cost": {"input": 0, "output": 0}, "source": "https://modelscope.cn/models/Qwen/Qwen3-VL-235B-A22B-Instruct"},- {"id": "Qwen/Qwen3-Embedding-8B", "name": "Qwen3 Embedding 8B", "type": "Embedding", "dimension": 4096, "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-8B"},- {"id": "Qwen/Qwen3-Embedding-0.6B", "name": "Qwen3 Embedding 0.6B", "type": "Embedding", "dimension": 1024, "source": "https://modelscope.cn/models/Qwen/Qwen3-Embedding-0.6B"}- ]-}diff --git a/internal/models/vendors/moonshot/models.json b/internal/models/vendors/moonshot/models.jsondeleted file mode 100644index fc51010d8..000000000--- a/internal/models/vendors/moonshot/models.json+++ /dev/null@@ -1,19 +0,0 @@-{- "vendor": "moonshot",- "source": "https://platform.kimi.com/docs/api/models-overview",- "models": [- {"id": "kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 3, "output": 15, "cache_read": 0.3}, "compat": {"thinking_format": "openai", "supports_reasoning_effort": true, "supports_temperature": false, "tool_choice_modes": ["none", "auto", "required"]}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://platform.kimi.com/docs/guide/kimi-k3-quickstart"},- {"id": "kimi-k2.7-code", "name": "Kimi K2.7 Code", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0.95, "output": 4, "cache_read": 0.19}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null}, "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart"},- {"id": "kimi-k2.7-code-highspeed", "name": "Kimi K2.7 Code Highspeed", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 1.9, "output": 8, "cache_read": 0.38}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null}, "source": "https://platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart"},- {"id": "kimi-k2.6", "name": "Kimi K2.6", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0.95, "output": 4, "cache_read": 0.16}, "compat": {"supports_temperature": false}, "source": "https://platform.kimi.com/docs/guide/kimi-k2-6-quickstart"},-- {"name": "moonshot-v1 family (retired 2026-08-31)", "match": "moonshot-v1*", "reasoning": false, "input": ["text"], "deprecated": true, "compat": {"fixed_temperature": 1}, "source": "https://platform.kimi.com/docs/models"},- {"id": "kimi-k2.5", "name": "Kimi K2.5 (retired 2026-08-31)", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0.6, "output": 3, "cache_read": 0.1}, "deprecated": true, "compat": {"supports_temperature": false}, "source": "https://platform.kimi.com/docs/models"},- {"id": "kimi-k2-thinking", "name": "Kimi K2 Thinking (retired 2026-08-31)", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 16384, "cost": {"input": 0.574, "output": 2.294}, "deprecated": true, "thinking_levels": {"off": null}, "source": "https://platform.kimi.com/docs/models"},- {"id": "kimi-k2-turbo-preview", "name": "Kimi K2 Turbo (retired 2026-08-31)", "reasoning": false, "input": ["text"], "context_window": 262144, "max_output_tokens": 16384, "deprecated": true, "source": "https://platform.kimi.com/docs/models"},- {"id": "moonshot-v1-8k", "name": "Moonshot v1 8K (retired 2026-08-31)", "reasoning": false, "input": ["text"], "context_window": 8192, "max_output_tokens": 8192, "deprecated": true, "compat": {"fixed_temperature": 1}, "source": "https://platform.kimi.com/docs/models"},- {"id": "moonshot-v1-32k", "name": "Moonshot v1 32K (retired 2026-08-31)", "reasoning": false, "input": ["text"], "context_window": 32768, "max_output_tokens": 32768, "deprecated": true, "compat": {"fixed_temperature": 1}, "source": "https://platform.kimi.com/docs/models"},- {"id": "moonshot-v1-128k", "name": "Moonshot v1 128K (retired 2026-08-31)", "reasoning": false, "input": ["text"], "context_window": 131072, "max_output_tokens": 131072, "deprecated": true, "compat": {"fixed_temperature": 1}, "source": "https://platform.kimi.com/docs/models"},- {"id": "moonshot-v1-8k-vision-preview", "name": "Moonshot v1 8K Vision (retired 2026-08-31)", "reasoning": false, "input": ["text", "image"], "context_window": 8192, "max_output_tokens": 8192, "deprecated": true, "compat": {"fixed_temperature": 1}, "source": "https://platform.kimi.com/docs/models"}- ]-}diff --git a/internal/models/vendors/novita/models.json b/internal/models/vendors/novita/models.jsondeleted file mode 100644index fc924f41f..000000000--- a/internal/models/vendors/novita/models.json+++ /dev/null@@ -1,21 +0,0 @@-{- "vendor": "novita",- "source": "https://docs.novita.ai/api-reference/model-apis-llm-chat-completions-api",- "models": [- {"id": "moonshotai/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 1048576, "cost": {"input": 3, "output": 15, "cache_read": 0.3}},- {"id": "zai-org/glm-5.2", "name": "GLM-5.2", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}},- {"id": "zai-org/glm-5.1", "name": "GLM-5.1", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 1.38, "output": 4.4, "cache_read": 0.26}},- {"id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 1.6, "output": 3.2, "cache_read": 0.135}},- {"id": "deepseek/deepseek-v4-flash", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.028}},- {"id": "moonshotai/kimi-k2.6", "name": "Kimi K2.6", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0.8, "output": 3.4, "cache_read": 0.16}},- {"id": "moonshotai/kimi-k2.7-code", "name": "Kimi K2.7 Code", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0.95, "output": 4, "cache_read": 0.19}},- {"id": "qwen/qwen3.7-max", "name": "Qwen3.7 Max", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 1.25, "output": 3.75, "cache_read": 0.25, "cache_write": 1.5625}},- {"id": "qwen/qwen3.5-397b-a17b", "name": "Qwen3.5 397B-A17B", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0.6, "output": 3.6}},- {"id": "minimax/minimax-m2.7", "name": "MiniMax M2.7", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.06}, "thinking_levels": {"off": null}},- {"id": "xiaomimimo/mimo-v2.5-pro", "name": "MiMo V2.5 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0.522, "output": 1.044, "cache_read": 0.0043}, "thinking_levels": {"off": null}},- {"id": "google/gemma-4-31b-it", "name": "Gemma 4 31B IT", "reasoning": true, "input": ["text", "image"], "context_window": 262144, "max_output_tokens": 131072, "cost": {"input": 0.14, "output": 0.4}},- {"id": "qwen/qwen3-embedding-0.6b", "name": "Qwen3 Embedding 0.6B", "type": "Embedding", "dimension": 1024, "context_window": 32768},- {"id": "qwen/qwen3-embedding-8b", "name": "Qwen3 Embedding 8B", "type": "Embedding", "dimension": 4096, "context_window": 32768},- {"id": "baai/bge-m3", "name": "BGE-M3", "type": "Embedding", "dimension": 1024, "context_window": 8192}- ]-}diff --git a/internal/models/vendors/nvidia/models.json b/internal/models/vendors/nvidia/models.jsondeleted file mode 100644index 06e6e9e70..000000000--- a/internal/models/vendors/nvidia/models.json+++ /dev/null@@ -1,18 +0,0 @@-{- "vendor": "nvidia",- "source": "https://build.nvidia.com",- "models": [- {"id": "nvidia/nemotron-3-ultra-550b-a55b", "name": "Nemotron 3 Ultra 550B-A55B", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.5, "output": 2.5, "cache_read": 0.15}},- {"id": "nvidia/nemotron-3-super-120b-a12b", "name": "Nemotron 3 Super 120B-A12B", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 262144, "cost": {"input": 0.2, "output": 0.8}},- {"id": "nvidia/nemotron-3.5-lightning-30b-a3b", "name": "Nemotron 3.5 Lightning 30B-A3B", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0, "output": 0}},- {"id": "z-ai/glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"thinking_format": "openai", "supports_reasoning_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},- {"id": "deepseek-ai/deepseek-v4-pro-0813", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 0.435, "output": 0.87, "cache_read": 0.003625}},- {"id": "deepseek-ai/deepseek-v4-flash-0731", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.0028}},- {"id": "moonshotai/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"max_tokens_field": "max_completion_tokens", "thinking_format": "openai", "supports_reasoning_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},- {"id": "moonshotai/kimi-k2.6", "name": "Kimi K2.6", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0, "output": 0}},- {"id": "google/gemma-4-31b-it", "name": "Gemma 4 31B IT", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 16384, "cost": {"input": 0, "output": 0}, "compat": {"max_tokens_field": "max_completion_tokens", "thinking_format": "none"}},- {"id": "nvidia/nemotron-3-embed-1b", "name": "Nemotron 3 Embed 1B", "type": "Embedding", "dimension": 2048, "context_window": 4096, "source": "https://docs.api.nvidia.com/nim/reference/nvidia-nemotron-3-embed-1b-infer"},- {"id": "nvidia/llama-nemotron-rerank-vl-1b-v2", "name": "Llama Nemotron Rerank VL 1B v2", "type": "Rerank"},- {"id": "nvidia/nv-rerankqa-mistral-4b-v3", "name": "NV-RerankQA Mistral 4B v3", "type": "Rerank"}- ]-}diff --git a/internal/models/vendors/openai/models.json b/internal/models/vendors/openai/models.jsondeleted file mode 100644index b67103769..000000000--- a/internal/models/vendors/openai/models.json+++ /dev/null@@ -1,38 +0,0 @@-{- "vendor": "openai",- "source": "https://developers.openai.com/api/docs/models",- "models": [- {"name": "GPT-6 family (reasoning, no sampling parameters, thinking always on)", "match": "gpt-6*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}, "source": "https://developers.openai.com/api/docs/guides/latest-model"},- {"name": "GPT-5 family (reasoning, no sampling parameters)", "match": "gpt-5*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low"}, "source": "https://developers.openai.com/api/docs/guides/reasoning"},- {"name": "o1 family (always-on reasoning)", "match": "o1*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"name": "o3 family (always-on reasoning)", "match": "o3*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"name": "o4 family (always-on reasoning)", "match": "o4*", "reasoning": true, "input": ["text", "image"], "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},-- {"id": "gpt-6-astra", "name": "GPT-6 Astra", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 10, "output": 50, "cache_read": 1, "cache_write": 12.5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "gpt-5.6-terra", "name": "GPT-5.6 Terra", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 2, "output": 12, "cache_read": 0.2, "cache_write": 2.5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "gpt-5.6-sol", "name": "GPT-5.6 Sol", "aliases": ["gpt-5.6"], "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 4, "output": 20, "cache_read": 0.4, "cache_write": 5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "gpt-5.6-luna", "name": "GPT-5.6 Luna", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 0.2, "output": 1.2, "cache_read": 0.02, "cache_write": 0.25}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "gpt-5.5", "name": "GPT-5.5", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 30, "cache_read": 0.5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "gpt-5.4", "name": "GPT-5.4", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 2.5, "output": 15, "cache_read": 0.25}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "gpt-5.4-mini", "name": "GPT-5.4 Mini", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 0.75, "output": 4.5, "cache_read": 0.075}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "gpt-5.4-nano", "name": "GPT-5.4 Nano", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 0.2, "output": 1.25, "cache_read": 0.02}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "gpt-5.2", "name": "GPT-5.2", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 1.75, "output": 14, "cache_read": 0.175}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "gpt-5.1", "name": "GPT-5.1", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 1.25, "output": 10, "cache_read": 0.125}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "high", "max": "high"}},- {"id": "gpt-5", "name": "GPT-5", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 1.25, "output": 10, "cache_read": 0.125}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}},- {"id": "gpt-5-mini", "name": "GPT-5 Mini", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 0.25, "output": 2, "cache_read": 0.025}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}},- {"id": "gpt-5-nano", "name": "GPT-5 Nano", "reasoning": true, "input": ["text", "image"], "context_window": 400000, "max_output_tokens": 128000, "cost": {"input": 0.05, "output": 0.4, "cache_read": 0.005}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "xhigh": "high", "max": "high"}},- {"id": "o3", "name": "o3", "reasoning": true, "input": ["text", "image"], "context_window": 200000, "max_output_tokens": 100000, "cost": {"input": 2, "output": 8, "cache_read": 0.5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"id": "gpt-4.1", "name": "GPT-4.1", "reasoning": false, "input": ["text", "image"], "context_window": 1047576, "max_output_tokens": 32768, "cost": {"input": 2, "output": 8, "cache_read": 0.5}},- {"id": "gpt-4.1-mini", "name": "GPT-4.1 Mini", "reasoning": false, "input": ["text", "image"], "context_window": 1047576, "max_output_tokens": 32768, "cost": {"input": 0.4, "output": 1.6, "cache_read": 0.1}},- {"id": "gpt-4o", "name": "GPT-4o", "aliases": ["gpt-4o-2024-11-20", "gpt-4o-2024-08-06"], "reasoning": false, "input": ["text", "image"], "context_window": 128000, "max_output_tokens": 16384, "cost": {"input": 2.5, "output": 10, "cache_read": 1.25}},- {"id": "gpt-4o-mini", "name": "GPT-4o Mini", "reasoning": false, "input": ["text", "image"], "context_window": 128000, "max_output_tokens": 16384, "cost": {"input": 0.15, "output": 0.6, "cache_read": 0.075}},-- {"id": "text-embedding-3-small", "name": "text-embedding-3-small", "type": "Embedding", "dimension": 1536, "context_window": 8191, "cost": {"input": 0.02, "output": 0}},- {"id": "text-embedding-3-large", "name": "text-embedding-3-large", "type": "Embedding", "dimension": 3072, "context_window": 8191, "cost": {"input": 0.13, "output": 0}},- {"id": "whisper-1", "name": "Whisper", "type": "ASR", "compat": {"response_format": "verbose_json"}, "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"},- {"id": "gpt-transcribe", "name": "GPT Transcribe", "type": "ASR", "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"},- {"id": "gpt-4o-transcribe", "name": "GPT-4o Transcribe", "type": "ASR", "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"},- {"id": "gpt-4o-mini-transcribe", "name": "GPT-4o mini Transcribe", "type": "ASR", "source": "https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create"},- {"id": "text-embedding-ada-002", "name": "text-embedding-ada-002", "type": "Embedding", "dimension": 1536, "context_window": 8192, "cost": {"input": 0.1, "output": 0}, "compat": {"dimensions_field": ""}}- ]-}diff --git a/internal/models/vendors/openrouter/models.json b/internal/models/vendors/openrouter/models.jsondeleted file mode 100644index 23660cd7c..000000000--- a/internal/models/vendors/openrouter/models.json+++ /dev/null@@ -1,25 +0,0 @@-{- "vendor": "openrouter",- "source": "https://openrouter.ai/docs/guides/best-practices/reasoning-tokens",- "models": [- {"name": "Anthropic models (cache_control breakpoints, thinking always on)", "match": "anthropic/*", "reasoning": true, "input": ["text", "image"], "compat": {"cache_control_format": "anthropic"}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "openai/gpt-5.5", "name": "GPT-5.5", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 30, "cache_read": 0.5}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "openai/gpt-5.4", "name": "GPT-5.4", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "cost": {"input": 2.5, "output": 15, "cache_read": 0.25}, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "anthropic/claude-opus-5", "name": "Claude Opus 5", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 5, "output": 25, "cache_read": 0.5, "cache_write": 6.25}, "compat": {"cache_control_format": "anthropic"}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "anthropic/claude-sonnet-5", "name": "Claude Sonnet 5", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 2, "output": 10, "cache_read": 0.2, "cache_write": 2.5}, "compat": {"cache_control_format": "anthropic"}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "anthropic/claude-sonnet-4.6", "name": "Claude Sonnet 4.6", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "cost": {"input": 3, "output": 15, "cache_read": 0.3, "cache_write": 3.75}, "compat": {"cache_control_format": "anthropic"}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "max", "max": "max"}},- {"id": "google/gemini-3.8-flash", "name": "Gemini 3.8 Flash", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 0.75, "output": 3.75, "cache_read": 0.075, "cache_write": 0.041667}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"id": "google/gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro Preview", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "cost": {"input": 2, "output": 12, "cache_read": 0.2, "cache_write": 0.375}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "high", "max": "high"}},- {"id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 384000, "cost": {"input": 1.6, "output": 3.2, "cache_read": 0.135}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "deepseek/deepseek-v4-flash", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 384000, "cost": {"input": 0.07, "output": 0.14, "cache_read": 0.014}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "z-ai/glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1310720, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},- {"id": "moonshotai/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 943718, "cost": {"input": 3, "output": 15, "cache_read": 0.3}, "thinking_levels": {"minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},- {"id": "qwen/qwen3.7-max", "name": "Qwen3.7 Max", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.475, "output": 4.425, "cache_read": 0.295, "cache_write": 1.84375}},- {"id": "minimax/minimax-m3", "name": "MiniMax M3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 512000, "cost": {"input": 0.3, "output": 1.2, "cache_read": 0.06}},- {"id": "x-ai/grok-4.6", "name": "Grok 4.6", "reasoning": true, "input": ["text", "image"], "context_window": 500000, "max_output_tokens": 450000, "cost": {"input": 2, "output": 6, "cache_read": 0.5}, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "openai/text-embedding-3-small", "name": "text-embedding-3-small", "type": "Embedding", "dimension": 1536, "context_window": 8192, "source": "https://openrouter.ai/docs/api_reference/embeddings"},- {"id": "openai/text-embedding-3-large", "name": "text-embedding-3-large", "type": "Embedding", "dimension": 3072, "context_window": 8192, "source": "https://openrouter.ai/docs/api_reference/embeddings"},- {"id": "cohere/rerank-v3.5", "name": "Cohere Rerank v3.5", "type": "Rerank", "source": "https://openrouter.ai/docs/api/api-reference/rerank/submit-a-rerank-request"},- {"id": "openai/whisper-large-v3", "name": "Whisper Large v3", "type": "ASR", "source": "https://openrouter.ai/docs/api/api-reference/stt/create-transcription"}- ]-}diff --git a/internal/models/vendors/qianfan/models.json b/internal/models/vendors/qianfan/models.jsondeleted file mode 100644index ba23dc465..000000000--- a/internal/models/vendors/qianfan/models.json+++ /dev/null@@ -1,15 +0,0 @@-{- "vendor": "qianfan",- "source": "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43",- "models": [- {"id": "ernie-5.0-thinking-preview", "name": "ERNIE 5.0 Thinking Preview", "reasoning": true, "input": ["text", "image"], "context_window": 128000, "max_output_tokens": 65536, "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv"},- {"id": "ernie-4.5-turbo-128k", "name": "ERNIE 4.5 Turbo 128K", "reasoning": false, "input": ["text"], "context_window": 128000, "max_output_tokens": 12288},- {"id": "ernie-4.5-turbo-vl-32k", "name": "ERNIE 4.5 Turbo VL 32K", "reasoning": false, "input": ["text", "image"], "context_window": 32000, "max_output_tokens": 12288},- {"id": "ernie-x1-turbo-32k", "name": "ERNIE X1 Turbo 32K", "reasoning": true, "input": ["text"], "context_window": 32000, "max_output_tokens": 16000, "thinking_levels": {"off": null}},- {"id": "deepseek-v3.2", "name": "DeepSeek V3.2 (Qianfan)", "reasoning": true, "input": ["text"], "context_window": 128000, "max_output_tokens": 32000, "compat": {"thinking_format": "thinking-type"}, "source": "https://cloud.baidu.com/doc/qianfan-docs/s/Wm95lyynv"},- {"id": "embedding-v1", "name": "Embedding-V1", "type": "Embedding", "dimension": 384, "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"},- {"id": "bge-large-zh", "name": "BGE Large ZH", "type": "Embedding", "dimension": 1024, "source": "https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn"},- {"id": "tao-8k", "name": "Tao-8K", "type": "Embedding", "dimension": 1024, "compat": {"max_batch_size": 1}, "source": "https://cloud.baidu.com/doc/qianfan/s/rmh4stp0j"},- {"id": "bce-reranker-base", "name": "BCE Reranker Base", "type": "Rerank"}- ]-}diff --git a/internal/models/vendors/qiniu/models.json b/internal/models/vendors/qiniu/models.jsondeleted file mode 100644index c1f5b4bd8..000000000--- a/internal/models/vendors/qiniu/models.json+++ /dev/null@@ -1,16 +0,0 @@-{- "vendor": "qiniu",- "source": "https://www.qiniu.com/ai/models",- "models": [- {"id": "qwen3.5-397b-a17b", "name": "Qwen3.5 397B-A17B", "reasoning": true, "input": ["text", "image"], "context_window": 256000, "max_output_tokens": 64000},- {"id": "z-ai/glm-5", "name": "GLM-5", "reasoning": true, "input": ["text"], "context_window": 200000, "max_output_tokens": 128000},- {"id": "z-ai/glm-4.7", "name": "GLM-4.7", "reasoning": true, "input": ["text"], "context_window": 200000, "max_output_tokens": 200000, "source": "https://api.qnaigc.com/v1/market/models"},- {"id": "minimax/minimax-m2.5", "name": "MiniMax M2.5", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 128000},- {"id": "doubao-seed-2.0-pro", "name": "Doubao Seed 2.0 Pro", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 128000},- {"id": "moonshotai/kimi-k2.5", "name": "Kimi K2.5", "reasoning": false, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 256000},- {"id": "xiaomi/mimo-v2-flash", "name": "MiMo V2 Flash", "reasoning": true, "input": ["text"], "context_window": 256000, "max_output_tokens": 256000, "cost": {"input": 0.1, "output": 0.3, "cache_read": 0.01}},- {"id": "deepseek/deepseek-v3.2-251201", "name": "DeepSeek V3.2 (251201)", "reasoning": true, "input": ["text"], "context_window": 128000, "max_output_tokens": 32000, "source": "https://apidocs.qnaigc.com/397639742e0"},- {"id": "deepseek-r1", "name": "DeepSeek R1", "reasoning": true, "input": ["text"], "context_window": 128000, "max_output_tokens": 32000, "thinking_levels": {"off": null}, "source": "https://api.qnaigc.com/v1/market/models"},- {"id": "deepseek-v3", "name": "DeepSeek V3", "reasoning": false, "input": ["text"], "context_window": 128000, "max_output_tokens": 16000}- ]-}diff --git a/internal/models/vendors/requesty/models.json b/internal/models/vendors/requesty/models.jsondeleted file mode 100644index c1d2d27e2..000000000--- a/internal/models/vendors/requesty/models.json+++ /dev/null@@ -1,20 +0,0 @@-{- "vendor": "requesty",- "source": "https://docs.requesty.ai/frameworks/openai",- "models": [- {"id": "openai/gpt-6-astra", "name": "GPT-6 Astra", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "compat": {"supports_temperature": false}, "thinking_levels": {"off": null, "minimal": "min", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "openai/gpt-5.5", "name": "GPT-5.5", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "min", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "openai/gpt-5.4", "name": "GPT-5.4", "reasoning": true, "input": ["text", "image"], "context_window": 1050000, "max_output_tokens": 128000, "compat": {"supports_temperature": false}, "thinking_levels": {"off": "none", "minimal": "min", "xhigh": "xhigh", "max": "xhigh"}},- {"id": "anthropic/claude-opus-5", "name": "Claude Opus 5", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "anthropic/claude-sonnet-5", "name": "Claude Sonnet 5", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 128000, "thinking_levels": {"off": null, "minimal": "low", "xhigh": "xhigh", "max": "max"}},- {"id": "vertex/gemini-3.8-flash", "name": "Gemini 3.8 Flash (Vertex)", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "thinking_levels": {"off": null, "minimal": "min", "xhigh": "high", "max": "high"}},- {"id": "google/gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro Preview", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "thinking_levels": {"off": null, "minimal": "min", "xhigh": "high", "max": "high"}},- {"id": "google/gemini-3.6-flash", "name": "Gemini 3.6 Flash", "reasoning": true, "input": ["text", "image", "audio", "video"], "context_window": 1048576, "max_output_tokens": 65536, "thinking_levels": {"off": null, "minimal": "min", "xhigh": "high", "max": "high"}},- {"id": "deepseek/deepseek-v4-pro-0813", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072},- {"id": "zai/glm-5.2", "name": "GLM-5.2", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 131072},- {"id": "moonshot/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 262144},- {"id": "openai/gpt-4o-transcribe", "name": "GPT-4o Transcribe", "type": "ASR", "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"},- {"id": "openai/gpt-4o-mini-transcribe", "name": "GPT-4o mini Transcribe", "type": "ASR", "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"},- {"id": "openai/whisper-1", "name": "Whisper", "type": "ASR", "compat": {"response_format": "verbose_json"}, "source": "https://docs.requesty.ai/api-reference/endpoint/audio-transcriptions-create"}- ]-}diff --git a/internal/models/vendors/siliconflow/models.json b/internal/models/vendors/siliconflow/models.jsondeleted file mode 100644index 585be3a42..000000000--- a/internal/models/vendors/siliconflow/models.json+++ /dev/null@@ -1,30 +0,0 @@-{- "vendor": "siliconflow",- "source": "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions",- "models": [- {"name": "DeepSeek V4 family (reasoning_effort high | max)", "match": "deepseek-ai/DeepSeek-V4*", "reasoning": true, "input": ["text"], "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}},- {"name": "DeepSeek V4 Pro-tier family (reasoning_effort high | max)", "match": "Pro/deepseek-ai/DeepSeek-V4*", "reasoning": true, "input": ["text"], "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "deepseek-ai/DeepSeek-V4-Pro", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1049000, "max_output_tokens": 393000, "cost": {"input": 1.74, "output": 3.48, "cache_read": 0.145}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "deepseek-ai/DeepSeek-V4-Flash", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 384000, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.003}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "zai-org/GLM-5.2", "name": "GLM-5.2", "aliases": ["Pro/zai-org/GLM-5.2"], "reasoning": true, "input": ["text"], "context_window": 1049000, "max_output_tokens": 262000, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"minimal": "high", "low": "high", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}},- {"id": "Pro/zai-org/GLM-5.1", "name": "GLM-5.1 (Pro)", "reasoning": true, "input": ["text"], "context_window": 205000, "max_output_tokens": 205000, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "compat": {"supports_reasoning_effort": false}},- {"id": "Pro/zai-org/GLM-5", "name": "GLM-5 (Pro)", "reasoning": true, "input": ["text"], "context_window": 205000, "max_output_tokens": 205000, "cost": {"input": 1, "output": 3.2}, "compat": {"supports_reasoning_effort": false}},- {"id": "Pro/moonshotai/Kimi-K2.6", "name": "Kimi K2.6 (Pro)", "reasoning": true, "input": ["text", "image"], "context_window": 262000, "max_output_tokens": 262000, "cost": {"input": 0.95, "output": 4, "cache_read": 0.16}, "compat": {"supports_reasoning_effort": false}},- {"id": "Pro/moonshotai/Kimi-K2.5", "name": "Kimi K2.5 (Pro)", "reasoning": true, "input": ["text", "image"], "context_window": 262000, "max_output_tokens": 262000, "cost": {"input": 0.45, "output": 2.25, "cache_read": 0.07}, "compat": {"supports_reasoning_effort": false}},- {"id": "Qwen/Qwen3.5-397B-A17B", "name": "Qwen3.5 397B-A17B", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0.29, "output": 1.74}, "compat": {"supports_reasoning_effort": false}},- {"id": "Qwen/Qwen3.5-122B-A10B", "name": "Qwen3.5 122B-A10B", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0.29, "output": 2.32}, "compat": {"supports_reasoning_effort": false}},- {"id": "Qwen/Qwen3.5-35B-A3B", "name": "Qwen3.5 35B-A3B", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0.23, "output": 1.86}, "compat": {"supports_reasoning_effort": false}},- {"id": "Qwen/Qwen3.6-35B-A3B", "name": "Qwen3.6 35B-A3B", "reasoning": false, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 65536, "cost": {"input": 0.23, "output": 1.86}},- {"id": "deepseek-ai/DeepSeek-V3.2", "name": "DeepSeek V3.2", "reasoning": true, "input": ["text"], "context_window": 164000, "max_output_tokens": 164000, "cost": {"input": 0.27, "output": 0.42}, "compat": {"supports_reasoning_effort": false}},- {"id": "Pro/MiniMaxAI/MiniMax-M2.5", "name": "MiniMax M2.5 (Pro)", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131000, "cost": {"input": 0.3, "output": 1.22}, "compat": {"supports_reasoning_effort": false}, "source": "https://platform.minimax.io/docs/api-reference/text-openai-api"},- {"id": "Qwen/Qwen3-VL-32B-Instruct", "name": "Qwen3 VL 32B Instruct", "reasoning": false, "input": ["text", "image"], "context_window": 262000, "max_output_tokens": 262000, "cost": {"input": 0.2, "output": 0.6}},- {"id": "BAAI/bge-m3", "name": "BGE-M3", "type": "Embedding", "dimension": 1024, "compat": {"dimensions_field": ""}, "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"},- {"id": "Qwen/Qwen3-Embedding-8B", "name": "Qwen3 Embedding 8B", "type": "Embedding", "dimension": 4096, "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"},- {"id": "Qwen/Qwen3-Embedding-4B", "name": "Qwen3 Embedding 4B", "type": "Embedding", "dimension": 2560, "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"},- {"id": "Qwen/Qwen3-Embedding-0.6B", "name": "Qwen3 Embedding 0.6B", "type": "Embedding", "dimension": 1024, "source": "https://api-docs.siliconflow.cn/docs/api/embeddings-post"},- {"id": "BAAI/bge-reranker-v2-m3", "name": "BGE Reranker v2 M3", "type": "Rerank", "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"},- {"id": "Qwen/Qwen3-Reranker-8B", "name": "Qwen3 Reranker 8B", "type": "Rerank", "source": "https://api-docs.siliconflow.cn/docs/api/rerank-post"},- {"id": "FunAudioLLM/SenseVoiceSmall", "name": "SenseVoice Small", "type": "ASR", "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"},- {"id": "TeleAI/TeleSpeechASR", "name": "TeleSpeechASR", "type": "ASR", "source": "https://api-docs.siliconflow.cn/docs/api/audio-transcriptions-post"}- ]-}diff --git a/internal/models/vendors/volcengine/models.json b/internal/models/vendors/volcengine/models.jsondeleted file mode 100644index 9140c8c63..000000000--- a/internal/models/vendors/volcengine/models.json+++ /dev/null@@ -1,28 +0,0 @@-{- "vendor": "volcengine",- "source": "https://www.volcengine.com/docs/82379/1494384",- "models": [- {"id": "doubao-seed-2-1-pro-260915", "name": "Doubao Seed 2.1 Pro (260915)", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1024000, "max_output_tokens": 256000, "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"},- {"id": "doubao-seed-2-1-pro-260628", "name": "Doubao Seed 2.1 Pro", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 256000, "cost": {"input": 0.8906, "output": 4.45301, "cache_read": 0.17812}},- {"id": "doubao-seed-2-1-turbo-260628", "name": "Doubao Seed 2.1 Turbo", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 256000, "cost": {"input": 0.4453, "output": 2.22651, "cache_read": 0.08906}},- {"id": "doubao-seed-2-0-pro-260215", "name": "Doubao Seed 2.0 Pro", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 131072, "cost": {"input": 0.47499, "output": 2.37494, "cache_read": 0.095}, "compat": {"fixed_temperature": 1}, "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"},- {"id": "doubao-seed-2-0-lite-260428", "name": "Doubao Seed 2.0 Lite", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 131072, "cost": {"input": 0.08906, "output": 0.53436, "cache_read": 0.01781}},- {"id": "doubao-seed-2-0-mini-260428", "name": "Doubao Seed 2.0 Mini", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 131072, "cost": {"input": 0.02969, "output": 0.29687, "cache_read": 0.00594}},- {"id": "doubao-seed-2-0-code-preview-260215", "name": "Doubao Seed 2.0 Code Preview", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 131072, "cost": {"input": 0.47499, "output": 2.37494, "cache_read": 0.095}},- {"id": "doubao-seed-1-8-251228", "name": "Doubao Seed 1.8 (retiring)", "deprecated": true, "reasoning": true, "input": ["text", "image"], "context_window": 256000, "max_output_tokens": 32768, "cost": {"input": 0.11875, "output": 1.18747, "cache_read": 0.02375}, "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"},- {"id": "doubao-seed-1-6-251015", "name": "Doubao Seed 1.6 (retiring)", "deprecated": true, "reasoning": true, "input": ["text"], "context_window": 256000, "max_output_tokens": 32768, "cost": {"input": 0.11875, "output": 1.18747, "cache_read": 0.02375}, "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"},- {"id": "doubao-seed-1-6-flash-250828", "name": "Doubao Seed 1.6 Flash (retiring)", "deprecated": true, "reasoning": true, "input": ["text", "image"], "context_window": 256000, "max_output_tokens": 32768, "cost": {"input": 0.02227, "output": 0.22265, "cache_read": 0.00445}, "compat": {"supports_reasoning_effort": false}, "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"},- {"id": "doubao-seed-1-6-vision-250815", "name": "Doubao Seed 1.6 Vision (retiring)", "deprecated": true, "reasoning": true, "input": ["text", "image"], "context_window": 256000, "max_output_tokens": 32768, "cost": {"input": 0.11875, "output": 1.18747, "cache_read": 0.02375}, "compat": {"supports_reasoning_effort": false}, "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"},- {"id": "deepseek-v4-1-flash-260910", "name": "DeepSeek V4.1 Flash (Ark)", "reasoning": true, "input": ["text", "image"], "context_window": 1000000, "max_output_tokens": 393216, "source": "https://docs.volcengine.com/docs/ark/model-list?lang=zh"},- {"id": "deepseek-v4-pro-ga-260813", "name": "DeepSeek V4 Pro (Ark)", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 393216, "cost": {"input": 1.3359, "output": 4.00771, "cache_read": 0.04453}},- {"id": "deepseek-v4-flash-ga-260731", "name": "DeepSeek V4 Flash (Ark)", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 393216, "cost": {"input": 0.4453, "output": 1.3359, "cache_read": 0.01484}},- {"id": "glm-5-3-flash-260828", "name": "GLM-5.3 Flash (Ark)", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.11875, "output": 0.41563, "cache_read": 0.03414}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.volcengine.com/docs/ark/deep-thinking?lang=zh"},- {"id": "glm-5-2-260617", "name": "GLM-5.2 (Ark)", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.18747, "output": 4.15615, "cache_read": 0.29687}},- {"name": "Retired doubao-embedding text models", "match": "doubao-embedding-text*", "type": "Embedding", "compat": {"api": "openai-embeddings", "dimensions_field": "", "max_batch_size": 4}, "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh"},- {"name": "Retired doubao-embedding-large text models", "match": "doubao-embedding-large-text*", "type": "Embedding", "compat": {"api": "openai-embeddings", "dimensions_field": "", "max_batch_size": 4}, "source": "https://docs.volcengine.com/docs/ark/TextVectorizationAPI?lang=zh"},- {"id": "doubao-embedding-vision-251215", "name": "Doubao Embedding Vision (251215)", "type": "Embedding", "dimension": 2048, "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"},- {"id": "doubao-embedding-vision-250615", "name": "Doubao Embedding Vision", "type": "Embedding", "dimension": 2048, "source": "https://docs.volcengine.com/docs/ark/multimodal-vectorization-api?lang=zh"},- {"id": "doubao-seed-rerank", "name": "Doubao Seed Rerank", "type": "Rerank", "source": "https://www.volcengine.com/docs/84313/1254474"},- {"id": "base-multilingual-rerank", "name": "Base Multilingual Rerank", "type": "Rerank", "source": "https://www.volcengine.com/docs/84313/1254474"}- ]-}diff --git a/internal/models/vendors/weknoracloud/models.json b/internal/models/vendors/weknoracloud/models.jsondeleted file mode 100644index c6eb4252c..000000000--- a/internal/models/vendors/weknoracloud/models.json+++ /dev/null@@ -1,4 +0,0 @@-{- "vendor": "weknoracloud",- "models": []-}diff --git a/internal/models/vendors/zhipu/models.json b/internal/models/vendors/zhipu/models.jsondeleted file mode 100644index bd2ea0e3c..000000000--- a/internal/models/vendors/zhipu/models.json+++ /dev/null@@ -1,21 +0,0 @@-{- "vendor": "zhipu",- "source": "https://docs.bigmodel.cn/api-reference/模型-api/对话补全",- "models": [- {"id": "glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3"},- {"id": "glm-5.3-flash", "name": "GLM-5.3 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.075, "output": 0.25, "cache_read": 0.015}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/vlm/glm-5.3-flash"},- {"id": "glm-5.2", "name": "GLM-5.2", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.2"},- {"id": "glm-5.1", "name": "GLM-5.1", "reasoning": true, "input": ["text"], "context_window": 200000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-5", "name": "GLM-5", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 1, "output": 3.2, "cache_read": 0.2}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-5v-turbo", "name": "GLM-5V Turbo", "reasoning": true, "input": ["text", "image", "video"], "context_window": 200000, "max_output_tokens": 131072, "cost": {"input": 5, "output": 22, "cache_read": 1.2}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-4.7", "name": "GLM-4.7", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.6, "output": 2.2, "cache_read": 0.11}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-4.7-flash", "name": "GLM-4.7 Flash", "reasoning": true, "input": ["text"], "context_window": 200000, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-4.6v", "name": "GLM-4.6V", "reasoning": true, "input": ["text", "image", "video"], "context_window": 128000, "max_output_tokens": 32768, "cost": {"input": 0.3, "output": 0.9}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-4.6", "name": "GLM-4.6", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 0.6, "output": 2.2, "cache_read": 0.11}, "compat": {"supports_reasoning_effort": false}},- {"id": "glm-4.5-air", "name": "GLM-4.5 Air", "reasoning": true, "input": ["text"], "context_window": 131072, "max_output_tokens": 98304, "cost": {"input": 0.2, "output": 1.1, "cache_read": 0.03}, "compat": {"supports_reasoning_effort": false}},- {"id": "embedding-3", "name": "Embedding-3", "type": "Embedding", "dimension": 2048, "compat": {"max_batch_size": 64}, "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入"},- {"id": "embedding-2", "name": "Embedding-2", "type": "Embedding", "dimension": 1024, "compat": {"dimensions_field": ""}, "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本嵌入"},- {"id": "rerank", "name": "Rerank", "type": "Rerank", "source": "https://docs.bigmodel.cn/api-reference/模型-api/文本重排序"},- {"id": "glm-asr-2512", "name": "GLM-ASR-2512 (at most 30 s per file)", "type": "ASR", "source": "https://docs.bigmodel.cn/api-reference/模型-api/语音转文本"}- ]-}diff --git a/internal/models/vlm/remote_api_reasoning_test.go b/internal/models/vlm/remote_api_reasoning_test.goindex 5c8136e5b..b59d16d92 100644--- a/internal/models/vlm/remote_api_reasoning_test.go+++ b/internal/models/vlm/remote_api_reasoning_test.go@@ -7,8 +7,6 @@ import ("net/http/httptest""strings""testing"-- _ "github.com/Tencent/WeKnora/internal/models/vendors")// newVLMChatTestServer emulates an OpenAI-compatible chat completions endpointdiff --git a/internal/models/vlm/spec_override_test.go b/internal/models/vlm/spec_override_test.goindex 650755b5e..9ab0ec635 100644--- a/internal/models/vlm/spec_override_test.go+++ b/internal/models/vlm/spec_override_test.go@@ -4,7 +4,6 @@ import ("context""testing"- _ "github.com/Tencent/WeKnora/internal/models/vendors""github.com/Tencent/WeKnora/internal/types")diff --git a/internal/models/vlm/vlm.go b/internal/models/vlm/vlm.goindex b543e1848..42827aa48 100644--- a/internal/models/vlm/vlm.go+++ b/internal/models/vlm/vlm.go@@ -6,9 +6,9 @@ import ("strings""github.com/Tencent/WeKnora/internal/logger"- "github.com/Tencent/WeKnora/internal/models/catalog"+ "github.com/Tencent/WeKnora/internal/models/providers"+ modelruntime "github.com/Tencent/WeKnora/internal/models/runtime""github.com/Tencent/WeKnora/internal/models/utils/ollama"- "github.com/Tencent/WeKnora/internal/models/vendors/weknoracloud""github.com/Tencent/WeKnora/internal/types")@@ -113,9 +113,9 @@ func newVLM(config *Config, ollamaService *ollama.OllamaService) (VLM, error) {providerID := config.Providerif providerID == "" {- providerID = catalog.DetectByURL(config.BaseURL)+ providerID = modelruntime.DetectByURL(config.BaseURL)}- if providerID == weknoracloud.ID {+ if providerID == providers.WeKnoraCloudID {return NewWeKnoraCloudVLM(config)}diff --git a/internal/router/routes_infra.go b/internal/router/routes_infra.goindex e0aa1cd59..4156bf507 100644--- a/internal/router/routes_infra.go+++ b/internal/router/routes_infra.go@@ -24,6 +24,7 @@ func RegisterModelRoutes(models.GET("/providers", g.Viewer(), handler.ListModelProviders)// 解析模型的有效接入配置(协议 / 思考等级 / 上下文)— Viewer+models.GET("/catalog/resolve", g.Viewer(), handler.ResolveModelCatalog)+ models.POST("/catalog/resolve", g.Viewer(), handler.ResolveModelCatalog)// 创建模型 — Admin+models.POST("", g.Admin(), handler.CreateModel)// 获取模型列表 — Viewer+diff --git a/internal/types/builtin_models_config.go b/internal/types/builtin_models_config.goindex f68c8bd5f..fad0a7480 100644--- a/internal/types/builtin_models_config.go+++ b/internal/types/builtin_models_config.go@@ -255,7 +255,7 @@ var validBuiltinModelStatuses = map[ModelStatus]struct{}{// Source is intentionally NOT validated against a fixed list because the// provider matrix in internal/models/* keeps growing and a too-strict// check here would force changes in two places per new provider.-// ValidateModelParameters is set at startup to catalog.ValidateRow. It is a+// ValidateModelParameters is set at startup to runtime.ValidateRow. It is a// hook rather than a direct call because internal/models/catalog imports this// package, so the dependency can only run in this direction. A nil hook (unit// tests, tools that never build the container) simply skips the check.diff --git a/internal/types/model.go b/internal/types/model.goindex c5ed9ab27..69fb38b86 100644--- a/internal/types/model.go+++ b/internal/types/model.go@@ -161,7 +161,7 @@ type ModelParameters struct {// ModelSpecOverride is the per-row slice of a catalog model entry that an// operator may pin from the UI or YAML. Compat is the flat protocol-specific-// object documented in internal/models/catalog/compat.go.+// object decoded by internal/models/runtime/compat.go using the API settings.type ModelSpecOverride struct {API string `yaml:"api,omitempty" json:"api,omitempty"`Reasoning *bool `yaml:"reasoning,omitempty" json:"reasoning,omitempty"`diff --git a/scripts/model-catalog/generate.py b/scripts/model-catalog/generate.pynew file mode 100644index 000000000..4e99fdcc9--- /dev/null+++ b/scripts/model-catalog/generate.py@@ -0,0 +1,98 @@+#!/usr/bin/env python3+"""Reproducibly merge pinned model metadata and reviewed protocol overrides.++Network updates are intentionally separate: model_catalog_diff.py compares+models.dev with the generated catalog, then maintainers review changes to the+pinned source. Upstream metadata cannot silently replace wire compatibility.+"""+import argparse+import copy+import json+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+HERE = Path(__file__).resolve().parent+DATA = ROOT / "internal/models/catalog/data"+++def load(path):+ def unique(pairs):+ obj = {}+ for key, value in pairs:+ if key in obj:+ raise ValueError(f"{path}: duplicate JSON key {key}")+ obj[key] = value+ return obj+ return json.loads(path.read_text(), object_pairs_hook=unique)+++def identity(entry):+ kind = entry.get("type", "KnowledgeQA")+ if not entry.get("id") and not entry.get("match"):+ raise ValueError(f"model needs id or match: {entry}")+ return kind, entry.get("id", ""), entry.get("match", "")+++def generate():+ sources = load(HERE / "sources.json")+ result = {"version": 1, "providers": {}}+ for source in sources["metadata"]:+ data = load(HERE / source["path"])+ if data["version"] != 1:+ raise ValueError("unsupported metadata version")+ for provider, entries in data["providers"].items():+ if provider in result["providers"]:+ raise ValueError(f"duplicate provider {provider}")+ result["providers"][provider] = copy.deepcopy(entries)+ overrides = load(DATA / "overrides.json")+ if overrides["version"] != 1:+ raise ValueError("unsupported overrides version")+ for provider, patches in overrides["providers"].items():+ if provider not in result["providers"]:+ raise ValueError(f"override has unknown provider {provider}")+ entries = result["providers"][provider]+ index = {identity(entry): entry for entry in entries}+ seen = set()+ for patch in patches:+ key = identity(patch)+ if key in seen:+ raise ValueError(f"duplicate override {provider}/{key}")+ seen.add(key)+ # Unknown entries are explicit additions, suitable for models that+ # have no upstream metadata yet. Existing entries patch field-wise.+ if key not in index:+ entries.append(copy.deepcopy(patch))+ index[key] = entries[-1]+ else:+ index[key].update(copy.deepcopy(patch))+ for provider, entries in result["providers"].items():+ seen = set()+ for entry in entries:+ key = identity(entry)+ if key in seen:+ raise ValueError(f"duplicate model {provider}/{key}")+ seen.add(key)+ for field in ("context_window", "max_output_tokens", "dimension"):+ if field in entry and (type(entry[field]) is not int or entry[field] < 0):+ raise ValueError(f"invalid {field} in {provider}/{key}")+ return result+++def main():+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--check", action="store_true", help="fail if generated data is stale")+ args = parser.parse_args()+ result = generate()+ rendered = json.dumps(result, ensure_ascii=False, indent=2) + "\n"+ target = DATA / "models.generated.json"+ if args.check:+ if not target.exists() or target.read_text() != rendered:+ parser.exit(1, "model catalog is stale; run scripts/model-catalog/generate.py\n")+ else:+ target.write_text(rendered)+ print(f"Verified {len(result['providers'])} providers and "+ f"{sum(map(len, result['providers'].values()))} catalog rules")+++if __name__ == "__main__":+ main()diff --git a/scripts/model-catalog/sources.json b/scripts/model-catalog/sources.jsonnew file mode 100644index 000000000..6b5229378--- /dev/null+++ b/scripts/model-catalog/sources.json@@ -0,0 +1,32 @@+{+ "version": 1,+ "metadata": [+ {+ "path": "../../internal/models/catalog/data/seed.json",+ "description": "Pinned migration metadata; per-entry source links point to vendor documentation."+ }+ ],+ "models_dev": {+ "url": "https://models.dev/api.json",+ "provider_map": {+ "openai": "openai",+ "anthropic": "anthropic",+ "gemini": "google",+ "deepseek": "deepseek",+ "zhipu": "zhipuai",+ "aliyun": "alibaba-cn",+ "volcengine": "volcengine",+ "moonshot": "moonshotai-cn",+ "minimax": "minimax-cn",+ "mimo": "xiaomi",+ "siliconflow": "siliconflow-cn",+ "modelscope": "modelscope",+ "qiniu": "qiniu-ai",+ "longcat": "longcat",+ "novita": "novita-ai",+ "nvidia": "nvidia",+ "openrouter": "openrouter",+ "requesty": "requesty"+ }+ }+}diff --git a/scripts/model_catalog_diff.py b/scripts/model_catalog_diff.pyindex a3c657c67..844162529 100755--- a/scripts/model_catalog_diff.py+++ b/scripts/model_catalog_diff.py@@ -3,7 +3,7 @@Development-time helper, never run at runtime: it reports numeric facts(context window, max output, cost, new/retired ids) so a maintainer can update-internal/models/vendors/<id>/models.json by hand. Behavioural facts (compat,+internal/models/catalog/data/seed.json by hand. Behavioural facts (compat,thinking format) are intentionally out of scope — models.dev does not carrythem and they must come from vendor documentation.@@ -27,29 +27,10 @@ import urllib.requestfrom pathlib import PathROOT = Path(__file__).resolve().parent.parent-VENDORS_DIR = ROOT / "internal" / "models" / "vendors"+CATALOG = ROOT / "internal/models/catalog/data/models.generated.json"# WeKnora vendor id -> models.dev provider id.-PROVIDER_MAP = {- "openai": "openai",- "anthropic": "anthropic",- "gemini": "google",- "deepseek": "deepseek",- "zhipu": "zhipuai",- "aliyun": "alibaba-cn",- "volcengine": "volcengine",- "moonshot": "moonshotai-cn",- "minimax": "minimax-cn",- "mimo": "xiaomi",- "siliconflow": "siliconflow-cn",- "modelscope": "modelscope",- "qiniu": "qiniu-ai",- "longcat": "longcat",- "novita": "novita-ai",- "nvidia": "nvidia",- "openrouter": "openrouter",- "requesty": "requesty",-}+PROVIDER_MAP = json.loads((ROOT / "scripts/model-catalog/sources.json").read_text())["models_dev"]["provider_map"]MODELS_DEV_URL = "https://models.dev/api.json"@@ -80,11 +61,8 @@ def load_api(path):def load_catalog(vendor):- file = VENDORS_DIR / vendor / "models.json"- if not file.exists():- return {}- data = json.loads(file.read_text())- return {m["id"]: m for m in data.get("models", []) if m.get("id")}+ entries = json.loads(CATALOG.read_text())["providers"].get(vendor, [])+ return {m["id"]: m for m in entries if m.get("id")}def compare(vendor, upstream, ours):diff --git a/website-docs/02-architecture/01-overview.md b/website-docs/02-architecture/01-overview.mdindex 1ed02182f..53c075881 100644--- a/website-docs/02-architecture/01-overview.md+++ b/website-docs/02-architecture/01-overview.md@@ -58,7 +58,7 @@ WeKnora 采用"主服务 + 前端 + 文档解析微服务"的三进程核心架| 配置 | `github.com/spf13/viper` + `config/config.yaml` + 环境变量 | — || 可观测 | OpenTelemetry + Langfuse(`internal/tracing/langfuse`) | LLM 调用级 trace || gRPC | `google.golang.org/grpc` v1.81.0 | 调用 docreader |-| LLM 接入 | 自研协议层 `internal/models/api`(OpenAI / Anthropic / Gemini / DashScope 等线格式各一个包)、Ollama、腾讯云 LKE SDK 等 | 27 家厂商由 `internal/models/vendors` 声明,见[模型管理](../03-features/06-models.md) |+| LLM 接入 | 自研协议层 `internal/models/api`(OpenAI / Anthropic / Gemini / DashScope 等线格式各一个包)、Ollama、腾讯云 LKE SDK 等 | 27 家厂商由 `internal/models/providers` 声明,见[模型管理](../03-features/06-models.md) || 向量/检索 | pgvector、ES v7/v8、OpenSearch、Qdrant、Milvus、Weaviate、Doris、腾讯 VectorDB、sqlite-vec | 由 `RETRIEVE_DRIVER` 与 `vector_stores` 表动态装配 || 知识图谱 | `neo4j-go-driver/v6` | 可选 || 数据分析 | DuckDB(`duckdb-go/v2`)、`pg_query_go` SQL 校验 | Agent 数据分析工具 |diff --git a/website-docs/03-features/06-models.md b/website-docs/03-features/06-models.mdindex 8b0df7c8d..b41eb732a 100644--- a/website-docs/03-features/06-models.md+++ b/website-docs/03-features/06-models.md@@ -174,24 +174,25 @@ builtin_models:### 厂商目录(catalog)-模型接入分三层,每层只做一件事:+模型接入按数据、厂商、运行时、协议分工:| 层 | 位置 | 职责 ||----|------|------|-| 协议层 | `internal/models/api/<protocol>` | 一个 wire 协议一个包。对话:`openaicompletions`、`openairesponses`、`anthropicmessages`、`googlegenai`;重排:`cohererank`、`dashscoperank`、`nimrerank`;向量:`openaiembeddings`、`dashscopeembeddings`、`arkembeddings`、`googleembeddings`;语音:`openaitranscriptions`。各自持有请求/响应结构与解析,不含任何厂商名 |-| 厂商层 | `internal/models/vendors/<id>/` | 一个厂商一个目录:`vendor.go`(注册 `catalog.Vendor`)、`models.json`(模型目录)、`icon.svg`(品牌图标,`go:embed` 进二进制) |-| 目录层 | `internal/models/catalog` | 合并厂商定义、模型条目、部署叠加与单行覆盖,`Resolve` 得出「这个模型到底怎么发请求」 |+| 协议层 | `internal/models/api/<protocol>` | 一个 wire 协议一个包。对话:`openaicompletions`、`openairesponses`、`anthropicmessages`、`googlegenai`;重排:`cohererank`、`dashscoperank`、`nimrerank`;向量:`openaiembeddings`、`dashscopeembeddings`、`arkembeddings`、`googleembeddings`;语音:`openaitranscriptions`。各自持有请求/响应结构与解析,不依赖厂商注册表或模型目录 |+| 厂商层 | `internal/models/providers/<id>.go` | 一个厂商一份定义,同时声明 Chat、Embedding、Rerank、ASR;图标放 `providers/assets/`,在 `builtin.go` 显式注册 |+| 目录层 | `internal/models/catalog` | 加载统一生成的目录,管理部署叠加与原子替换 |+| 运行时 | `internal/models/runtime` | 合并单个模型配置、选择协议、组装该模型的认证和端点,隔离旧字段推断 |-`catalog.Resolve(Ref{Provider, Model, BaseURL, Extra, Override})` 的合并顺序从低到高:+`runtime.Resolve(Ref{Provider, Model, BaseURL, Extra, Override})` 的合并顺序从低到高:1. 协议默认值(`DefaultOpenAICompletions()` 等);-2. 厂商级 `Compat`(`vendor.go` 里声明,例如 DeepSeek 的 `max_tokens_field: max_tokens`);-3. `models.json` 里匹配到的条目(精确 id → `aliases` → `match` 通配,最长字面前缀优先);+2. 厂商级 `Compat`(`providers/<id>.go` 里声明,例如 DeepSeek 的 `max_tokens_field: max_tokens`);+3. `catalog/data/models.generated.json` 里匹配到的条目(精确 id → `aliases` → `match` 通配,最长字面前缀优先);4. 部署叠加 `config/models.json`(见下);5. 模型行上的 `parameters.spec`(UI「高级」里的协议覆盖与 compat JSON);6. `extra_config.api` 强制协议、`extra_config.thinking_control` 旧版思考编码、`extra_config.remote_model_name`。-厂商事实全部忠实厂商文档,每个 `vendor.go` 的包注释列出依据与文档链接,`models.json` 的 `source` 字段记录来源。对应的出站 JSON 由各协议包的 golden 测试钉死(如 `openaicompletions/golden_test.go`)。+厂商参数依据厂商文档维护,每个 `providers/<id>.go` 的包注释列出依据与文档链接,目录条目的 `source` 字段记录来源。对应的出站 JSON 由各协议包的 golden 测试钉死(如 `openaicompletions/golden_test.go`)。#### 关键 compat 字段(OpenAI Chat Completions 方言)@@ -213,19 +214,18 @@ builtin_models:`GET /api/v1/models/providers?model_type=chat` 返回全部厂商定义(图标 data URI、默认地址、额外字段、内置模型与思考能力),前端完全据此动态渲染,没有本地厂商表。目前内置 27 个厂商:`generic`、`weknoracloud`、`aliyun`、`zhipu`、`volcengine`、`hunyuan`、`siliconflow`、`deepseek`、`minimax`、`moonshot`、`mimo`、`modelscope`、`qianfan`、`qiniu`、`longcat`、`lkeap`、`openai`、`azure_openai`、`anthropic`、`gemini`、`openrouter`、`litellm`、`requesty`、`jina`、`nvidia`、`novita`、`gpustack`;Ollama 走 `source=local` 独立路径。-协议选择:Anthropic 走 Messages 协议;Gemini 默认走原生 `generateContent`(`base_url` 指向 `/v1beta/openai` 则保持 OpenAI 兼容);OpenAI 在 `api.openai.com` 上走 Responses 协议,中转/代理保持 Chat Completions;任何厂商 `base_url` 以 `/anthropic` 结尾时自动切到 Messages 协议(MiniMax、智谱、Kimi 的 Anthropic 兼容口)。`extra_config.api` 可强制指定对话协议,只对 chat / VLM 行生效;embedding 行的协议覆盖写在 `spec.compat` 的 `"api"` 里,取值是向量协议(`openai-embeddings`、`dashscope-embeddings`、`ark-embeddings`、`google-embeddings`)。+协议选择:Anthropic 走 Messages 协议;Gemini 默认走原生 `generateContent`(`base_url` 指向 `/v1beta/openai` 则保持 OpenAI 兼容);OpenAI 在 `api.openai.com` 上走 Responses 协议,中转/代理保持 Chat Completions;任何厂商 `base_url` 以 `/anthropic` 结尾时自动切到 Messages 协议(MiniMax、智谱、Kimi 的 Anthropic 兼容口)。单行 `spec.api` 的明确选择优先于 URL 和厂商推断;兼容旧配置的 `extra_config.api` 仍具有最高优先级。`extra_config.api` 可强制指定对话协议,只对 chat / VLM 行生效;embedding 行的协议覆盖写在 `spec.compat` 的 `"api"` 里,取值是向量协议(`openai-embeddings`、`dashscope-embeddings`、`ark-embeddings`、`google-embeddings`)。目录条目按模型类型查找:embedding 行只匹配 embedding 条目,不会被同名前缀的对话通配(如百炼的 `qwen3*`、OpenAI 的 `gpt-5*`)套上对话的 compat。目录里还没有的新 id、带日期的快照照常按厂商默认解析。#### 新增厂商-代码侧新增一个厂商只需要一个目录,四个文件,不用改协议层和前端:+同一厂商的多种能力在一份定义中声明;共用协议不需要复制实现:-1. 复制一个相近的目录到 `internal/models/vendors/<id>/`,改 `vendor.go` 的 id、名称(`Names` 放中文名)、`Description`、默认地址、`Auth`、`Compat`、`ThinkingLevels`、`URLPatterns`,并在包注释里逐条写清依据的厂商文档链接;无法从文档确认的字段标 `unverified:`,不要臆测;-2. 按厂商文档填 `models.json`(`id`、`reasoning`、`input`、`context_window`、`max_output_tokens`、`cost`、`thinking_levels`、`compat`、`source`),同一家族用 `match` 通配(如 `"match": "gpt-5*"`),精确 id 优先于通配;-3. 放一个 `icon.svg`(LobeHub icons 或手绘,6 KB 以内),会 `go:embed` 进二进制并以 data URI 下发给前端;-4. 在 `vendors/all.go` 加一行 blank import;-5. 需要特殊 URL、协议选择或签名时实现 `Endpoint` / `PreferAPI` / `Signer` 钩子(参考 `azure_openai`、`openai`、`weknoracloud`)。+1. 新建 `internal/models/providers/<id>.go`,声明名称、能力、各类型默认地址、认证方式、协议默认值及特殊端点钩子,写明官方文档依据;+2. 在 `internal/models/catalog/data/seed.json` 的对应厂商中维护模型元数据;在 `internal/models/catalog/data/overrides.json` 中维护协议、思考映射与 compat 修正。模型键包含类型与 id / match,同名 Chat 和 Embedding 可以共存;+3. 将图标放入 `providers/assets/<id>.svg` 并引用,在 `providers/builtin.go` 的 `Builtins()` 列表加入定义,由 runtime 按厂商 ID 组合模型目录;+4. 执行 `make model-catalog-generate` 生成统一目录。生成文件不直接手改;已有协议可以复用,新协议才增加 `api/<protocol>` 包。然后跑一条命令,目录层的守护测试会自动覆盖新厂商,无需为它单独写用例:@@ -233,17 +233,17 @@ builtin_models:make model-catalog-check```-它包含三层校验:`vendors` 的注册与图标检查;`catalog` 的解析与叠加;`parity` 包的**不变量**(每个模型条目的字段合法性、compat 键名可解码、上下文与最大输出自洽)和**逐模型出站请求检查**(每个对话模型在思考开 / 关两种情况下,只能出现一个输出上限字段;不支持采样参数的模型不得带 temperature;始终思考的模型不得收到关闭开关等)。新加的厂商和模型一旦违反这些规则,测试直接失败。+它先检查生成数据是否过期,再运行模型模块全部测试:`providers` 的注册与图标检查;`runtime` 的解析与叠加;`parity` 包的**不变量**(每个模型条目的字段合法性、compat 键名可解码、上下文与最大输出自洽)和**逐模型出站请求检查**(每个对话模型在思考开 / 关两种情况下,只能出现一个输出上限字段;不支持采样参数的模型不得带 temperature;始终思考的模型不得收到关闭开关等)。新加的厂商和模型一旦违反这些规则,测试直接失败。前端不需要任何改动:厂商下拉、图标、额外字段、内置模型列表都由 `GET /api/v1/models/providers` 动态渲染。-写入侧也有一道闸:`catalog.ValidateRow` 会在创建 / 更新模型(REST)和加载 `config/builtin_models.yaml`(启动)时解析这行配置(全部模型类型),未知协议、拼错的 compat 键、非法的思考档位在写入时就被拒绝(YAML 行只打 WARN 不阻塞启动,避免一次重启把线上模型下线)。+写入侧也有一道闸:`runtime.ValidateRow` 会在创建 / 更新模型(REST)和加载 `config/builtin_models.yaml`(启动)时解析这行配置(全部模型类型),未知协议、拼错的 compat 键、非法的思考档位在写入时就被拒绝(YAML 行只打 WARN 不阻塞启动,避免一次重启把线上模型下线)。#### 厂商更新了模型怎么办分两种情况:-**只是新增 / 调整模型元数据**(新模型 id、上下文窗口、价格)。先拿差异报告,再人工核对厂商文档改 `models.json`:+**只是新增 / 调整模型元数据**(新模型 id、上下文窗口、价格)。先拿差异报告,再人工核对厂商文档更新 `internal/models/catalog/data/seed.json`,再运行 `make model-catalog-generate`:```bashmake model-catalog-diff # 全部厂商@@ -252,17 +252,17 @@ make model-catalog-diff VENDOR=deepseek # 只看一家报告对比 [models.dev](https://models.dev/api.json) 的公开元数据:`+` 是上游有而我们没有的模型,`~` 是数值差异,`?` 是上游没收录的条目(国内厂商和别名经常如此,不代表错)。脚本只读不写,也从不在运行时调用——**字段名、思考格式这类行为事实不会被自动同步**,必须以厂商文档为准手工维护,这是刻意的取舍:models.dev 不携带这些信息,自动同步会让线上请求悄悄改变行为。-**厂商改了接口行为**(换了输出上限字段、新增 effort 取值、思考开关格式变化)。改 `vendor.go` 或对应模型条目的 `compat`,并同步更新包注释里的文档链接;`internal/models/api/openaicompletions/golden_test.go` 之类的快照测试会把出站 JSON 钉死,改动必须先改测试预期,评审时一眼能看到行为变化。+**厂商改了接口行为**(换了输出上限字段、新增 effort 取值、思考开关格式变化)。改 `providers/<id>.go` 或 `catalog/data/overrides.json` 中对应模型的 `compat`,再生成目录,并同步更新包注释里的文档链接;`internal/models/api/openaicompletions/golden_test.go` 之类的快照测试会把出站 JSON 钉死,改动必须先改测试预期,评审时一眼能看到行为变化。**紧急情况不必等发版**:用下面的部署叠加在配置里先改,验证无误后再补回代码。#### 部署叠加 `config/models.json`-不改代码也能加厂商、改地址、补模型:复制 `config/models.json.example` 到 `config/models.json`(或用 `MODELS_CONFIG` 指定路径),结构与 PI 的 `~/.pi/agent/models.json` 一致:`providers` 按厂商 id 键入,已知 id 打补丁,新 id 声明新厂商;支持 `base_url` / `base_urls`、`api_key`(`${ENV}` 插值)、`headers`、`compat`、`thinking_levels`、`models`(按 id upsert:已存在的 id 只覆盖你写出来的字段,没写的 `reasoning`、`thinking_levels`、`compat`、`input` 保持原样;新 id 则整条新建)、`model_overrides`、`icon`(内联 `<svg …>` 字符串,或相对于叠加文件所在目录的 `.svg` 路径——不接受绝对路径、不能越出该目录、必须是 256 KB 以内的 SVG,因为图标会以 data URI 下发给所有能打开模型页的人)。未知键在启动时报错。运行时不会自动从外部拉取模型数据:字段名、思考格式这类行为事实必须由人维护。+不改代码也能加厂商、改地址、补模型:复制 `config/models.json.example` 到 `config/models.json`(或用 `MODELS_CONFIG` 指定路径),采用按厂商组织的部署覆盖结构:`providers` 按厂商 id 键入,已知 id 打补丁,新 id 声明新厂商;支持 `base_url` / `base_urls`、`api_key`(`${ENV}` 插值)、`headers`、`compat`、`thinking_levels`、`models`(按 id upsert:已存在的 id 只覆盖你写出来的字段,没写的 `reasoning`、`thinking_levels`、`compat`、`input` 保持原样;新 id 则整条新建)、`model_overrides`、`icon`(内联 `<svg …>` 字符串,或相对于叠加文件所在目录的 `.svg` 路径——不接受绝对路径、不能越出该目录、必须是 256 KB 以内的 SVG,因为图标会以 data URI 下发给所有能打开模型页的人)。未知键在启动时报错。运行时不会自动从外部拉取模型数据:字段名、思考格式这类行为事实必须由人维护。#### 升级到目录化实现的注意事项-老库里的模型行**不需要任何迁移**:`parameters` 列只增加了可选的 `spec` 字段,旧的 26 个 `provider` 取值全部仍然注册,`extra_config` 的历史键(`thinking_control` 的每个取值、`remote_model_name`、`api_version`、`secret_key`、`region`、`instruction`、`truncate_prompt_tokens`)语义不变,目录里已没有的模型 id(自定义微调、已退役型号)照常解析并保留思考开关。这些由 `internal/models/catalog/legacy_rows_test.go` 与 `internal/types/legacy_persisted_json_test.go` 钉住。+老库里的模型行**不需要任何迁移**:`parameters` 列只增加了可选的 `spec` 字段,旧的 26 个 `provider` 取值全部仍然注册,`extra_config` 的历史键(`thinking_control` 的每个取值、`remote_model_name`、`api_version`、`secret_key`、`region`、`instruction`、`truncate_prompt_tokens`)语义不变,目录里已没有的模型 id(自定义微调、已退役型号)照常解析并保留思考开关。这些由 `internal/models/runtime/legacy_rows_test.go` 与 `internal/types/legacy_persisted_json_test.go` 钉住。但有四处**既有模型行的运行时行为会变**,升级时需要知会使用者:@@ -313,7 +313,7 @@ flowchart TDS --> CF["ConfigFromModel<br/>(chat / embedding / rerank / vlm / asr)"]CF --> F{"工厂函数<br/>NewChat / NewEmbedder / ..."}F -->|"source = local"| OL["OllamaService<br/>(internal/models/utils/ollama)"]- F -->|"source = remote"| PD{"catalog.Resolve<br/>(厂商 + 模型 + 叠加 + 行覆盖)"}+ F -->|"source = remote"| PD{"runtime.Resolve<br/>(厂商 + 模型 + 叠加 + 行覆盖)"}PD -->|"anthropic-messages"| AN["anthropicmessages.Client"]PD -->|"openai-responses"| RS["openairesponses.Client"]PD -->|"google-generative-ai"| GG["googlegenai.Client"]@@ -349,3 +349,6 @@ return wrapChatConcurrency(c, config.MaxConcurrency, err)仓库根目录的 `rerank_server_demo.py` 是一个**自托管 Rerank 服务的最小参考实现**:FastAPI + HuggingFace `AutoModelForSequenceClassification`,暴露 `POST /rerank`,请求体 `{query, documents}`,返回 `{"results": [{index, document: {text}, score}]}`。示例服务返回 `score` 字段,可用于验证客户端兼容性。`RankResult.UnmarshalJSON` 优先读取 `relevance_score`,缺失时读取 `score`;`DocumentInfo.UnmarshalJSON` 同时接受字符串和 `{text}` 对象。遵循此协议的私有重排服务可通过 `generic` provider 接入。+++重构后的配置边界:每个模型仍单独保存 URL、API Key、额外参数和 `spec`,不新增连接实体,不修改模型 ID 或历史引用。部署覆盖每次从内置定义重新构建;通过 `runtime.Initialize` / `runtime.Reload` 校验后整体发布,失败保留旧版本。暂不监听文件变更,修改部署文件后仍需重启服务。