7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
feat(keys): discover models on a custom endpoint and seed them at the catalog median (#488) (#649)
Tashfeen43ddc6435393
diff --git a/client/src/components/keys/custom-provider-section.tsx b/client/src/components/keys/custom-provider-section.tsxindex d8b37146..0acb0030 100644--- a/client/src/components/keys/custom-provider-section.tsx+++ b/client/src/components/keys/custom-provider-section.tsx@@ -11,6 +11,7 @@ import { FieldError } from '@/components/ui/field-error'import { isHttpUrl } from '@/lib/validate'import { useI18n } from '@/i18n'import { toast } from '@/lib/toast'+import { DiscoverModelsDialog } from './discover-models-dialog'// Split a free-text model field on commas / newlines into a clean id list,// dropping blanks and duplicates so one endpoint can take several models. (#281)@@ -38,6 +39,9 @@ export function CustomProviderSection({ onAdded }: { onAdded?: () => void } = {}// calls) and vision off; declare them here or flip them later per model. (#470)const [supportsTools, setSupportsTools] = useState(true)const [supportsVision, setSupportsVision] = useState(false)+ // "Fetch models" asks the endpoint itself what it serves instead of making the+ // user paste ids from a curl (#488).+ const [discoverOpen, setDiscoverOpen] = useState(false)const models = customType === 'chat' ? parseModelList(model) : [model.trim()].filter(Boolean)const multiple = customType === 'chat' && models.length > 1@@ -163,7 +167,19 @@ export function CustomProviderSection({ onAdded }: { onAdded?: () => void } = {}{attempted && <FieldError error={baseUrlError} />}</div><div className="space-y-1.5">- <Label className="text-xs">{customType === 'chat' ? t('keys.customModels') : t('keys.customModel')}</Label>+ <div className="flex items-center justify-between gap-2">+ <Label className="text-xs">{customType === 'chat' ? t('keys.customModels') : t('keys.customModel')}</Label>+ {customType === 'chat' && (+ <button+ type="button"+ onClick={() => setDiscoverOpen(true)}+ disabled={!!baseUrlError}+ className="text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline disabled:pointer-events-none disabled:opacity-50"+ >+ {t('keys.discoverModels')}+ </button>+ )}+ </div><Textareavalue={model}onChange={e => setModel(e.target.value)}@@ -235,6 +251,14 @@ export function CustomProviderSection({ onAdded }: { onAdded?: () => void } = {}<p className="text-xs text-muted-foreground mb-3">{t('keys.addCustomDescription')}</p>{form}{errorLine}+ {discoverOpen && (+ <DiscoverModelsDialog+ open={discoverOpen}+ onOpenChange={setDiscoverOpen}+ endpoint={{ baseUrl, apiKey: apiKey || undefined }}+ onRegistered={onAdded}+ />+ )}</div>)}diff --git a/client/src/components/keys/discover-models-dialog.tsx b/client/src/components/keys/discover-models-dialog.tsxnew file mode 100644index 00000000..08e12ec7--- /dev/null+++ b/client/src/components/keys/discover-models-dialog.tsx@@ -0,0 +1,189 @@+import { useState } from 'react'+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'+import { apiFetch } from '@/lib/api'+import { Button } from '@/components/ui/button'+import { Dialog, DialogPopup, DialogTitle } from '@/components/ui/dialog'+import { useI18n } from '@/i18n'+import { toast } from '@/lib/toast'++// #488: relays add and drop models weekly, so keeping a custom endpoint's model+// list current by hand means re-running `curl .../v1/models | jq` every so+// often. Ask the endpoint instead, tick the ones to keep, register them in one+// call. Reads only the user's OWN endpoint with the user's OWN key.++export interface DiscoveredModel {+ id: string+ ownedBy: string | null+ registered: boolean+}++interface DiscoverResponse {+ baseUrl: string+ keyId: number | null+ models: DiscoveredModel[]+ total: number+ registeredCount: number+}++/** How the endpoint is named to the server: a saved key row, or a base URL the+ * user is still typing (with the key they typed alongside it). */+export interface EndpointRef {+ keyId?: number+ baseUrl?: string+ apiKey?: string+}++export function DiscoverModelsDialog({+ open,+ onOpenChange,+ endpoint,+ onRegistered,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+ endpoint: EndpointRef+ onRegistered?: () => void+}) {+ const { t } = useI18n()+ const queryClient = useQueryClient()+ // Only the ids the user ticked. Already-registered ones are rendered checked+ // and disabled without living here, so the list reads as "what this endpoint+ // will serve" while the Add button still counts only what is genuinely new.+ const [selected, setSelected] = useState<Set<string>>(new Set())++ // A query, not a mutation: the dialog is mounted only while open, so the+ // fetch fires on mount and the component needs no reset effect.+ const discover = useQuery<DiscoverResponse>({+ queryKey: ['custom-endpoint-models', endpoint.keyId ?? null, endpoint.baseUrl ?? null],+ queryFn: () => apiFetch('/api/keys/custom/discover-models', {+ method: 'POST',+ body: JSON.stringify(endpoint),+ }),+ retry: false,+ gcTime: 0,+ staleTime: 0,+ })+ const models = discover.data?.models ?? []++ const register = useMutation<{ created: number }>({+ meta: { silenceToast: true },+ mutationFn: () => apiFetch('/api/keys/custom', {+ method: 'POST',+ body: JSON.stringify({+ ...(endpoint.keyId === undefined ? { baseUrl: endpoint.baseUrl } : { keyId: endpoint.keyId }),+ ...(endpoint.apiKey ? { apiKey: endpoint.apiKey } : {}),+ models: [...selected],+ }),+ }),+ onSuccess: (data) => {+ for (const key of ['keys', 'health', 'fallback', 'models']) {+ queryClient.invalidateQueries({ queryKey: [key] })+ }+ toast.success(t('keys.modelsAdded', { count: data.created }))+ onOpenChange(false)+ onRegistered?.()+ },+ })++ const toggle = (id: string) => {+ setSelected(prev => {+ const next = new Set(prev)+ if (next.has(id)) next.delete(id)+ else next.add(id)+ return next+ })+ }++ const selectable = models.filter(m => !m.registered)+ const allSelected = selectable.length > 0 && selectable.every(m => selected.has(m.id))+ const toggleAll = () => {+ setSelected(prev => {+ const next = new Set(prev)+ for (const model of selectable) {+ if (allSelected) next.delete(model.id)+ else next.add(model.id)+ }+ return next+ })+ }++ const newCount = selected.size++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogPopup maxWidth="max-w-xl">+ <DialogTitle>{t('keys.discoverTitle')}</DialogTitle>+ <p className="mt-1 text-xs text-muted-foreground">{t('keys.discoverHint')}</p>++ {discover.isPending && (+ <p className="mt-4 text-xs text-muted-foreground">{t('common.loading')}</p>+ )}++ {discover.isError && (+ <p className="mt-4 text-xs text-destructive">{(discover.error as Error).message}</p>+ )}++ {discover.isSuccess && models.length === 0 && (+ <p className="mt-4 text-xs text-muted-foreground">{t('keys.discoverEmpty')}</p>+ )}++ {models.length > 0 && (+ <>+ <label className="mt-4 flex items-center gap-2 text-xs font-medium">+ <input+ type="checkbox"+ checked={allSelected}+ disabled={selectable.length === 0}+ onChange={toggleAll}+ className="size-4 accent-primary"+ />+ <span>{t('keys.discoverSelectAll')}</span>+ </label>+ <div className="mt-2 max-h-[45vh] overflow-y-auto rounded-2xl border divide-y">+ {models.map(model => (+ <label+ key={model.id}+ className={`flex items-center gap-2 px-3 py-2 text-xs ${model.registered ? 'bg-muted/40' : 'cursor-pointer hover:bg-muted/30'}`}+ >+ <input+ type="checkbox"+ checked={model.registered || selected.has(model.id)}+ disabled={model.registered}+ onChange={() => toggle(model.id)}+ className="size-4 accent-primary"+ />+ <code className="min-w-0 flex-1 truncate font-mono" title={model.id}>{model.id}</code>+ {model.ownedBy && (+ <span className="shrink-0 text-[11px] text-muted-foreground">{model.ownedBy}</span>+ )}+ {model.registered && (+ <span className="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">+ {t('keys.discoverAlreadyAdded')}+ </span>+ )}+ </label>+ ))}+ </div>+ </>+ )}++ {register.isError && (+ <p className="mt-3 text-xs text-destructive">{(register.error as Error).message}</p>+ )}++ <div className="mt-5 flex items-center justify-end gap-2">+ <Button variant="outline" size="sm" onClick={() => onOpenChange(false)}>+ {t('common.cancel')}+ </Button>+ <Button+ size="sm"+ onClick={() => register.mutate()}+ disabled={newCount === 0 || register.isPending}+ >+ {newCount === 1 ? t('keys.addModel') : t('keys.addModels', { count: newCount })}+ </Button>+ </div>+ </DialogPopup>+ </Dialog>+ )+}diff --git a/client/src/components/keys/provider-list.tsx b/client/src/components/keys/provider-list.tsxindex 62cb4995..48e41300 100644--- a/client/src/components/keys/provider-list.tsx+++ b/client/src/components/keys/provider-list.tsx@@ -17,7 +17,7 @@ import {DropdownMenuItem,DropdownMenuCheckboxItem,} from '@/components/ui/dropdown-menu'-import { ChevronDown, CircleAlert, ExternalLink, KeyRound, MoreHorizontal, Pencil, Plus, RefreshCw, Search, Trash2 } from 'lucide-react'+import { ChevronDown, CircleAlert, ExternalLink, KeyRound, ListPlus, MoreHorizontal, Pencil, Plus, RefreshCw, Search, Trash2 } from 'lucide-react'import type { ApiKey, ApiKeyModel } from '../../../../shared/types'import { formatSqliteUtcToLocalTime } from '@/lib/utils'import { useI18n } from '@/i18n'@@ -31,6 +31,7 @@ import {statusLabelKey,} from './shared'import type { HealthData } from './shared'+import { DiscoverModelsDialog } from './discover-models-dialog'type StatusFilter = 'all' | 'healthy' | 'issues' | 'disabled'@@ -48,6 +49,9 @@ export function ProviderList({ onAddKey }: { onAddKey: () => void }) {const [groupOverrides, setGroupOverrides] = useState<Map<string, boolean>>(new Map())const [search, setSearch] = useState('')const [statusFilter, setStatusFilter] = useState<StatusFilter>('all')+ // Custom endpoint whose model list is being fetched (#488) — relays change+ // what they serve constantly, so this is a repeat action, not a one-off.+ const [discoverKeyId, setDiscoverKeyId] = useState<number | null>(null)const editInputRef = useRef<HTMLInputElement>(null)const { data: keys = [], isLoading } = useQuery<ApiKey[]>({@@ -413,6 +417,18 @@ export function ProviderList({ onAddKey }: { onAddKey: () => void }) {<Pencil className="size-3" /></Button>)}+ {k.platform === 'custom' && k.baseUrl && (+ <Tooltip text={t('keys.discoverModels')}>+ <Button+ variant="ghost"+ size="icon-xs"+ onClick={() => setDiscoverKeyId(k.id)}+ aria-label={t('keys.discoverModels')}+ >+ <ListPlus className="size-3" />+ </Button>+ </Tooltip>+ )}<Tooltip text={t('keys.checkNow')}><Buttonvariant="ghost"@@ -486,6 +502,14 @@ export function ProviderList({ onAddKey }: { onAddKey: () => void }) {})}</div>)}++ {discoverKeyId !== null && (+ <DiscoverModelsDialog+ open+ onOpenChange={(open) => { if (!open) setDiscoverKeyId(null) }}+ endpoint={{ keyId: discoverKeyId }}+ />+ )}</div>)}diff --git a/client/src/i18n/locales/am.json b/client/src/i18n/locales/am.jsonindex 2bd0181a..3b08b408 100644--- a/client/src/i18n/locales/am.json+++ b/client/src/i18n/locales/am.json@@ -320,6 +320,13 @@"addImageModel": "የምስል ሞዴል ያክሉ","addAudioModel": "የድምጽ ሞዴል ያክሉ","addingCustom": "በማከል ላይ...",+ "discoverModels": "ሞዴሎችን አምጣ",+ "discoverTitle": "በዚህ መዳረሻ ላይ ያሉ ሞዴሎች",+ "discoverHint": "ለመመዝገብ ሞዴሎችን ይምረጡ። አስቀድመው የተጨመሩት ተቆልፈው ይቆያሉ።",+ "discoverEmpty": "ይህ መዳረሻ ምንም ሞዴል አልመለሰም።",+ "discoverAlreadyAdded": "ተጨምሯል",+ "discoverSelectAll": "ሁሉንም ምረጥ",+ "modelsAdded": "{count} ሞዴሎች ተጨመሩ","getApiKey": "API ቁልፍ ያግኙ","deleteKeyConfirm": "ይህን ቁልፍ ሰርዝ? ይህ ሊቀለበስ አይችልም።","checkAll": "ሁሉንም ያረጋግጡ",diff --git a/client/src/i18n/locales/ar.json b/client/src/i18n/locales/ar.jsonindex 76f53510..bc8bcaf2 100644--- a/client/src/i18n/locales/ar.json+++ b/client/src/i18n/locales/ar.json@@ -320,6 +320,13 @@"addImageModel": "إضافة نموذج الصورة","addAudioModel": "إضافة نموذج صوتي","addingCustom": "جارٍ الإضافة…",+ "discoverModels": "جلب النماذج",+ "discoverTitle": "النماذج على نقطة النهاية هذه",+ "discoverHint": "اختر النماذج المراد تسجيلها. النماذج المضافة مسبقاً تبقى مقفلة.",+ "discoverEmpty": "لم تُرجع نقطة النهاية أي نماذج.",+ "discoverAlreadyAdded": "مضاف",+ "discoverSelectAll": "تحديد الكل",+ "modelsAdded": "تمت إضافة {count} نموذجاً","getApiKey": "احصل على مفتاح API","deleteKeyConfirm": "هل تريد حذف هذا المفتاح؟ لا يمكن التراجع عن هذا.","checkAll": "تحقق من كل شيء",diff --git a/client/src/i18n/locales/az.json b/client/src/i18n/locales/az.jsonindex 1ce33521..4697c525 100644--- a/client/src/i18n/locales/az.json+++ b/client/src/i18n/locales/az.json@@ -320,6 +320,13 @@"addImageModel": "Şəkil modeli əlavə et","addAudioModel": "Audio model əlavə et","addingCustom": "Əlavə edirəm...",+ "discoverModels": "Modelləri gətir",+ "discoverTitle": "Bu son nöqtədəki modellər",+ "discoverHint": "Qeyd ediləcək modelləri seçin. Artıq əlavə edilənlər kilidli qalır.",+ "discoverEmpty": "Bu son nöqtə heç bir model qaytarmadı.",+ "discoverAlreadyAdded": "Əlavə edildi",+ "discoverSelectAll": "Hamısını seç",+ "modelsAdded": "{count} model əlavə edildi","getApiKey": "Açarı API","deleteKeyConfirm": "Bu açarı silmək? Bunu geri qaytarmaq mümkün deyil.","checkAll": "Hamısını yoxla",diff --git a/client/src/i18n/locales/bg.json b/client/src/i18n/locales/bg.jsonindex a35a6aea..611e79f3 100644--- a/client/src/i18n/locales/bg.json+++ b/client/src/i18n/locales/bg.json@@ -320,6 +320,13 @@"addImageModel": "Добави модел на изображението","addAudioModel": "Добави аудио модел","addingCustom": "Добавям...",+ "discoverModels": "Извличане на модели",+ "discoverTitle": "Модели на тази крайна точка",+ "discoverHint": "Изберете моделите за регистриране. Вече добавените остават заключени.",+ "discoverEmpty": "Тази крайна точка не върна модели.",+ "discoverAlreadyAdded": "Добавен",+ "discoverSelectAll": "Избери всички",+ "modelsAdded": "Добавени модели: {count}","getApiKey": "Вземи API ключа","deleteKeyConfirm": "Да изтрия този ключ? Това не може да бъде отменено.","checkAll": "Провери всички",diff --git a/client/src/i18n/locales/bn.json b/client/src/i18n/locales/bn.jsonindex f04e9cbf..71ecff57 100644--- a/client/src/i18n/locales/bn.json+++ b/client/src/i18n/locales/bn.json@@ -320,6 +320,13 @@"addImageModel": "ইমেজ মডেল যোগ করুন","addAudioModel": "অডিও মডেল যোগ করুন","addingCustom": "যোগ করা হচ্ছে...",+ "discoverModels": "মডেল আনুন",+ "discoverTitle": "এই এন্ডপয়েন্টের মডেল",+ "discoverHint": "নিবন্ধনের জন্য মডেল বেছে নিন। ইতিমধ্যে যোগ করা মডেল লক থাকে।",+ "discoverEmpty": "এই এন্ডপয়েন্ট কোনো মডেল ফেরত দেয়নি।",+ "discoverAlreadyAdded": "যোগ করা হয়েছে",+ "discoverSelectAll": "সব নির্বাচন করুন",+ "modelsAdded": "{count}টি মডেল যোগ করা হয়েছে","getApiKey": "API কী পান","deleteKeyConfirm": "এই কী মুছবেন? এটি পূর্বাবস্থায় ফেরানো যাবে না।","checkAll": "সব চেক করুন",diff --git a/client/src/i18n/locales/cs.json b/client/src/i18n/locales/cs.jsonindex 79de2a6e..0de74520 100644--- a/client/src/i18n/locales/cs.json+++ b/client/src/i18n/locales/cs.json@@ -320,6 +320,13 @@"addImageModel": "Přidat model obrazu","addAudioModel": "Přidat audio model","addingCustom": "Přidávám...",+ "discoverModels": "Načíst modely",+ "discoverTitle": "Modely na tomto endpointu",+ "discoverHint": "Vyberte modely k registraci. Již přidané zůstávají uzamčené.",+ "discoverEmpty": "Tento endpoint nevrátil žádné modely.",+ "discoverAlreadyAdded": "Přidáno",+ "discoverSelectAll": "Vybrat vše",+ "modelsAdded": "Přidáno modelů: {count}","getApiKey": "Získejte API klíč","deleteKeyConfirm": "Smazat tento klíč? To už nelze vzít zpět.","checkAll": "Vše zkontrolovat",diff --git a/client/src/i18n/locales/da.json b/client/src/i18n/locales/da.jsonindex 392d5370..32f1fb85 100644--- a/client/src/i18n/locales/da.json+++ b/client/src/i18n/locales/da.json@@ -320,6 +320,13 @@"addImageModel": "Tilføj billedmodel","addAudioModel": "Tilføj lydmodel","addingCustom": "Tilføjer...",+ "discoverModels": "Hent modeller",+ "discoverTitle": "Modeller på dette endpoint",+ "discoverHint": "Vælg de modeller, der skal registreres. Allerede tilføjede forbliver låst.",+ "discoverEmpty": "Dette endpoint returnerede ingen modeller.",+ "discoverAlreadyAdded": "Tilføjet",+ "discoverSelectAll": "Vælg alle",+ "modelsAdded": "{count} modeller tilføjet","getApiKey": "Få API nøgle","deleteKeyConfirm": "Slette denne nøgle? Det kan ikke gøres om.","checkAll": "Tjek alle",diff --git a/client/src/i18n/locales/de.json b/client/src/i18n/locales/de.jsonindex d2153500..e876c110 100644--- a/client/src/i18n/locales/de.json+++ b/client/src/i18n/locales/de.json@@ -320,6 +320,13 @@"addImageModel": "Bildmodell hinzufügen","addAudioModel": "Audiomodell hinzufügen","addingCustom": "Hinzufügen…",+ "discoverModels": "Modelle abrufen",+ "discoverTitle": "Modelle an diesem Endpunkt",+ "discoverHint": "Wähle die Modelle zum Registrieren. Bereits hinzugefügte bleiben gesperrt.",+ "discoverEmpty": "Dieser Endpunkt hat keine Modelle geliefert.",+ "discoverAlreadyAdded": "Hinzugefügt",+ "discoverSelectAll": "Alle auswählen",+ "modelsAdded": "{count} Modelle hinzugefügt","getApiKey": "Holen Sie sich den API-Schlüssel","deleteKeyConfirm": "Diesen Schlüssel löschen? Dies kann nicht rückgängig gemacht werden.","checkAll": "Überprüfen Sie alles",diff --git a/client/src/i18n/locales/el.json b/client/src/i18n/locales/el.jsonindex 93087460..18b10856 100644--- a/client/src/i18n/locales/el.json+++ b/client/src/i18n/locales/el.json@@ -320,6 +320,13 @@"addImageModel": "Προσθήκη μοντέλου εικόνας","addAudioModel": "Προσθήκη μοντέλου ήχου","addingCustom": "Προσθέτοντας...",+ "discoverModels": "Λήψη μοντέλων",+ "discoverTitle": "Μοντέλα σε αυτό το endpoint",+ "discoverHint": "Επίλεξε τα μοντέλα προς καταχώριση. Όσα έχεις ήδη προσθέσει μένουν κλειδωμένα.",+ "discoverEmpty": "Αυτό το endpoint δεν επέστρεψε μοντέλα.",+ "discoverAlreadyAdded": "Προστέθηκε",+ "discoverSelectAll": "Επιλογή όλων",+ "modelsAdded": "Προστέθηκαν {count} μοντέλα","getApiKey": "Αποκτήστε API κλειδί","deleteKeyConfirm": "Διαγραφή αυτού του κλειδιού; Αυτό δεν μπορεί να αναιρεθεί.","checkAll": "Έλεγχος όλων",diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.jsonindex 1bec5885..add06cb5 100644--- a/client/src/i18n/locales/en.json+++ b/client/src/i18n/locales/en.json@@ -342,6 +342,13 @@"addImageModel": "Add image model","addAudioModel": "Add audio model","addingCustom": "Adding…",+ "discoverModels": "Fetch models",+ "discoverTitle": "Models on this endpoint",+ "discoverHint": "Pick the models to register. Ones you already added stay locked.",+ "discoverEmpty": "This endpoint returned no models.",+ "discoverAlreadyAdded": "Added",+ "discoverSelectAll": "Select all",+ "modelsAdded": "{count} models added","getApiKey": "Get API key","deleteKeyConfirm": "Delete this key? This cannot be undone.","checkAll": "Check all",diff --git a/client/src/i18n/locales/es.json b/client/src/i18n/locales/es.jsonindex 7696c07f..0331076f 100644--- a/client/src/i18n/locales/es.json+++ b/client/src/i18n/locales/es.json@@ -320,6 +320,13 @@"addImageModel": "Agregar modelo de imagen","addAudioModel": "Agregar modelo de audio","addingCustom": "Añadiendo…",+ "discoverModels": "Obtener modelos",+ "discoverTitle": "Modelos en este endpoint",+ "discoverHint": "Elige los modelos a registrar. Los que ya añadiste quedan bloqueados.",+ "discoverEmpty": "Este endpoint no devolvió ningún modelo.",+ "discoverAlreadyAdded": "Añadido",+ "discoverSelectAll": "Seleccionar todo",+ "modelsAdded": "{count} modelos añadidos","getApiKey": "Obtener clave API","deleteKeyConfirm": "¿Eliminar esta clave? No se puede deshacer.","checkAll": "Comprobar todo",diff --git a/client/src/i18n/locales/fa.json b/client/src/i18n/locales/fa.jsonindex 72c02ac9..52f4a05b 100644--- a/client/src/i18n/locales/fa.json+++ b/client/src/i18n/locales/fa.json@@ -320,6 +320,13 @@"addImageModel": "اضافه کردن مدل تصویر","addAudioModel": "اضافه کردن مدل صوتی","addingCustom": "در حال افزودن…",+ "discoverModels": "دریافت مدلها",+ "discoverTitle": "مدلهای این نقطه پایانی",+ "discoverHint": "مدلهای موردنظر برای ثبت را انتخاب کنید. مدلهای افزودهشده قفل میمانند.",+ "discoverEmpty": "این نقطه پایانی هیچ مدلی برنگرداند.",+ "discoverAlreadyAdded": "افزوده شد",+ "discoverSelectAll": "انتخاب همه",+ "modelsAdded": "{count} مدل افزوده شد","getApiKey": "کلید API را دریافت کنید","deleteKeyConfirm": "این کلید حذف شود؟ این قابل واگرد نیست.","checkAll": "همه را بررسی کنید",diff --git a/client/src/i18n/locales/fi.json b/client/src/i18n/locales/fi.jsonindex befcee9d..5e1a0542 100644--- a/client/src/i18n/locales/fi.json+++ b/client/src/i18n/locales/fi.json@@ -320,6 +320,13 @@"addImageModel": "Lisää kuvamalli","addAudioModel": "Lisää äänimalli","addingCustom": "Lisään...",+ "discoverModels": "Hae mallit",+ "discoverTitle": "Tämän päätepisteen mallit",+ "discoverHint": "Valitse rekisteröitävät mallit. Jo lisätyt pysyvät lukittuina.",+ "discoverEmpty": "Tämä päätepiste ei palauttanut malleja.",+ "discoverAlreadyAdded": "Lisätty",+ "discoverSelectAll": "Valitse kaikki",+ "modelsAdded": "{count} mallia lisätty","getApiKey": "Hanki API avain","deleteKeyConfirm": "Poistatko tämän avaimen? Tätä ei voi perua.","checkAll": "Katso kaikki",diff --git a/client/src/i18n/locales/fr.json b/client/src/i18n/locales/fr.jsonindex 7c8c37b2..1cd326e6 100644--- a/client/src/i18n/locales/fr.json+++ b/client/src/i18n/locales/fr.json@@ -320,6 +320,13 @@"addImageModel": "Ajouter un modèle d'image","addAudioModel": "Ajouter un modèle audio","addingCustom": "Ajout…",+ "discoverModels": "Récupérer les modèles",+ "discoverTitle": "Modèles sur cet endpoint",+ "discoverHint": "Choisissez les modèles à enregistrer. Ceux déjà ajoutés restent verrouillés.",+ "discoverEmpty": "Cet endpoint n'a renvoyé aucun modèle.",+ "discoverAlreadyAdded": "Ajouté",+ "discoverSelectAll": "Tout sélectionner",+ "modelsAdded": "{count} modèles ajoutés","getApiKey": "Obtenir une clé API","deleteKeyConfirm": "Supprimer cette clé ? Cette action est irréversible.","checkAll": "Tout vérifier",diff --git a/client/src/i18n/locales/gu.json b/client/src/i18n/locales/gu.jsonindex 8ab7d3cc..0e6a2079 100644--- a/client/src/i18n/locales/gu.json+++ b/client/src/i18n/locales/gu.json@@ -320,6 +320,13 @@"addImageModel": "છબી મોડેલ ઉમેરો","addAudioModel": "ઓડિયો મોડલ ઉમેરો","addingCustom": "ઉમેરી રહ્યું છે...",+ "discoverModels": "મોડેલ મેળવો",+ "discoverTitle": "આ એન્ડપોઇન્ટ પરના મોડેલ",+ "discoverHint": "નોંધણી માટે મોડેલ પસંદ કરો. પહેલેથી ઉમેરેલા લોક રહે છે.",+ "discoverEmpty": "આ એન્ડપોઇન્ટે કોઈ મોડેલ પરત કર્યું નથી.",+ "discoverAlreadyAdded": "ઉમેરાયું",+ "discoverSelectAll": "બધા પસંદ કરો",+ "modelsAdded": "{count} મોડેલ ઉમેરાયા","getApiKey": "API કી મેળવો","deleteKeyConfirm": "આ કી કાઢી નાખીએ? આ પૂર્વવત્ કરી શકાતું નથી.","checkAll": "બધા તપાસો",diff --git a/client/src/i18n/locales/ha.json b/client/src/i18n/locales/ha.jsonindex e6505665..7e7fcce1 100644--- a/client/src/i18n/locales/ha.json+++ b/client/src/i18n/locales/ha.json@@ -320,6 +320,13 @@"addImageModel": "Ƙara samfurin hoto","addAudioModel": "Ƙara samfurin sauti","addingCustom": "Ana ƙara…",+ "discoverModels": "Ɗauko samfura",+ "discoverTitle": "Samfura a wannan matattarar",+ "discoverHint": "Zaɓi samfuran da za a yi rajista. Waɗanda aka riga aka ƙara sun kasance a kulle.",+ "discoverEmpty": "Wannan matattarar ba ta dawo da wani samfuri ba.",+ "discoverAlreadyAdded": "An ƙara",+ "discoverSelectAll": "Zaɓi duka",+ "modelsAdded": "An ƙara samfura {count}","getApiKey": "Samu maɓallin API","deleteKeyConfirm": "Share wannan maɓalli? Ba za a iya soke wannan ba.","checkAll": "Duba duka",diff --git a/client/src/i18n/locales/he.json b/client/src/i18n/locales/he.jsonindex 083a666d..6f5a99d9 100644--- a/client/src/i18n/locales/he.json+++ b/client/src/i18n/locales/he.json@@ -320,6 +320,13 @@"addImageModel": "מודל התמונה הוסף","addAudioModel": "הוסף מודל אודיו","addingCustom": "מוסיף...",+ "discoverModels": "משיכת מודלים",+ "discoverTitle": "מודלים בנקודת קצה זו",+ "discoverHint": "בחר את המודלים לרישום. אלה שכבר הוספת נשארים נעולים.",+ "discoverEmpty": "נקודת קצה זו לא החזירה מודלים.",+ "discoverAlreadyAdded": "נוסף",+ "discoverSelectAll": "בחר הכול",+ "modelsAdded": "{count} מודלים נוספו","getApiKey": "קח את המפתח API","deleteKeyConfirm": "למחוק את המפתח הזה? זה לא ניתן לביטול.","checkAll": "בדוק הכל",diff --git a/client/src/i18n/locales/hi.json b/client/src/i18n/locales/hi.jsonindex 91aa3a61..fe607c45 100644--- a/client/src/i18n/locales/hi.json+++ b/client/src/i18n/locales/hi.json@@ -320,6 +320,13 @@"addImageModel": "छवि मॉडल जोड़ें","addAudioModel": "ऑडियो मॉडल जोड़ें","addingCustom": "जोड़ा जा रहा है...",+ "discoverModels": "मॉडल लाएँ",+ "discoverTitle": "इस एंडपॉइंट के मॉडल",+ "discoverHint": "पंजीकृत करने के लिए मॉडल चुनें। पहले से जोड़े गए मॉडल लॉक रहते हैं।",+ "discoverEmpty": "इस एंडपॉइंट ने कोई मॉडल नहीं लौटाया।",+ "discoverAlreadyAdded": "जोड़ा गया",+ "discoverSelectAll": "सभी चुनें",+ "modelsAdded": "{count} मॉडल जोड़े गए","getApiKey": "API कुंजी प्राप्त करें","deleteKeyConfirm": "यह कुंजी हटाएं? इसे असंपादित नहीं किया जा सकता है।","checkAll": "सभी की जांच करें",diff --git a/client/src/i18n/locales/hr.json b/client/src/i18n/locales/hr.jsonindex 4d7d4f78..552508be 100644--- a/client/src/i18n/locales/hr.json+++ b/client/src/i18n/locales/hr.json@@ -320,6 +320,13 @@"addImageModel": "Dodajte model slike","addAudioModel": "Dodaj audio model","addingCustom": "Dodajem...",+ "discoverModels": "Dohvati modele",+ "discoverTitle": "Modeli na ovoj krajnjoj točki",+ "discoverHint": "Odaberi modele za registraciju. Već dodani ostaju zaključani.",+ "discoverEmpty": "Ova krajnja točka nije vratila nijedan model.",+ "discoverAlreadyAdded": "Dodano",+ "discoverSelectAll": "Odaberi sve",+ "modelsAdded": "Dodano modela: {count}","getApiKey": "Uzmi API ključ","deleteKeyConfirm": "Izbrisati ovaj ključ? To se ne može poništiti.","checkAll": "Provjeri sve",diff --git a/client/src/i18n/locales/hu.json b/client/src/i18n/locales/hu.jsonindex a34deb4c..7e464f8e 100644--- a/client/src/i18n/locales/hu.json+++ b/client/src/i18n/locales/hu.json@@ -320,6 +320,13 @@"addImageModel": "Képmodell hozzáadása","addAudioModel": "Hangmodell hozzáadása","addingCustom": "Hozzátéve...",+ "discoverModels": "Modellek lekérése",+ "discoverTitle": "Modellek ezen a végponton",+ "discoverHint": "Válaszd ki a regisztrálandó modelleket. A már hozzáadottak zárolva maradnak.",+ "discoverEmpty": "Ez a végpont nem adott vissza modellt.",+ "discoverAlreadyAdded": "Hozzáadva",+ "discoverSelectAll": "Összes kijelölése",+ "modelsAdded": "{count} modell hozzáadva","getApiKey": "Szerezd API kulcsot","deleteKeyConfirm": "Törölni ezt a kulcsot? Ezt nem lehet visszafordítani.","checkAll": "Nézd meg mindet",diff --git a/client/src/i18n/locales/id.json b/client/src/i18n/locales/id.jsonindex 41e150bc..c190fa67 100644--- a/client/src/i18n/locales/id.json+++ b/client/src/i18n/locales/id.json@@ -320,6 +320,13 @@"addImageModel": "Tambahkan model gambar","addAudioModel": "Tambahkan model audio","addingCustom": "Menambahkan…",+ "discoverModels": "Ambil model",+ "discoverTitle": "Model di endpoint ini",+ "discoverHint": "Pilih model yang akan didaftarkan. Yang sudah ditambahkan tetap terkunci.",+ "discoverEmpty": "Endpoint ini tidak mengembalikan model apa pun.",+ "discoverAlreadyAdded": "Ditambahkan",+ "discoverSelectAll": "Pilih semua",+ "modelsAdded": "{count} model ditambahkan","getApiKey": "Dapatkan kunci API","deleteKeyConfirm": "Hapus kunci ini? Hal ini tidak dapat dibatalkan.","checkAll": "Periksa semuanya",diff --git a/client/src/i18n/locales/ig.json b/client/src/i18n/locales/ig.jsonindex 8b3e9af4..55990ed9 100644--- a/client/src/i18n/locales/ig.json+++ b/client/src/i18n/locales/ig.json@@ -320,6 +320,13 @@"addImageModel": "Tinye ihe onyonyo","addAudioModel": "Tinye ụdị ọdịyo","addingCustom": "Na-agbakwụnye…",+ "discoverModels": "Weta ụdị",+ "discoverTitle": "Ụdị dị na njedebe a",+ "discoverHint": "Họrọ ụdị ị ga-edebanye. Ndị i tinyerelarị na-anọgide na-akpọchi.",+ "discoverEmpty": "Njedebe a ewetaghị ụdị ọ bụla.",+ "discoverAlreadyAdded": "Etinyere",+ "discoverSelectAll": "Họrọ ha niile",+ "modelsAdded": "Etinyere ụdị {count}","getApiKey": "Nweta igodo API","deleteKeyConfirm": "Hichapụ igodo a? Enweghị ike imegharị nke a.","checkAll": "Lelee ihe niile",diff --git a/client/src/i18n/locales/it.json b/client/src/i18n/locales/it.jsonindex d0e23359..a8204e51 100644--- a/client/src/i18n/locales/it.json+++ b/client/src/i18n/locales/it.json@@ -320,6 +320,13 @@"addImageModel": "Aggiungi modello immagine","addAudioModel": "Aggiungi modello audio","addingCustom": "Aggiunta…",+ "discoverModels": "Recupera modelli",+ "discoverTitle": "Modelli su questo endpoint",+ "discoverHint": "Scegli i modelli da registrare. Quelli già aggiunti restano bloccati.",+ "discoverEmpty": "Questo endpoint non ha restituito modelli.",+ "discoverAlreadyAdded": "Aggiunto",+ "discoverSelectAll": "Seleziona tutto",+ "modelsAdded": "{count} modelli aggiunti","getApiKey": "Ottieni chiave API","deleteKeyConfirm": "Eliminare questa chiave? Non è possibile annullare.","checkAll": "Controlla tutto",diff --git a/client/src/i18n/locales/ja.json b/client/src/i18n/locales/ja.jsonindex 9774bd99..d758ac5c 100644--- a/client/src/i18n/locales/ja.json+++ b/client/src/i18n/locales/ja.json@@ -320,6 +320,13 @@"addImageModel": "画像モデルを追加","addAudioModel": "オーディオモデルの追加","addingCustom": "追加中…",+ "discoverModels": "モデルを取得",+ "discoverTitle": "このエンドポイントのモデル",+ "discoverHint": "登録するモデルを選択してください。追加済みのモデルはロックされます。",+ "discoverEmpty": "このエンドポイントはモデルを返しませんでした。",+ "discoverAlreadyAdded": "追加済み",+ "discoverSelectAll": "すべて選択",+ "modelsAdded": "{count} 個のモデルを追加しました","getApiKey": "APIキーを取得する","deleteKeyConfirm": "このキーを削除しますか?これを元に戻すことはできません。","checkAll": "すべてチェックしてください",diff --git a/client/src/i18n/locales/ka.json b/client/src/i18n/locales/ka.jsonindex bda92f6f..4e47f48a 100644--- a/client/src/i18n/locales/ka.json+++ b/client/src/i18n/locales/ka.json@@ -320,6 +320,13 @@"addImageModel": "სურათის მოდელის დამატება","addAudioModel": "აუდიო მოდელის დამატება","addingCustom": "ემატება…",+ "discoverModels": "მოდელების მიღება",+ "discoverTitle": "მოდელები ამ ბოლოწერტილზე",+ "discoverHint": "აირჩიე რეგისტრირებადი მოდელები. უკვე დამატებულები ჩაკეტილი რჩება.",+ "discoverEmpty": "ამ ბოლოწერტილმა მოდელები არ დააბრუნა.",+ "discoverAlreadyAdded": "დამატებულია",+ "discoverSelectAll": "ყველას მონიშვნა",+ "modelsAdded": "დამატებულია {count} მოდელი","getApiKey": "მიიღეთ API გასაღები","deleteKeyConfirm": "წაშალოთ ეს გასაღები? ამის გაუქმება შეუძლებელია.","checkAll": "შეამოწმეთ ყველა",diff --git a/client/src/i18n/locales/km.json b/client/src/i18n/locales/km.jsonindex 83c1f098..13dd2f79 100644--- a/client/src/i18n/locales/km.json+++ b/client/src/i18n/locales/km.json@@ -320,6 +320,13 @@"addImageModel": "បន្ថែមម៉ូដែលរូបភាព","addAudioModel": "បន្ថែមម៉ូដែលសំឡេង","addingCustom": "បន្ថែម...",+ "discoverModels": "ទាញយកម៉ូដែល",+ "discoverTitle": "ម៉ូដែលនៅចំណុចបញ្ចប់នេះ",+ "discoverHint": "ជ្រើសរើសម៉ូដែលដើម្បីចុះឈ្មោះ។ ម៉ូដែលដែលបានបន្ថែមរួចនៅតែជាប់សោ។",+ "discoverEmpty": "ចំណុចបញ្ចប់នេះមិនបានផ្តល់ម៉ូដែលណាមួយទេ។",+ "discoverAlreadyAdded": "បានបន្ថែម",+ "discoverSelectAll": "ជ្រើសរើសទាំងអស់",+ "modelsAdded": "បានបន្ថែមម៉ូដែល {count}","getApiKey": "ទទួលបានកូនសោ API","deleteKeyConfirm": "លុបកូនសោនេះ? នេះមិនអាចត្រឡប់វិញបានទេ។","checkAll": "ពិនិត្យទាំងអស់",diff --git a/client/src/i18n/locales/kn.json b/client/src/i18n/locales/kn.jsonindex 51667dcd..9b3cd6e6 100644--- a/client/src/i18n/locales/kn.json+++ b/client/src/i18n/locales/kn.json@@ -320,6 +320,13 @@"addImageModel": "ಚಿತ್ರದ ಮಾದರಿಯನ್ನು ಸೇರಿಸಿ","addAudioModel": "ಆಡಿಯೋ ಮಾದರಿಯನ್ನು ಸೇರಿಸಿ","addingCustom": "ಸೇರಿಸಲಾಗುತ್ತಿದೆ...",+ "discoverModels": "ಮಾದರಿಗಳನ್ನು ತರಿಸಿ",+ "discoverTitle": "ಈ ಎಂಡ್ಪಾಯಿಂಟ್ನ ಮಾದರಿಗಳು",+ "discoverHint": "ನೋಂದಾಯಿಸಬೇಕಾದ ಮಾದರಿಗಳನ್ನು ಆರಿಸಿ. ಈಗಾಗಲೇ ಸೇರಿಸಿದವು ಲಾಕ್ ಆಗಿರುತ್ತವೆ.",+ "discoverEmpty": "ಈ ಎಂಡ್ಪಾಯಿಂಟ್ ಯಾವ ಮಾದರಿಯನ್ನೂ ಹಿಂತಿರುಗಿಸಲಿಲ್ಲ.",+ "discoverAlreadyAdded": "ಸೇರಿಸಲಾಗಿದೆ",+ "discoverSelectAll": "ಎಲ್ಲವನ್ನೂ ಆರಿಸಿ",+ "modelsAdded": "{count} ಮಾದರಿಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ","getApiKey": "API ಕೀಯನ್ನು ಪಡೆಯಿರಿ","deleteKeyConfirm": "ಈ ಕೀಲಿಯನ್ನು ಅಳಿಸುವುದೇ? ಇದನ್ನು ರದ್ದುಗೊಳಿಸಲಾಗುವುದಿಲ್ಲ.","checkAll": "ಎಲ್ಲವನ್ನೂ ಪರಿಶೀಲಿಸಿ",diff --git a/client/src/i18n/locales/ko.json b/client/src/i18n/locales/ko.jsonindex 69e88162..5391c9ec 100644--- a/client/src/i18n/locales/ko.json+++ b/client/src/i18n/locales/ko.json@@ -320,6 +320,13 @@"addImageModel": "이미지 모델 추가","addAudioModel": "오디오 모델 추가","addingCustom": "추가 중…",+ "discoverModels": "모델 가져오기",+ "discoverTitle": "이 엔드포인트의 모델",+ "discoverHint": "등록할 모델을 선택하세요. 이미 추가된 모델은 잠긴 상태로 유지됩니다.",+ "discoverEmpty": "이 엔드포인트가 모델을 반환하지 않았습니다.",+ "discoverAlreadyAdded": "추가됨",+ "discoverSelectAll": "전체 선택",+ "modelsAdded": "모델 {count}개를 추가했습니다","getApiKey": "API 키 가져오기","deleteKeyConfirm": "이 키를 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.","checkAll": "모두 확인",diff --git a/client/src/i18n/locales/lt.json b/client/src/i18n/locales/lt.jsonindex a3b8278f..9c99b19f 100644--- a/client/src/i18n/locales/lt.json+++ b/client/src/i18n/locales/lt.json@@ -320,6 +320,13 @@"addImageModel": "Pridėti paveikslėlio modelį","addAudioModel": "Pridėti garso modelį","addingCustom": "Prideda...",+ "discoverModels": "Gauti modelius",+ "discoverTitle": "Modeliai šiame galiniame taške",+ "discoverHint": "Pasirink registruotinus modelius. Jau pridėti lieka užrakinti.",+ "discoverEmpty": "Šis galinis taškas negrąžino modelių.",+ "discoverAlreadyAdded": "Pridėta",+ "discoverSelectAll": "Pasirinkti viską",+ "modelsAdded": "Pridėta modelių: {count}","getApiKey": "Gauk API raktą","deleteKeyConfirm": "Ištrinti šį raktą? Tai negali būti atšaukta.","checkAll": "Patikrinkite viską",diff --git a/client/src/i18n/locales/ml.json b/client/src/i18n/locales/ml.jsonindex 1ccbf2cc..64afc54a 100644--- a/client/src/i18n/locales/ml.json+++ b/client/src/i18n/locales/ml.json@@ -320,6 +320,13 @@"addImageModel": "ഇമേജ് മോഡൽ ചേർക്കുക","addAudioModel": "ഓഡിയോ മോഡൽ ചേർക്കുക","addingCustom": "ചേർക്കുന്നു...",+ "discoverModels": "മോഡലുകൾ എടുക്കുക",+ "discoverTitle": "ഈ എൻഡ്പോയിന്റിലെ മോഡലുകൾ",+ "discoverHint": "രജിസ്റ്റർ ചെയ്യേണ്ട മോഡലുകൾ തിരഞ്ഞെടുക്കുക. ഇതിനകം ചേർത്തവ ലോക്ക് ആയി തുടരും.",+ "discoverEmpty": "ഈ എൻഡ്പോയിന്റ് ഒരു മോഡലും നൽകിയില്ല.",+ "discoverAlreadyAdded": "ചേർത്തു",+ "discoverSelectAll": "എല്ലാം തിരഞ്ഞെടുക്കുക",+ "modelsAdded": "{count} മോഡലുകൾ ചേർത്തു","getApiKey": "API കീ നേടുക","deleteKeyConfirm": "ഈ കീ ഇല്ലാതാക്കണോ? ഇത് പഴയപടിയാക്കാനാകില്ല.","checkAll": "എല്ലാം പരിശോധിക്കുക",diff --git a/client/src/i18n/locales/mr.json b/client/src/i18n/locales/mr.jsonindex bb8354b8..6484ec54 100644--- a/client/src/i18n/locales/mr.json+++ b/client/src/i18n/locales/mr.json@@ -320,6 +320,13 @@"addImageModel": "प्रतिमा मॉडेल जोडा","addAudioModel": "ऑडिओ मॉडेल जोडा","addingCustom": "जोडत आहे...",+ "discoverModels": "मॉडेल आणा",+ "discoverTitle": "या एंडपॉइंटवरील मॉडेल",+ "discoverHint": "नोंदणीसाठी मॉडेल निवडा. आधीच जोडलेली मॉडेल लॉक राहतात.",+ "discoverEmpty": "या एंडपॉइंटने कोणतेही मॉडेल परत केले नाही.",+ "discoverAlreadyAdded": "जोडले",+ "discoverSelectAll": "सर्व निवडा",+ "modelsAdded": "{count} मॉडेल जोडली","getApiKey": "API की मिळवा","deleteKeyConfirm": "ही की हटवायची? हे पूर्ववत केले जाऊ शकत नाही.","checkAll": "सर्व तपासा",diff --git a/client/src/i18n/locales/ms.json b/client/src/i18n/locales/ms.jsonindex 87f68cf9..36e30e42 100644--- a/client/src/i18n/locales/ms.json+++ b/client/src/i18n/locales/ms.json@@ -320,6 +320,13 @@"addImageModel": "Tambah model imej","addAudioModel": "Tambah model audio","addingCustom": "Menambah...",+ "discoverModels": "Dapatkan model",+ "discoverTitle": "Model pada endpoint ini",+ "discoverHint": "Pilih model untuk didaftarkan. Yang sudah ditambah kekal terkunci.",+ "discoverEmpty": "Endpoint ini tidak mengembalikan sebarang model.",+ "discoverAlreadyAdded": "Ditambah",+ "discoverSelectAll": "Pilih semua",+ "modelsAdded": "{count} model ditambah","getApiKey": "Dapatkan kunci API","deleteKeyConfirm": "Padamkan kunci ini? Ini tidak boleh dibatalkan.","checkAll": "Semak semua",diff --git a/client/src/i18n/locales/my.json b/client/src/i18n/locales/my.jsonindex 39e25f2c..9d65b423 100644--- a/client/src/i18n/locales/my.json+++ b/client/src/i18n/locales/my.json@@ -320,6 +320,13 @@"addImageModel": "ပုံမော်ဒယ်ထည့်ပါ","addAudioModel": "အသံမော်ဒယ် ထည့်ပါ","addingCustom": "ထပ်ထည့်နေသည်...",+ "discoverModels": "မော်ဒယ်များ ရယူရန်",+ "discoverTitle": "ဤအဆုံးမှတ်ရှိ မော်ဒယ်များ",+ "discoverHint": "မှတ်ပုံတင်မည့် မော်ဒယ်များကို ရွေးပါ။ ထည့်ပြီးသားများမှာ သော့ခတ်ထားသည်။",+ "discoverEmpty": "ဤအဆုံးမှတ်က မော်ဒယ်တစ်ခုမျှ မပြန်ပါ။",+ "discoverAlreadyAdded": "ထည့်ပြီး",+ "discoverSelectAll": "အားလုံးရွေးရန်",+ "modelsAdded": "မော်ဒယ် {count} ခု ထည့်ပြီး","getApiKey": "သော့ကို API","deleteKeyConfirm": "ဒီ key ကို ဖျက်လိုက်မလား? ဒါကို ပြန်လည်ပြင်ဆင်လို့ မရပါ။","checkAll": "အားလုံးကို စစ်ဆေးပါ",diff --git a/client/src/i18n/locales/ne.json b/client/src/i18n/locales/ne.jsonindex f4f87567..1568871c 100644--- a/client/src/i18n/locales/ne.json+++ b/client/src/i18n/locales/ne.json@@ -320,6 +320,13 @@"addImageModel": "छवि नमूना थप्नुहोस्","addAudioModel": "अडियो नमूना थप्नुहोस्","addingCustom": "थप्दैछ...",+ "discoverModels": "मोडेल ल्याउनुहोस्",+ "discoverTitle": "यो एन्डपोइन्टका मोडेलहरू",+ "discoverHint": "दर्ता गर्ने मोडेलहरू छान्नुहोस्। पहिल्यै थपिएका लक रहन्छन्।",+ "discoverEmpty": "यो एन्डपोइन्टले कुनै मोडेल फर्काएन।",+ "discoverAlreadyAdded": "थपियो",+ "discoverSelectAll": "सबै छान्नुहोस्",+ "modelsAdded": "{count} मोडेल थपिए","getApiKey": "कुञ्जी API गर्नुहोस्","deleteKeyConfirm": "यो कुञ्जी मेट्नुहुन्छ? यसलाई पूर्ववत गर्न सकिँदैन ।","checkAll": "सबै जाँच गर्नुहोस्",diff --git a/client/src/i18n/locales/nl.json b/client/src/i18n/locales/nl.jsonindex 3d12a842..c82d9f7e 100644--- a/client/src/i18n/locales/nl.json+++ b/client/src/i18n/locales/nl.json@@ -320,6 +320,13 @@"addImageModel": "Voeg beeldmodel toe","addAudioModel": "Audiomodel toevoegen","addingCustom": "En ik voeg toe...",+ "discoverModels": "Modellen ophalen",+ "discoverTitle": "Modellen op dit endpoint",+ "discoverHint": "Kies de modellen om te registreren. Al toegevoegde blijven vergrendeld.",+ "discoverEmpty": "Dit endpoint gaf geen modellen terug.",+ "discoverAlreadyAdded": "Toegevoegd",+ "discoverSelectAll": "Alles selecteren",+ "modelsAdded": "{count} modellen toegevoegd","getApiKey": "Haal API sleutel","deleteKeyConfirm": "Deze sleutel verwijderen? Dit kan niet ongedaan worden gemaakt.","checkAll": "Controleer alles",diff --git a/client/src/i18n/locales/no.json b/client/src/i18n/locales/no.jsonindex 789fec7b..3b63f8ef 100644--- a/client/src/i18n/locales/no.json+++ b/client/src/i18n/locales/no.json@@ -320,6 +320,13 @@"addImageModel": "Legg til bildemodell","addAudioModel": "Legg til lydmodell","addingCustom": "Legger til...",+ "discoverModels": "Hent modeller",+ "discoverTitle": "Modeller på dette endepunktet",+ "discoverHint": "Velg modellene som skal registreres. Allerede lagt til forblir låst.",+ "discoverEmpty": "Dette endepunktet returnerte ingen modeller.",+ "discoverAlreadyAdded": "Lagt til",+ "discoverSelectAll": "Velg alle",+ "modelsAdded": "{count} modeller lagt til","getApiKey": "Få tak i nøkkelen API","deleteKeyConfirm": "Slette denne nøkkelen? Dette kan ikke gjøres om.","checkAll": "Sjekk alt",diff --git a/client/src/i18n/locales/or.json b/client/src/i18n/locales/or.jsonindex e23630fa..5f406d56 100644--- a/client/src/i18n/locales/or.json+++ b/client/src/i18n/locales/or.json@@ -320,6 +320,13 @@"addImageModel": "ଫଟୋ ମଡେଲ୍ ଯୋଡନ୍ତୁ","addAudioModel": "ଅଡିଓ ମଡେଲ୍ ଯୋଡନ୍ତୁ","addingCustom": "ଯୋଡ଼ିବା...",+ "discoverModels": "ମଡେଲ ଆଣନ୍ତୁ",+ "discoverTitle": "ଏହି ଏଣ୍ଡପଏଣ୍ଟର ମଡେଲ",+ "discoverHint": "ପଞ୍ଜୀକରଣ ପାଇଁ ମଡେଲ ବାଛନ୍ତୁ। ପୂର୍ବରୁ ଯୋଡ଼ାଯାଇଥିବା ମଡେଲ ଲକ୍ ରହିଥାଏ।",+ "discoverEmpty": "ଏହି ଏଣ୍ଡପଏଣ୍ଟ କୌଣସି ମଡେଲ ଫେରାଇନାହିଁ।",+ "discoverAlreadyAdded": "ଯୋଡ଼ାଯାଇଛି",+ "discoverSelectAll": "ସବୁ ବାଛନ୍ତୁ",+ "modelsAdded": "{count} ମଡେଲ ଯୋଡ଼ାଗଲା","getApiKey": "API କୀ ପ୍ରାପ୍ତ କରନ୍ତୁ","deleteKeyConfirm": "ଏହି କୀ ବିଲୋପ କରିବେ? ଏହା ପୂର୍ବବତ୍ ହୋଇପାରିବ ନାହିଁ।","checkAll": "ସମସ୍ତ ଯାଞ୍ଚ କରନ୍ତୁ",diff --git a/client/src/i18n/locales/pa.json b/client/src/i18n/locales/pa.jsonindex 9b17692c..10e26ff0 100644--- a/client/src/i18n/locales/pa.json+++ b/client/src/i18n/locales/pa.json@@ -320,6 +320,13 @@"addImageModel": "ਚਿੱਤਰ ਮਾਡਲ ਸ਼ਾਮਲ ਕਰੋ","addAudioModel": "ਆਡੀਓ ਮਾਡਲ ਸ਼ਾਮਲ ਕਰੋ","addingCustom": "ਜੋੜ ਰਿਹਾ ਹੈ...",+ "discoverModels": "ਮਾਡਲ ਲਿਆਓ",+ "discoverTitle": "ਇਸ ਐਂਡਪੌਇੰਟ ਦੇ ਮਾਡਲ",+ "discoverHint": "ਰਜਿਸਟਰ ਕਰਨ ਲਈ ਮਾਡਲ ਚੁਣੋ। ਪਹਿਲਾਂ ਜੋੜੇ ਮਾਡਲ ਲਾਕ ਰਹਿੰਦੇ ਹਨ।",+ "discoverEmpty": "ਇਸ ਐਂਡਪੌਇੰਟ ਨੇ ਕੋਈ ਮਾਡਲ ਨਹੀਂ ਦਿੱਤਾ।",+ "discoverAlreadyAdded": "ਜੋੜਿਆ ਗਿਆ",+ "discoverSelectAll": "ਸਭ ਚੁਣੋ",+ "modelsAdded": "{count} ਮਾਡਲ ਜੋੜੇ ਗਏ","getApiKey": "API ਕੁੰਜੀ ਪ੍ਰਾਪਤ ਕਰੋ","deleteKeyConfirm": "ਕੀ ਇਸ ਕੁੰਜੀ ਨੂੰ ਮਿਟਾਉਣਾ ਹੈ? ਇਸਨੂੰ ਅਣਕੀਤਾ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ।","checkAll": "ਸਭ ਦੀ ਜਾਂਚ ਕਰੋ",diff --git a/client/src/i18n/locales/pl.json b/client/src/i18n/locales/pl.jsonindex ae17c681..368ebb94 100644--- a/client/src/i18n/locales/pl.json+++ b/client/src/i18n/locales/pl.json@@ -320,6 +320,13 @@"addImageModel": "Dodaj model obrazu","addAudioModel": "Dodaj model audio","addingCustom": "Dodawanie…",+ "discoverModels": "Pobierz modele",+ "discoverTitle": "Modele w tym punkcie końcowym",+ "discoverHint": "Wybierz modele do zarejestrowania. Już dodane pozostają zablokowane.",+ "discoverEmpty": "Ten punkt końcowy nie zwrócił żadnych modeli.",+ "discoverAlreadyAdded": "Dodano",+ "discoverSelectAll": "Zaznacz wszystko",+ "modelsAdded": "Dodano modeli: {count}","getApiKey": "Zdobądź klucz API","deleteKeyConfirm": "Usunąć ten klucz? Tego nie można cofnąć.","checkAll": "Sprawdź wszystko",diff --git a/client/src/i18n/locales/pt-BR.json b/client/src/i18n/locales/pt-BR.jsonindex e81d3751..0349ac94 100644--- a/client/src/i18n/locales/pt-BR.json+++ b/client/src/i18n/locales/pt-BR.json@@ -320,6 +320,13 @@"addImageModel": "Adicionar modelo de imagem","addAudioModel": "Adicionar modelo de áudio","addingCustom": "Adicionando…",+ "discoverModels": "Buscar modelos",+ "discoverTitle": "Modelos neste endpoint",+ "discoverHint": "Escolha os modelos a registrar. Os já adicionados ficam bloqueados.",+ "discoverEmpty": "Este endpoint não retornou nenhum modelo.",+ "discoverAlreadyAdded": "Adicionado",+ "discoverSelectAll": "Selecionar tudo",+ "modelsAdded": "{count} modelos adicionados","getApiKey": "Obter chave de API","deleteKeyConfirm": "Excluir esta chave? Esta ação não pode ser desfeita.","checkAll": "Verificar tudo",diff --git a/client/src/i18n/locales/pt-PT.json b/client/src/i18n/locales/pt-PT.jsonindex 1431c5bb..1d6ebd6e 100644--- a/client/src/i18n/locales/pt-PT.json+++ b/client/src/i18n/locales/pt-PT.json@@ -320,6 +320,13 @@"addImageModel": "Adicionar modelo de imagem","addAudioModel": "Adicionar modelo de áudio","addingCustom": "Acrescentando...",+ "discoverModels": "Obter modelos",+ "discoverTitle": "Modelos neste endpoint",+ "discoverHint": "Escolha os modelos a registar. Os já adicionados ficam bloqueados.",+ "discoverEmpty": "Este endpoint não devolveu nenhum modelo.",+ "discoverAlreadyAdded": "Adicionado",+ "discoverSelectAll": "Selecionar tudo",+ "modelsAdded": "{count} modelos adicionados","getApiKey": "Arranja API chave","deleteKeyConfirm": "Apagar esta chave? Isto não pode ser desfeito.","checkAll": "Verificar tudo",diff --git a/client/src/i18n/locales/ro.json b/client/src/i18n/locales/ro.jsonindex c4cfdf22..b289a0de 100644--- a/client/src/i18n/locales/ro.json+++ b/client/src/i18n/locales/ro.json@@ -320,6 +320,13 @@"addImageModel": "Adaugă modelul imaginii","addAudioModel": "Adaugă modelul audio","addingCustom": "Adăugând...",+ "discoverModels": "Preia modelele",+ "discoverTitle": "Modele pe acest endpoint",+ "discoverHint": "Alege modelele de înregistrat. Cele deja adăugate rămân blocate.",+ "discoverEmpty": "Acest endpoint nu a returnat niciun model.",+ "discoverAlreadyAdded": "Adăugat",+ "discoverSelectAll": "Selectează tot",+ "modelsAdded": "{count} modele adăugate","getApiKey": "Ia cheia API","deleteKeyConfirm": "Să șterg această cheie? Acest lucru nu poate fi anulat.","checkAll": "Verifică totul",diff --git a/client/src/i18n/locales/ru.json b/client/src/i18n/locales/ru.jsonindex 038e610a..c0f30036 100644--- a/client/src/i18n/locales/ru.json+++ b/client/src/i18n/locales/ru.json@@ -320,6 +320,13 @@"addImageModel": "Добавить модель изображения","addAudioModel": "Добавить аудиомодель","addingCustom": "Добавление…",+ "discoverModels": "Получить модели",+ "discoverTitle": "Модели на этой точке доступа",+ "discoverHint": "Выберите модели для регистрации. Уже добавленные остаются заблокированными.",+ "discoverEmpty": "Эта точка доступа не вернула ни одной модели.",+ "discoverAlreadyAdded": "Добавлено",+ "discoverSelectAll": "Выбрать все",+ "modelsAdded": "Добавлено моделей: {count}","getApiKey": "Получите ключ API","deleteKeyConfirm": "Удалить этот ключ? Это невозможно отменить.","checkAll": "Проверить все",diff --git a/client/src/i18n/locales/si.json b/client/src/i18n/locales/si.jsonindex 05e6113d..72fcc3d3 100644--- a/client/src/i18n/locales/si.json+++ b/client/src/i18n/locales/si.json@@ -320,6 +320,13 @@"addImageModel": "රූප ආකෘතිය එක් කරන්න","addAudioModel": "ශ්රව්ය ආකෘතිය එක් කරන්න","addingCustom": "එකතු කරමින්...",+ "discoverModels": "ආකෘති ලබාගන්න",+ "discoverTitle": "මෙම අන්තයේ ඇති ආකෘති",+ "discoverHint": "ලියාපදිංචි කළ යුතු ආකෘති තෝරන්න. දැනටමත් එකතු කළ ඒවා අගුළු දමා පවතී.",+ "discoverEmpty": "මෙම අන්තය ආකෘති කිසිවක් ලබා දුන්නේ නැත.",+ "discoverAlreadyAdded": "එකතු කළා",+ "discoverSelectAll": "සියල්ල තෝරන්න",+ "modelsAdded": "ආකෘති {count}ක් එකතු කළා","getApiKey": "API යතුර ලබා ගන්න","deleteKeyConfirm": "මෙම යතුර මකන්නද? මෙය ආපසු හැරවිය නොහැක.","checkAll": "සියල්ල පරීක්ෂා කරන්න",diff --git a/client/src/i18n/locales/sk.json b/client/src/i18n/locales/sk.jsonindex e7700ffb..3aad7f2a 100644--- a/client/src/i18n/locales/sk.json+++ b/client/src/i18n/locales/sk.json@@ -320,6 +320,13 @@"addImageModel": "Pridať model obrázka","addAudioModel": "Pridať zvukový model","addingCustom": "Pridávam...",+ "discoverModels": "Načítať modely",+ "discoverTitle": "Modely na tomto endpointe",+ "discoverHint": "Vyberte modely na registráciu. Už pridané zostávajú uzamknuté.",+ "discoverEmpty": "Tento endpoint nevrátil žiadne modely.",+ "discoverAlreadyAdded": "Pridané",+ "discoverSelectAll": "Vybrať všetko",+ "modelsAdded": "Pridaných modelov: {count}","getApiKey": "Získaj API kľúč","deleteKeyConfirm": "Vymazať tento kľúč? To sa nedá vrátiť späť.","checkAll": "Zaškrtnite všetko",diff --git a/client/src/i18n/locales/sr.json b/client/src/i18n/locales/sr.jsonindex 177d376a..9a3baf3e 100644--- a/client/src/i18n/locales/sr.json+++ b/client/src/i18n/locales/sr.json@@ -320,6 +320,13 @@"addImageModel": "Додајте модел слике","addAudioModel": "Додајте аудио модел","addingCustom": "Додавање…",+ "discoverModels": "Преузми моделе",+ "discoverTitle": "Модели на овој крајњој тачки",+ "discoverHint": "Изабери моделе за регистрацију. Већ додати остају закључани.",+ "discoverEmpty": "Ова крајња тачка није вратила ниједан модел.",+ "discoverAlreadyAdded": "Додато",+ "discoverSelectAll": "Изабери све",+ "modelsAdded": "Додато модела: {count}","getApiKey": "Набавите кључ API","deleteKeyConfirm": "Избрисати овај кључ? Ово се не може поништити.","checkAll": "Проверите све",diff --git a/client/src/i18n/locales/sv.json b/client/src/i18n/locales/sv.jsonindex 235b335f..48b21b87 100644--- a/client/src/i18n/locales/sv.json+++ b/client/src/i18n/locales/sv.json@@ -320,6 +320,13 @@"addImageModel": "Lägg till bildmodell","addAudioModel": "Lägg till ljudmodell","addingCustom": "Lägger till...",+ "discoverModels": "Hämta modeller",+ "discoverTitle": "Modeller på denna endpoint",+ "discoverHint": "Välj modellerna som ska registreras. Redan tillagda förblir låsta.",+ "discoverEmpty": "Denna endpoint returnerade inga modeller.",+ "discoverAlreadyAdded": "Tillagd",+ "discoverSelectAll": "Markera alla",+ "modelsAdded": "{count} modeller tillagda","getApiKey": "Hämta API nyckel","deleteKeyConfirm": "Radera den här nyckeln? Detta kan inte göras ogjort.","checkAll": "Kolla allt",diff --git a/client/src/i18n/locales/sw.json b/client/src/i18n/locales/sw.jsonindex f865312a..b01923a0 100644--- a/client/src/i18n/locales/sw.json+++ b/client/src/i18n/locales/sw.json@@ -320,6 +320,13 @@"addImageModel": "Ongeza muundo wa picha","addAudioModel": "Ongeza muundo wa sauti","addingCustom": "Inaongeza...",+ "discoverModels": "Leta modeli",+ "discoverTitle": "Modeli kwenye mwisho huu",+ "discoverHint": "Chagua modeli za kusajili. Zilizoongezwa tayari zinabaki zimefungwa.",+ "discoverEmpty": "Mwisho huu haukurudisha modeli yoyote.",+ "discoverAlreadyAdded": "Imeongezwa",+ "discoverSelectAll": "Chagua zote",+ "modelsAdded": "Modeli {count} zimeongezwa","getApiKey": "Pata ufunguo wa API","deleteKeyConfirm": "Ungependa kufuta ufunguo huu? Hili haliwezi kutenduliwa.","checkAll": "Angalia zote",diff --git a/client/src/i18n/locales/ta.json b/client/src/i18n/locales/ta.jsonindex d639ad9f..a6c82e4d 100644--- a/client/src/i18n/locales/ta.json+++ b/client/src/i18n/locales/ta.json@@ -320,6 +320,13 @@"addImageModel": "பட மாதிரியைச் சேர்க்கவும்","addAudioModel": "ஆடியோ மாதிரியைச் சேர்க்கவும்","addingCustom": "சேர்க்கிறது…",+ "discoverModels": "மாதிரிகளைப் பெறு",+ "discoverTitle": "இந்த எண்ட்பாயிண்டில் உள்ள மாதிரிகள்",+ "discoverHint": "பதிவு செய்ய வேண்டிய மாதிரிகளைத் தேர்வுசெய். ஏற்கனவே சேர்த்தவை பூட்டப்பட்டிருக்கும்.",+ "discoverEmpty": "இந்த எண்ட்பாயிண்ட் எந்த மாதிரியையும் தரவில்லை.",+ "discoverAlreadyAdded": "சேர்க்கப்பட்டது",+ "discoverSelectAll": "அனைத்தையும் தேர்வுசெய்",+ "modelsAdded": "{count} மாதிரிகள் சேர்க்கப்பட்டன","getApiKey": "API விசையைப் பெறவும்","deleteKeyConfirm": "இந்த விசையை நீக்கவா? இதை செயல்தவிர்க்க முடியாது.","checkAll": "அனைத்தையும் சரிபார்க்கவும்",diff --git a/client/src/i18n/locales/te.json b/client/src/i18n/locales/te.jsonindex 99d459bc..7e1c9638 100644--- a/client/src/i18n/locales/te.json+++ b/client/src/i18n/locales/te.json@@ -320,6 +320,13 @@"addImageModel": "చిత్ర నమూనాను జోడించండి","addAudioModel": "ఆడియో మోడల్ని జోడించండి","addingCustom": "జోడిస్తోంది...",+ "discoverModels": "మోడల్లను తెచ్చు",+ "discoverTitle": "ఈ ఎండ్పాయింట్లోని మోడల్లు",+ "discoverHint": "నమోదు చేయాల్సిన మోడల్లను ఎంచుకోండి. ఇప్పటికే జోడించినవి లాక్గా ఉంటాయి.",+ "discoverEmpty": "ఈ ఎండ్పాయింట్ ఏ మోడల్నూ ఇవ్వలేదు.",+ "discoverAlreadyAdded": "జోడించబడింది",+ "discoverSelectAll": "అన్నీ ఎంచుకోండి",+ "modelsAdded": "{count} మోడల్లు జోడించబడ్డాయి","getApiKey": "API కీని పొందండి","deleteKeyConfirm": "ఈ కీని తొలగించాలా? ఇది రద్దు చేయబడదు.","checkAll": "అన్నింటినీ తనిఖీ చేయండి",diff --git a/client/src/i18n/locales/th.json b/client/src/i18n/locales/th.jsonindex 0d25d1a9..3b7acdff 100644--- a/client/src/i18n/locales/th.json+++ b/client/src/i18n/locales/th.json@@ -320,6 +320,13 @@"addImageModel": "เพิ่มรูปแบบรูปภาพ","addAudioModel": "เพิ่มโมเดลเสียง","addingCustom": "กำลังเพิ่ม...",+ "discoverModels": "ดึงรายการโมเดล",+ "discoverTitle": "โมเดลบนเอนด์พอยต์นี้",+ "discoverHint": "เลือกโมเดลที่จะลงทะเบียน โมเดลที่เพิ่มไว้แล้วจะถูกล็อก",+ "discoverEmpty": "เอนด์พอยต์นี้ไม่ได้ส่งโมเดลกลับมา",+ "discoverAlreadyAdded": "เพิ่มแล้ว",+ "discoverSelectAll": "เลือกทั้งหมด",+ "modelsAdded": "เพิ่มโมเดลแล้ว {count} รายการ","getApiKey": "รับคีย์ API","deleteKeyConfirm": "ลบคีย์นี้ใช่ไหม สิ่งนี้ไม่สามารถยกเลิกได้","checkAll": "ตรวจสอบทั้งหมด",diff --git a/client/src/i18n/locales/tl.json b/client/src/i18n/locales/tl.jsonindex cd0e8fab..03f9f592 100644--- a/client/src/i18n/locales/tl.json+++ b/client/src/i18n/locales/tl.json@@ -320,6 +320,13 @@"addImageModel": "Magdagdag ng modelo ng imahe","addAudioModel": "Magdagdag ng audio model","addingCustom": "Dagdag pa...",+ "discoverModels": "Kunin ang mga modelo",+ "discoverTitle": "Mga modelo sa endpoint na ito",+ "discoverHint": "Piliin ang mga modelong irerehistro. Ang mga naidagdag na ay naka-lock.",+ "discoverEmpty": "Walang ibinalik na modelo ang endpoint na ito.",+ "discoverAlreadyAdded": "Naidagdag",+ "discoverSelectAll": "Piliin lahat",+ "modelsAdded": "{count} na modelo ang naidagdag","getApiKey": "Kunin API susi","deleteKeyConfirm": "Tanggalin ang susi na ito? Hindi na ito mababawi.","checkAll": "Suriin lahat",diff --git a/client/src/i18n/locales/tr.json b/client/src/i18n/locales/tr.jsonindex 927b1fa6..ec17a8af 100644--- a/client/src/i18n/locales/tr.json+++ b/client/src/i18n/locales/tr.json@@ -320,6 +320,13 @@"addImageModel": "Resim modeli ekle","addAudioModel": "Ses modeli ekle","addingCustom": "Ekleniyor…",+ "discoverModels": "Modelleri getir",+ "discoverTitle": "Bu uç noktadaki modeller",+ "discoverHint": "Kaydedilecek modelleri seç. Zaten eklenenler kilitli kalır.",+ "discoverEmpty": "Bu uç nokta hiç model döndürmedi.",+ "discoverAlreadyAdded": "Eklendi",+ "discoverSelectAll": "Tümünü seç",+ "modelsAdded": "{count} model eklendi","getApiKey": "API anahtarını alın","deleteKeyConfirm": "Bu anahtar silinsin mi? Bu geri alınamaz.","checkAll": "Tümünü kontrol et",diff --git a/client/src/i18n/locales/uk.json b/client/src/i18n/locales/uk.jsonindex 9f51eaae..c43983aa 100644--- a/client/src/i18n/locales/uk.json+++ b/client/src/i18n/locales/uk.json@@ -320,6 +320,13 @@"addImageModel": "Додайте модель зображення","addAudioModel": "Додати модель звуку","addingCustom": "Додавання…",+ "discoverModels": "Отримати моделі",+ "discoverTitle": "Моделі на цій кінцевій точці",+ "discoverHint": "Виберіть моделі для реєстрації. Уже додані залишаються заблокованими.",+ "discoverEmpty": "Ця кінцева точка не повернула жодної моделі.",+ "discoverAlreadyAdded": "Додано",+ "discoverSelectAll": "Вибрати все",+ "modelsAdded": "Додано моделей: {count}","getApiKey": "Отримайте ключ API","deleteKeyConfirm": "Видалити цей ключ? Це неможливо скасувати.","checkAll": "Перевірте всі",diff --git a/client/src/i18n/locales/ur.json b/client/src/i18n/locales/ur.jsonindex 92960588..031b7da5 100644--- a/client/src/i18n/locales/ur.json+++ b/client/src/i18n/locales/ur.json@@ -320,6 +320,13 @@"addImageModel": "تصویری ماڈل شامل کریں۔","addAudioModel": "آڈیو ماڈل شامل کریں۔","addingCustom": "شامل کیا جا رہا ہے…",+ "discoverModels": "ماڈلز حاصل کریں",+ "discoverTitle": "اس اینڈ پوائنٹ کے ماڈلز",+ "discoverHint": "رجسٹر کرنے کے لیے ماڈلز منتخب کریں۔ پہلے سے شامل ماڈلز مقفل رہتے ہیں۔",+ "discoverEmpty": "اس اینڈ پوائنٹ نے کوئی ماڈل واپس نہیں کیا۔",+ "discoverAlreadyAdded": "شامل",+ "discoverSelectAll": "سب منتخب کریں",+ "modelsAdded": "{count} ماڈلز شامل کیے گئے","getApiKey": "API کلید حاصل کریں۔","deleteKeyConfirm": "اس کلید کو حذف کریں؟ اسے کالعدم نہیں کیا جا سکتا۔","checkAll": "سب چیک کریں۔",diff --git a/client/src/i18n/locales/uz.json b/client/src/i18n/locales/uz.jsonindex c07f0ebd..df450d58 100644--- a/client/src/i18n/locales/uz.json+++ b/client/src/i18n/locales/uz.json@@ -320,6 +320,13 @@"addImageModel": "Rasm modelini qo'shing","addAudioModel": "Audio modelini qo'shing","addingCustom": "Qo‘shilmoqda…",+ "discoverModels": "Modellarni olish",+ "discoverTitle": "Ushbu endpointdagi modellar",+ "discoverHint": "Ro'yxatga olinadigan modellarni tanlang. Allaqachon qo'shilganlari qulflangan qoladi.",+ "discoverEmpty": "Ushbu endpoint hech qanday model qaytarmadi.",+ "discoverAlreadyAdded": "Qo'shildi",+ "discoverSelectAll": "Hammasini tanlash",+ "modelsAdded": "{count} ta model qo'shildi","getApiKey": "API kalitini oling","deleteKeyConfirm": "Bu kalit oʻchirilsinmi? Buni ortga qaytarib bo‘lmaydi.","checkAll": "Hammasini tekshiring",diff --git a/client/src/i18n/locales/vi.json b/client/src/i18n/locales/vi.jsonindex 4510ef76..40885dd2 100644--- a/client/src/i18n/locales/vi.json+++ b/client/src/i18n/locales/vi.json@@ -320,6 +320,13 @@"addImageModel": "Thêm mô hình hình ảnh","addAudioModel": "Thêm mô hình âm thanh","addingCustom": "Đang thêm…",+ "discoverModels": "Lấy danh sách mô hình",+ "discoverTitle": "Mô hình trên endpoint này",+ "discoverHint": "Chọn mô hình cần đăng ký. Những mô hình đã thêm vẫn bị khóa.",+ "discoverEmpty": "Endpoint này không trả về mô hình nào.",+ "discoverAlreadyAdded": "Đã thêm",+ "discoverSelectAll": "Chọn tất cả",+ "modelsAdded": "Đã thêm {count} mô hình","getApiKey": "Nhận khóa API","deleteKeyConfirm": "Xóa khóa này? Điều này không thể hoàn tác được.","checkAll": "Kiểm tra tất cả",diff --git a/client/src/i18n/locales/yo.json b/client/src/i18n/locales/yo.jsonindex 1c93e5e4..c45ca909 100644--- a/client/src/i18n/locales/yo.json+++ b/client/src/i18n/locales/yo.json@@ -320,6 +320,13 @@"addImageModel": "Ṣafikun awoṣe aworan","addAudioModel": "Ṣafikun awoṣe ohun","addingCustom": "Nfi…",+ "discoverModels": "Gba àwọn àwòṣe",+ "discoverTitle": "Àwọn àwòṣe lórí ibùdó yìí",+ "discoverHint": "Yan àwọn àwòṣe láti forúkọsílẹ̀. Àwọn tí o ti fikún ń wà ní títì.",+ "discoverEmpty": "Ibùdó yìí kò dá àwòṣe kankan padà.",+ "discoverAlreadyAdded": "Ti fikún",+ "discoverSelectAll": "Yan gbogbo rẹ̀",+ "modelsAdded": "Àwòṣe {count} ni a fikún","getApiKey": "Gba bọtini API","deleteKeyConfirm": "Pa bọtini yi rẹ bi? Eyi ko le ṣe atunṣe.","checkAll": "Ṣayẹwo gbogbo rẹ",diff --git a/client/src/i18n/locales/zh-CN.json b/client/src/i18n/locales/zh-CN.jsonindex 6931b880..8721972d 100644--- a/client/src/i18n/locales/zh-CN.json+++ b/client/src/i18n/locales/zh-CN.json@@ -320,6 +320,13 @@"addImageModel": "添加图像模型","addAudioModel": "添加音频模型","addingCustom": "添加中…",+ "discoverModels": "获取模型",+ "discoverTitle": "此端点上的模型",+ "discoverHint": "选择要注册的模型。已添加的模型保持锁定。",+ "discoverEmpty": "此端点未返回任何模型。",+ "discoverAlreadyAdded": "已添加",+ "discoverSelectAll": "全选",+ "modelsAdded": "已添加 {count} 个模型","getApiKey": "获取 API 密钥","deleteKeyConfirm": "确认删除此密钥?此操作无法撤销。","checkAll": "全部检查",diff --git a/client/src/i18n/locales/zh-TW.json b/client/src/i18n/locales/zh-TW.jsonindex 1239fa4f..9b30d74d 100644--- a/client/src/i18n/locales/zh-TW.json+++ b/client/src/i18n/locales/zh-TW.json@@ -320,6 +320,13 @@"addImageModel": "新增影像模型","addAudioModel": "新增音訊模型","addingCustom": "補充說......",+ "discoverModels": "取得模型",+ "discoverTitle": "此端點上的模型",+ "discoverHint": "選擇要註冊的模型。已新增的模型維持鎖定。",+ "discoverEmpty": "此端點未回傳任何模型。",+ "discoverAlreadyAdded": "已新增",+ "discoverSelectAll": "全選",+ "modelsAdded": "已新增 {count} 個模型","getApiKey": "拿API鑰匙","deleteKeyConfirm": "刪除這把鑰匙?這無法逆轉。","checkAll": "全部檢查",diff --git a/server/src/__tests__/routes/custom-model-discovery.test.ts b/server/src/__tests__/routes/custom-model-discovery.test.tsnew file mode 100644index 00000000..845d5eb8--- /dev/null+++ b/server/src/__tests__/routes/custom-model-discovery.test.ts@@ -0,0 +1,302 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { Express } from 'express';+import { createApp } from '../../app.js';+import { initDb, getDb } from '../../db/index.js';+import { mintDashboardToken, isGatedApiPath } from '../helpers/auth.js';++// #488: a relay's model list changes weekly, so the endpoint's own /models+// route is the source of truth for what the USER's key can reach. This is+// discovery on the operator's OWN endpoint with the operator's OWN key — it+// never touches the published provider catalog.++const ENDPOINT = 'http://127.0.0.1:18099/v1';+const DISCOVER = '/api/keys/custom/discover-models';+const realFetch = globalThis.fetch;++let dashToken = '';++async function request(app: Express, method: string, path: string, body?: unknown, auth = true) {+ const server = app.listen(0);+ const addr = server.address() as any;+ const res = await realFetch(`http://127.0.0.1:${addr.port}${path}`, {+ method,+ headers: {+ 'Content-Type': 'application/json',+ ...(auth && isGatedApiPath(path) ? { Authorization: `Bearer ${dashToken}` } : {}),+ },+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),+ });+ const data = await res.json().catch(() => null);+ server.close();+ return { status: res.status, body: data as any };+}++const post = (app: Express, path: string, body: unknown) => request(app, 'POST', path, body);++function jsonResponse(payload: unknown, status = 200) {+ return new Response(JSON.stringify(payload), {+ status,+ headers: { 'content-type': 'application/json' },+ });+}++function stubRelay(payload: unknown, status = 200) {+ const mock = vi.fn(async () => jsonResponse(payload, status));+ globalThis.fetch = mock as any;+ return mock;+}++function customKeyIds(baseUrl = ENDPOINT): number[] {+ return (getDb().prepare("SELECT id FROM api_keys WHERE platform = 'custom' AND base_url = ? ORDER BY id")+ .all(baseUrl) as { id: number }[]).map(r => r.id);+}++function chatModel(modelId: string) {+ return getDb().prepare(`+ SELECT id, key_id, intelligence_rank, speed_rank, size_label, source+ FROM models WHERE platform = 'custom' AND model_id = ?+ `).get(modelId) as+ { id: number; key_id: number | null; intelligence_rank: number; speed_rank: number; size_label: string; source: string } | undefined;+}++describe('custom endpoint model discovery (#488)', () => {+ let app: Express;++ beforeEach(() => {+ process.env.ENCRYPTION_KEY = '0'.repeat(64);+ initDb(':memory:');+ getDb().prepare("DELETE FROM settings WHERE key = 'active_profile_id'").run();+ app = createApp();+ dashToken = mintDashboardToken();+ });++ afterEach(() => {+ globalThis.fetch = realFetch;+ vi.restoreAllMocks();+ });++ it('requires dashboard auth', async () => {+ stubRelay({ data: [{ id: 'relay-a' }] });+ const { status } = await request(app, 'POST', DISCOVER, { baseUrl: ENDPOINT }, false);+ expect(status).toBe(401);+ });++ it('lists the endpoint models and flags the ones already registered', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'relay-secret' });+ const mock = stubRelay({+ object: 'list',+ data: [{ id: 'relay-a', owned_by: 'acme' }, { id: 'relay-b', owned_by: 'acme' }],+ });++ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT });++ expect(status).toBe(200);+ expect(body.baseUrl).toBe(ENDPOINT);+ expect(body.keyId).toBe(customKeyIds()[0]);+ expect(body.models).toEqual([+ { id: 'relay-a', ownedBy: 'acme', registered: true },+ { id: 'relay-b', ownedBy: 'acme', registered: false },+ ]);+ expect(body.registeredCount).toBe(1);++ // Reuses the key-validation fetch: GET ${baseUrl}/models with the stored bearer.+ expect(String(mock.mock.calls[0]![0])).toBe(`${ENDPOINT}/models`);+ const init = mock.mock.calls[0]![1] as RequestInit;+ expect(init.method).toBe('GET');+ expect((init.headers as Record<string, string>).Authorization).toBe('Bearer relay-secret');+ });++ it('accepts a key id instead of a base url', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'relay-secret' });+ const keyId = customKeyIds()[0]!;+ stubRelay({ data: [{ id: 'relay-b' }] });++ const { status, body } = await post(app, DISCOVER, { keyId });+ expect(status).toBe(200);+ expect(body.baseUrl).toBe(ENDPOINT);+ expect(body.models.map((m: any) => m.id)).toEqual(['relay-b']);+ });++ it('discovers against an endpoint that is not registered yet', async () => {+ stubRelay({ data: [{ id: 'relay-b' }] });+ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'fresh-secret' });+ expect(status).toBe(200);+ expect(body.keyId).toBeNull();+ expect(body.models).toEqual([{ id: 'relay-b', ownedBy: null, registered: false }]);+ expect(customKeyIds()).toHaveLength(0); // discovery never writes+ });++ it('parses a non-standard relay envelope', async () => {+ stubRelay({ models: [{ name: 'qwen3:4b' }, { name: 'llama3:8b' }] });+ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'k' });+ expect(status).toBe(200);+ expect(body.models.map((m: any) => m.id)).toEqual(['llama3:8b', 'qwen3:4b']);+ });++ it('reports an unreachable endpoint as 502', async () => {+ globalThis.fetch = vi.fn(async () => { throw new Error('connect ECONNREFUSED'); }) as any;+ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'k' });+ expect(status).toBe(502);+ expect(String(body.error.message)).toMatch(/could not reach/i);+ });++ it('passes an upstream 401 through as 401', async () => {+ stubRelay({ error: { message: 'invalid api key' } }, 401);+ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'bad' });+ expect(status).toBe(401);+ expect(String(body.error.message)).toMatch(/invalid api key/i);+ });++ it('rejects a catalog body that blows past the size cap', async () => {+ globalThis.fetch = vi.fn(async () => new Response('{"data":[]}', {+ status: 200,+ headers: { 'content-type': 'application/json', 'content-length': String(50 * 1024 * 1024) },+ })) as any;+ const { status } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'k' });+ expect(status).toBe(502);+ });++ it('reports a relay that answers with no model list', async () => {+ stubRelay({ hello: 'world' });+ const { status, body } = await post(app, DISCOVER, { baseUrl: ENDPOINT, apiKey: 'k' });+ expect(status).toBe(502);+ expect(String(body.error.message)).toMatch(/model list/i);+ });++ it('rejects a request with neither baseUrl nor keyId', async () => {+ const { status } = await post(app, DISCOVER, {});+ expect(status).toBe(400);+ });+});++describe('bulk registration of discovered models (#488)', () => {+ let app: Express;++ beforeEach(() => {+ process.env.ENCRYPTION_KEY = '0'.repeat(64);+ initDb(':memory:');+ getDb().prepare("DELETE FROM settings WHERE key = 'active_profile_id'").run();+ app = createApp();+ dashToken = mintDashboardToken();+ });++ afterEach(() => {+ globalThis.fetch = realFetch;+ vi.restoreAllMocks();+ });++ it('registers a selection against the endpoint binding and reports what was new', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'first-secret' });+ // A second credential for the same endpoint (#640/#619): models bind to the+ // endpoint, and the pool rotates underneath that binding.+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'second-secret' });+ const [firstKeyId, secondKeyId] = customKeyIds();++ const { status, body } = await post(app, '/api/keys/custom', {+ keyId: secondKeyId,+ models: ['relay-a', 'relay-b', 'relay-c'],+ });++ expect(status).toBe(201);+ expect(body.keyId).toBe(secondKeyId);+ expect(body.baseUrl).toBe(ENDPOINT);+ expect(body.models.map((m: any) => [m.model, m.created])).toEqual([+ ['relay-a', false], ['relay-b', true], ['relay-c', true],+ ]);+ expect(body.created).toBe(2);+ expect(body.alreadyRegistered).toBe(1);++ // relay-a keeps its original binding; the new ones bind to the submitted key.+ expect(chatModel('relay-a')!.key_id).toBe(firstKeyId);+ expect(chatModel('relay-b')!.key_id).toBe(secondKeyId);+ expect(chatModel('relay-c')!.key_id).toBe(secondKeyId);+ expect(chatModel('relay-b')!.source).toBe('user');+ });++ it('does not duplicate a model that is already registered', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'first-secret' });+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, models: ['relay-a', 'relay-a', 'relay-b'] });++ const rows = getDb().prepare("SELECT model_id FROM models WHERE platform = 'custom' ORDER BY model_id")+ .all() as { model_id: string }[];+ expect(rows.map(r => r.model_id)).toEqual(['relay-a', 'relay-b']);+ });++ it('rejects a keyId that is not a custom endpoint', async () => {+ const { body: added } = await post(app, '/api/keys', { platform: 'groq', key: 'gsk_test' });+ const { status } = await post(app, '/api/keys/custom', { keyId: added.id, models: ['relay-a'] });+ expect(status).toBe(400);+ });++ it('rejects a baseUrl that contradicts the submitted keyId', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'first-secret' });+ const { status } = await post(app, '/api/keys/custom', {+ keyId: customKeyIds()[0], baseUrl: 'http://127.0.0.1:18098/v1', models: ['relay-b'],+ });+ expect(status).toBe(400);+ });+});++describe('median seeding for custom models (#488)', () => {+ let app: Express;++ function seedCatalog() {+ const db = getDb();+ db.prepare('DELETE FROM fallback_config').run();+ db.prepare('DELETE FROM models').run();+ const insert = db.prepare(`+ INSERT INTO models (platform, model_id, display_name, intelligence_rank, speed_rank, size_label,+ rpm_limit, rpd_limit, tpm_limit, tpd_limit, monthly_token_budget, enabled)+ VALUES ('groq', ?, ?, ?, ?, ?, NULL, NULL, NULL, NULL, '', 1)+ `);+ const rows: Array<[string, number, number]> = [+ ['Small', 40, 4], ['Medium', 20, 3], ['Large', 10, 2], ['Frontier', 2, 1], ['Frontier', 1, 5],+ ];+ rows.forEach(([label, intel, speed], i) => insert.run(`cat-${i}`, `Cat ${i}`, intel, speed, label));+ }++ beforeEach(() => {+ process.env.ENCRYPTION_KEY = '0'.repeat(64);+ initDb(':memory:');+ getDb().prepare("DELETE FROM settings WHERE key = 'active_profile_id'").run();+ seedCatalog();+ app = createApp();+ dashToken = mintDashboardToken();+ });++ afterEach(() => {+ globalThis.fetch = realFetch;+ vi.restoreAllMocks();+ });++ it('seeds a bulk-registered custom model at the catalog median', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, models: ['relay-a', 'relay-b'], apiKey: 'k' });+ for (const id of ['relay-a', 'relay-b']) {+ const row = chatModel(id)!;+ expect(row.size_label).toBe('Large');+ expect(row.intelligence_rank).toBe(10);+ expect(row.speed_rank).toBe(3);+ }+ });++ it('seeds a singly-added custom model the same way', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-solo', apiKey: 'k' });+ const row = chatModel('relay-solo')!;+ expect(row.size_label).toBe('Large');+ expect(row.intelligence_rank).toBe(10);+ expect(row.speed_rank).toBe(3);+ });++ it('never overwrites ranks the operator has since tuned', async () => {+ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, model: 'relay-a', apiKey: 'k' });+ const modelDbId = chatModel('relay-a')!.id;+ getDb().prepare('UPDATE models SET intelligence_rank = 1, speed_rank = 1, size_label = ? WHERE id = ?')+ .run('Frontier', modelDbId);++ await post(app, '/api/keys/custom', { baseUrl: ENDPOINT, models: ['relay-a', 'relay-b'], apiKey: 'k' });++ const kept = chatModel('relay-a')!;+ expect([kept.intelligence_rank, kept.speed_rank, kept.size_label]).toEqual([1, 1, 'Frontier']);+ expect(chatModel('relay-b')!.size_label).toBe('Large');+ });+});diff --git a/server/src/__tests__/services/custom-model-seed.test.ts b/server/src/__tests__/services/custom-model-seed.test.tsnew file mode 100644index 00000000..49e4aefa--- /dev/null+++ b/server/src/__tests__/services/custom-model-seed.test.ts@@ -0,0 +1,77 @@+import { describe, it, expect, beforeEach } from 'vitest';+import { initDb, getDb } from '../../db/index.js';+import { customModelSeed, FALLBACK_CUSTOM_SEED } from '../../services/custom-model-seed.js';++// #488: a freshly registered custom model used to land at size_label 'Custom'+// (tier 0 — below every catalog tier) and rank 50, so the bandit's intelligence+// axis scored it 0 and it lost every auto-route. Seed at the catalog MEDIAN+// instead: we know nothing about the model, so start it in the middle.++function seedCatalog(rows: Array<{ label: string; intel: number; speed: number }>) {+ const db = getDb();+ db.prepare('DELETE FROM fallback_config').run();+ db.prepare('DELETE FROM models').run();+ const insert = db.prepare(`+ INSERT INTO models (platform, model_id, display_name, intelligence_rank, speed_rank, size_label,+ rpm_limit, rpd_limit, tpm_limit, tpd_limit, monthly_token_budget, enabled)+ VALUES ('groq', ?, ?, ?, ?, ?, NULL, NULL, NULL, NULL, '', 1)+ `);+ rows.forEach((r, i) => insert.run(`m${i}`, `M${i}`, r.intel, r.speed, r.label));+}++describe('customModelSeed (#488)', () => {+ beforeEach(() => {+ process.env.ENCRYPTION_KEY = '0'.repeat(64);+ initDb(':memory:');+ });++ it('seeds at the catalog median on every axis', () => {+ seedCatalog([+ { label: 'Small', intel: 1, speed: 1 },+ { label: 'Medium', intel: 5, speed: 3 },+ { label: 'Large', intel: 9, speed: 7 },+ { label: 'Frontier', intel: 20, speed: 40 },+ { label: 'Frontier', intel: 30, speed: 50 },+ ]);+ expect(customModelSeed(getDb())).toEqual({ sizeLabel: 'Large', intelligenceRank: 9, speedRank: 7 });+ });++ it('takes the lower median on an even-sized catalog so it never over-claims', () => {+ seedCatalog([+ { label: 'Small', intel: 2, speed: 2 },+ { label: 'Medium', intel: 4, speed: 4 },+ { label: 'Large', intel: 6, speed: 6 },+ { label: 'Frontier', intel: 8, speed: 8 },+ ]);+ expect(customModelSeed(getDb())).toEqual({ sizeLabel: 'Medium', intelligenceRank: 4, speedRank: 4 });+ });++ it('ignores custom rows so the seed cannot drift toward itself', () => {+ seedCatalog([+ { label: 'Large', intel: 10, speed: 10 },+ { label: 'Large', intel: 10, speed: 10 },+ { label: 'Large', intel: 10, speed: 10 },+ ]);+ getDb().prepare(`+ INSERT INTO models (platform, model_id, display_name, intelligence_rank, speed_rank, size_label,+ rpm_limit, rpd_limit, tpm_limit, tpd_limit, monthly_token_budget, enabled)+ VALUES ('custom', 'relay-x', 'relay-x', 999, 999, 'Custom', NULL, NULL, NULL, NULL, '', 1)+ `).run();+ expect(customModelSeed(getDb())).toEqual({ sizeLabel: 'Large', intelligenceRank: 10, speedRank: 10 });+ });++ it('ignores unrecognized size labels when picking the median tier', () => {+ seedCatalog([+ { label: 'Mystery', intel: 3, speed: 3 },+ { label: 'Mystery', intel: 3, speed: 3 },+ { label: 'Small', intel: 3, speed: 3 },+ ]);+ expect(customModelSeed(getDb()).sizeLabel).toBe('Small');+ });++ it('falls back to a neutral seed with no catalog to measure', () => {+ getDb().prepare('DELETE FROM fallback_config').run();+ getDb().prepare('DELETE FROM models').run();+ expect(customModelSeed(getDb())).toEqual(FALLBACK_CUSTOM_SEED);+ });+});diff --git a/server/src/__tests__/services/model-discovery.test.ts b/server/src/__tests__/services/model-discovery.test.tsnew file mode 100644index 00000000..be5b51f8--- /dev/null+++ b/server/src/__tests__/services/model-discovery.test.ts@@ -0,0 +1,115 @@+import { describe, it, expect } from 'vitest';+import { parseModelCatalog, readCappedBody, MAX_CATALOG_BYTES, MAX_DISCOVERED_MODELS, ModelDiscoveryError } from '../../services/model-discovery.js';++// #488: relays that speak "OpenAI-compatible" agree on the chat route and then+// each invent their own /models envelope. Parsing has to be tolerant or the+// Fetch-models button reads as broken against half the endpoints people use.++describe('parseModelCatalog tolerance (#488)', () => {+ it('reads the canonical OpenAI envelope', () => {+ expect(parseModelCatalog({+ object: 'list',+ data: [+ { id: 'gpt-4o-mini', object: 'model', owned_by: 'openai' },+ { id: 'sonnet-5', object: 'model', owned_by: 'anthropic' },+ ],+ })).toEqual([+ { id: 'gpt-4o-mini', ownedBy: 'openai' },+ { id: 'sonnet-5', ownedBy: 'anthropic' },+ ]);+ });++ it('reads a bare array of objects', () => {+ expect(parseModelCatalog([{ id: 'a' }, { id: 'b' }]).map(m => m.id)).toEqual(['a', 'b']);+ });++ it('reads a bare array of strings', () => {+ expect(parseModelCatalog(['b', 'a']).map(m => m.id)).toEqual(['a', 'b']);+ });++ it('reads an array of strings under data', () => {+ expect(parseModelCatalog({ data: ['a', 'b'] }).map(m => m.id)).toEqual(['a', 'b']);+ });++ it('reads the Ollama-style models/name envelope', () => {+ expect(parseModelCatalog({+ models: [{ name: 'qwen3:4b', model: 'qwen3:4b' }, { name: 'llama3:8b' }],+ }).map(m => m.id)).toEqual(['llama3:8b', 'qwen3:4b']);+ });++ it('reads a nested data.models envelope', () => {+ expect(parseModelCatalog({ data: { models: [{ id: 'nested' }] } }).map(m => m.id)).toEqual(['nested']);+ });++ it('falls back through the id aliases relays use', () => {+ expect(parseModelCatalog({+ data: [{ model_id: 'via-model-id' }, { slug: 'via-slug' }, { modelId: 'via-model-id-camel' }],+ }).map(m => m.id).sort()).toEqual(['via-model-id', 'via-model-id-camel', 'via-slug']);+ });++ it('picks up owner aliases and defaults to null', () => {+ const byId = new Map(parseModelCatalog({+ data: [+ { id: 'a', organization: 'org-a' },+ { id: 'b', provider: 'prov-b' },+ { id: 'c', publisher: 'pub-c' },+ { id: 'd' },+ ],+ }).map(m => [m.id, m.ownedBy]));+ expect(byId.get('a')).toBe('org-a');+ expect(byId.get('b')).toBe('prov-b');+ expect(byId.get('c')).toBe('pub-c');+ expect(byId.get('d')).toBeNull();+ });++ it('drops blanks, non-strings and duplicates', () => {+ expect(parseModelCatalog({+ data: ['dup', { id: 'dup' }, { id: ' ' }, { id: 42 }, null, 'kept'],+ }).map(m => m.id)).toEqual(['dup', 'kept']);+ });++ it('drops absurdly long ids instead of storing them', () => {+ expect(parseModelCatalog({ data: [{ id: 'x'.repeat(400) }, { id: 'ok' }] }).map(m => m.id)).toEqual(['ok']);+ });++ it('returns nothing for a payload with no recognizable list', () => {+ expect(parseModelCatalog({ error: 'nope' })).toEqual([]);+ expect(parseModelCatalog('plain text')).toEqual([]);+ expect(parseModelCatalog(null)).toEqual([]);+ });++ it('caps the list so a hostile relay cannot flood the picker', () => {+ const huge = Array.from({ length: MAX_DISCOVERED_MODELS + 50 }, (_, i) => ({ id: `m${String(i).padStart(4, '0')}` }));+ expect(parseModelCatalog({ data: huge })).toHaveLength(MAX_DISCOVERED_MODELS);+ });+});++describe('readCappedBody (#488)', () => {+ it('reads a normal body', async () => {+ const res = new Response('{"data":[]}', { headers: { 'content-type': 'application/json' } });+ expect(await readCappedBody(res)).toBe('{"data":[]}');+ });++ it('rejects a declared content-length over the cap without reading it', async () => {+ const res = new Response('{}', {+ headers: { 'content-length': String(MAX_CATALOG_BYTES + 1) },+ });+ await expect(readCappedBody(res)).rejects.toBeInstanceOf(ModelDiscoveryError);+ });++ it('rejects a body that runs past the cap while streaming', async () => {+ const chunk = 'x'.repeat(64 * 1024);+ let sent = 0;+ const body = new ReadableStream<Uint8Array>({+ pull(controller) {+ if (sent > MAX_CATALOG_BYTES + chunk.length) {+ controller.close();+ return;+ }+ sent += chunk.length;+ controller.enqueue(new TextEncoder().encode(chunk));+ },+ });+ await expect(readCappedBody(new Response(body))).rejects.toBeInstanceOf(ModelDiscoveryError);+ });+});diff --git a/server/src/providers/openai-compat.ts b/server/src/providers/openai-compat.tsindex a80b1a83..423700db 100644--- a/server/src/providers/openai-compat.ts+++ b/server/src/providers/openai-compat.ts@@ -348,17 +348,29 @@ export class OpenAICompatProvider extends BaseProvider {yield* this.readSseStream(res, { firstByteTimeoutMs: options?.timeoutMs ?? this.timeoutMs });}- async validateKey(apiKey: string, quotaContext?: QuotaObservationContext): Promise<KeyValidationResult> {- // Note: transport errors (DNS / timeout / TLS) propagate to the caller.- // health.ts catches them and marks status='error' WITHOUT incrementing- // the consecutive-failure counter — only confirmed 401/403 disables a key.- const url = this.validateUrl ?? `${this.baseUrl}/models`;+ /** This provider's OpenAI-style model catalog URL. */+ get modelsUrl(): string {+ return `${this.baseUrl}/models`;+ }++ /**+ * GET a catalog-style endpoint with this provider's auth header, extra+ * headers, proxy routing, timeout policy and quota bookkeeping. Shared by+ * validateKey (which only reads the status) and custom-endpoint model+ * discovery (#488), which also reads the body — one place owns how we talk+ * to a provider's /models route.+ *+ * Note: transport errors (DNS / timeout / TLS) propagate to the caller.+ * health.ts catches them and marks status='error' WITHOUT incrementing the+ * consecutive-failure counter — only confirmed 401/403 disables a key.+ */+ protected fetchCatalogEndpoint(url: string, apiKey: string, quotaContext?: QuotaObservationContext): Promise<Response> {// 30s (not 10s): some upstreams return a large /v1/models catalog that// takes >10s from high-latency regions (e.g. NVIDIA NIM measured ~11.2s// from India). A 10s cap aborted those calls and health.ts marked a// perfectly good key status='error'. 30s aligns with chatCompletion's// own slow-upstream allowance and costs nothing for fast providers.- const res = await this.fetchWithTimeout(url, {+ return this.fetchWithTimeout(url, {method: 'GET',headers: {...this.authHeader(apiKey),@@ -366,14 +378,27 @@ export class OpenAICompatProvider extends BaseProvider {},// 'request' bounds: a catalog body that hangs mid-transfer must not// stall the health cycle past the deadline.- }, 30000, { timeoutBounds: 'request' });- recordQuotaObservationsFromResponse(res, {- platform: this.platform,- keyId: quotaContext?.keyId,- providerAccountId: quotaContext?.providerAccountId,- quotaPoolKey: quotaContext?.quotaPoolKey,- endpoint: 'models',+ }, 30000, { timeoutBounds: 'request' }).then(res => {+ recordQuotaObservationsFromResponse(res, {+ platform: this.platform,+ keyId: quotaContext?.keyId,+ providerAccountId: quotaContext?.providerAccountId,+ quotaPoolKey: quotaContext?.quotaPoolKey,+ endpoint: 'models',+ });+ return res;});+ }++ /** The raw `${baseUrl}/models` response, body unread. Used by custom-endpoint+ * model discovery (#488); unlike validateKey it always hits /models, never a+ * provider-specific validateUrl, because the caller wants the catalog. */+ fetchModelCatalog(apiKey: string, quotaContext?: QuotaObservationContext): Promise<Response> {+ return this.fetchCatalogEndpoint(this.modelsUrl, apiKey, quotaContext);+ }++ async validateKey(apiKey: string, quotaContext?: QuotaObservationContext): Promise<KeyValidationResult> {+ const res = await this.fetchCatalogEndpoint(this.validateUrl ?? this.modelsUrl, apiKey, quotaContext);return this.validationResult(res);}}diff --git a/server/src/routes/keys.ts b/server/src/routes/keys.tsindex 8a137690..d9bcb942 100644--- a/server/src/routes/keys.ts+++ b/server/src/routes/keys.ts@@ -11,6 +11,8 @@ import { assessProviderUrl } from '../lib/url-guard.js';import { ensureModelInProfiles } from '../services/profile-models.js';import { getActiveCooldownsForKeys, clearCooldownsForKey } from '../services/ratelimit.js';import { resolveCustomEndpointKey, customEndpointKeyIds, siblingEndpointKeyId } from '../services/custom-endpoint.js';+import { customModelSeed } from '../services/custom-model-seed.js';+import { discoverEndpointModels, ModelDiscoveryError } from '../services/model-discovery.js';export const keysRouter = Router();@@ -474,8 +476,13 @@ const modelEntrySchema = z.union([supportsVision: z.boolean().optional(),}),]);+// `baseUrl` and `keyId` are both optional but at least one is required: the+// bulk registration that follows model discovery (#488) already holds the+// api_keys row it fetched the list with, and naming that row keeps the new+// models on the same credential of the endpoint's pool (#619/#640).const customProviderSchema = z.object({- baseUrl: z.string().url('baseUrl must be a valid URL'),+ baseUrl: z.string().url('baseUrl must be a valid URL').optional(),+ keyId: z.number().int().positive().optional(),model: z.string().optional(),models: z.array(modelEntrySchema).optional(),displayName: z.string().optional(),@@ -488,8 +495,149 @@ const customProviderSchema = z.object({}).refine(d => (d.model && d.model.trim().length > 0) || (d.models && d.models.length > 0),{ message: 'model or models is required' },+).refine(+ d => d.baseUrl !== undefined || d.keyId !== undefined,+ { message: 'baseUrl or keyId is required' },);+const normalizeBaseUrl = (raw: string) => raw.trim().replace(/\/+$/, '');++interface CustomEndpointRef {+ baseUrl: string;+ /** The api_keys row this endpoint is already stored under, or null when the+ * endpoint has never been registered. */+ keyId: number | null;+ /** Plaintext of that row's credential, when there is one. */+ storedKey: string | null;+}++/**+ * Turn a `{ keyId?, baseUrl? }` reference into the endpoint it names. A keyId+ * is the stronger reference (it identifies one credential of the pool); a bare+ * baseUrl falls back to the endpoint's first stored key, which is how the rest+ * of the custom-endpoint machinery addresses an endpoint. Throws a+ * `{ status, message }` for a reference that names nothing usable.+ */+function resolveEndpointRef(ref: { keyId?: number; baseUrl?: string }): CustomEndpointRef {+ const db = getDb();+ const requestedBaseUrl = ref.baseUrl === undefined ? undefined : normalizeBaseUrl(ref.baseUrl);++ if (ref.keyId !== undefined) {+ const row = db.prepare('SELECT id, platform, base_url, encrypted_key, iv, auth_tag FROM api_keys WHERE id = ?')+ .get(ref.keyId) as { id: number; platform: string; base_url: string | null; encrypted_key: string; iv: string; auth_tag: string } | undefined;+ if (!row || row.platform !== 'custom' || !row.base_url) {+ throw Object.assign(new Error('keyId does not name a custom endpoint'), { status: 400 });+ }+ if (requestedBaseUrl !== undefined && requestedBaseUrl !== row.base_url) {+ throw Object.assign(new Error('baseUrl does not match the endpoint keyId belongs to'), { status: 400 });+ }+ let storedKey: string | null = null;+ try {+ storedKey = decrypt(row.encrypted_key, row.iv, row.auth_tag);+ } catch { /* an undecryptable row still names the endpoint */ }+ return { baseUrl: row.base_url, keyId: row.id, storedKey };+ }++ if (!requestedBaseUrl) {+ throw Object.assign(new Error('baseUrl or keyId is required'), { status: 400 });+ }++ // Any key of this base_url serves the whole endpoint (#619), so the first one+ // is as good a representative as any.+ const rows = db.prepare(`+ SELECT id, encrypted_key, iv, auth_tag FROM api_keys+ WHERE platform = 'custom' AND base_url = ? ORDER BY id+ `).all(requestedBaseUrl) as Array<{ id: number; encrypted_key: string; iv: string; auth_tag: string }>;+ for (const row of rows) {+ try {+ return { baseUrl: requestedBaseUrl, keyId: row.id, storedKey: decrypt(row.encrypted_key, row.iv, row.auth_tag) };+ } catch { /* try the next credential */ }+ }+ return { baseUrl: requestedBaseUrl, keyId: rows[0]?.id ?? null, storedKey: null };+}++// SSRF guard (#440): a base_url is the one user-controlled outbound target.+// Cloud metadata / link-local addresses are rejected outright; private ranges+// too when FREEAPI_BLOCK_PRIVATE_PROVIDER_URLS is set. Re-checked at request+// time in proxyFetch for URLs already in the DB.+async function rejectUnsafeBaseUrl(baseUrl: string, res: Response): Promise<boolean> {+ const verdict = await assessProviderUrl(baseUrl);+ if (verdict.allowed) return false;+ res.status(400).json({ error: { message: `baseUrl rejected: ${verdict.reason}` } });+ return true;+}++// Ask a configured custom endpoint what models it currently serves (#488).+// Relays add and drop models weekly, so re-typing the ids by hand goes stale+// immediately. This reads ONLY the operator's own base_url with the operator's+// own key — it never reads or refreshes the published provider catalog. Nothing+// is written: the picked ids come back through POST /custom to be registered.+const discoverModelsSchema = z.object({+ baseUrl: z.string().url('baseUrl must be a valid URL').optional(),+ keyId: z.number().int().positive().optional(),+ // Lets the Keys page fetch a list for an endpoint the user is still typing in,+ // before it has been saved. Falls back to the endpoint's stored credential.+ apiKey: z.string().optional(),+}).refine(+ d => d.baseUrl !== undefined || d.keyId !== undefined,+ { message: 'baseUrl or keyId is required' },+);++keysRouter.post('/custom/discover-models', async (req: Request, res: Response) => {+ const parsed = discoverModelsSchema.safeParse(req.body);+ if (!parsed.success) {+ res.status(400).json({ error: { message: parsed.error.errors.map(e => e.message).join(', ') } });+ return;+ }++ let endpoint: CustomEndpointRef;+ try {+ endpoint = resolveEndpointRef(parsed.data);+ } catch (err: any) {+ res.status(err.status ?? 400).json({ error: { message: err.message } });+ return;+ }++ if (await rejectUnsafeBaseUrl(endpoint.baseUrl, res)) return;++ // A submitted key wins (the user may be rotating it); otherwise use what the+ // endpoint already has. Local servers with auth off keep the 'no-key'+ // sentinel, which the bearer header carries harmlessly.+ const apiKey = parsed.data.apiKey?.trim() || endpoint.storedKey || 'no-key';++ try {+ const discovered = await discoverEndpointModels(endpoint.baseUrl, apiKey);++ // "Already registered" means bound to THIS endpoint — any key of the pool+ // counts, since they all serve the same model list (#619).+ const db = getDb();+ const registeredIds = new Set<string>();+ if (endpoint.keyId != null) {+ const poolIds = [...customEndpointKeyIds(db, endpoint.keyId)];+ const placeholders = poolIds.map(() => '?').join(', ');+ const rows = db.prepare(+ `SELECT model_id FROM models WHERE platform = 'custom' AND key_id IN (${placeholders})`,+ ).all(...poolIds) as { model_id: string }[];+ for (const row of rows) registeredIds.add(row.model_id);+ }++ const models = discovered.map(m => ({ ...m, registered: registeredIds.has(m.id) }));+ res.json({+ baseUrl: endpoint.baseUrl,+ keyId: endpoint.keyId,+ models,+ total: models.length,+ registeredCount: models.filter(m => m.registered).length,+ });+ } catch (err: any) {+ if (err instanceof ModelDiscoveryError) {+ res.status(err.status).json({ error: { message: err.message } });+ return;+ }+ res.status(502).json({ error: { message: `Model discovery failed: ${err?.message ?? 'unknown error'}` } });+ }+});+keysRouter.post('/custom', async (req: Request, res: Response) => {const parsed = customProviderSchema.safeParse(req.body);if (!parsed.success) {@@ -497,17 +645,17 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {return;}- const baseUrl = parsed.data.baseUrl.trim().replace(/\/+$/, '');-- // SSRF guard (#440): a base_url is the one user-controlled outbound target.- // Cloud metadata / link-local addresses are rejected outright; private- // ranges too when FREEAPI_BLOCK_PRIVATE_PROVIDER_URLS is set. Re-checked- // at request time in proxyFetch for URLs already in the DB.- const verdict = await assessProviderUrl(baseUrl);- if (!verdict.allowed) {- res.status(400).json({ error: { message: `baseUrl rejected: ${verdict.reason}` } });+ let endpoint: CustomEndpointRef;+ try {+ endpoint = resolveEndpointRef(parsed.data);+ } catch (err: any) {+ res.status(err.status ?? 400).json({ error: { message: err.message } });return;}+ const baseUrl = endpoint.baseUrl;++ if (await rejectUnsafeBaseUrl(baseUrl, res)) return;+// Local servers often need no key; keep a sentinel so there's always a bearer.const providedKey = parsed.data.apiKey?.trim() || undefined;const label = parsed.data.label?.trim() || undefined;@@ -547,11 +695,17 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {// Key rows are matched on (base_url, secret): a new secret for a known// endpoint is a SECOND credential for it, not a replacement (#619), and a// new base_url is a separate provider (#212). Re-submitting with a blank- // key preserves the stored one.- const { keyId, storedKey: storedKeyForMask } = resolveCustomEndpointKey(db, baseUrl, providedKey, label);+ // key preserves the stored one. A submitted keyId pins WHICH credential of+ // the pool the new models bind to (#488 bulk registration).+ const { keyId, storedKey: storedKeyForMask } = resolveCustomEndpointKey(+ db, baseUrl, providedKey, label, endpoint.keyId ?? undefined,+ );const endpointKeyIds = customEndpointKeyIds(db, keyId);+ // Unknown ≠ worst: seed the routing ranks at the catalog median so a new+ // custom model is explored instead of buried at intelligence 0 (#488).+ const seed = customModelSeed(db);- const registered: { modelDbId: number; model: string; displayName: string; supportsTools: boolean; supportsVision: boolean }[] = [];+ const registered: { modelDbId: number; model: string; displayName: string; supportsTools: boolean; supportsVision: boolean; created: boolean }[] = [];for (const { modelId, displayName, supportsTools, supportsVision } of entries) {// Register each model bound to THIS endpoint's key. Custom models carry no// rate limits and sort last in the intelligence preset (size_label tier).@@ -564,15 +718,20 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {// value on re-registration. (#470)const bound = db.prepare("SELECT key_id FROM models WHERE platform = 'custom' AND model_id = ?").get(modelId) as { key_id: number | null } | undefined;+ const created = bound === undefined;const bindKeyId = bound?.key_id != null && endpointKeyIds.has(bound.key_id) ? bound.key_id : keyId;const toolsParam = supportsTools === undefined ? null : (supportsTools ? 1 : 0);const visionParam = supportsVision === undefined ? null : (supportsVision ? 1 : 0);+ // The seed applies on INSERT only: DO UPDATE deliberately leaves the rank+ // columns alone so re-registering a model (or bulk-adding alongside it)+ // never rewrites ranks the operator has since tuned by hand.db.prepare(`INSERT INTO models(platform, model_id, display_name, intelligence_rank, speed_rank, size_label,rpm_limit, rpd_limit, tpm_limit, tpd_limit, monthly_token_budget, context_window, enabled, key_id,supports_tools, supports_vision, source)- VALUES ('custom', @modelId, @displayName, 50, 50, 'Custom', NULL, NULL, NULL, NULL, '', NULL, 1, @keyId,+ VALUES ('custom', @modelId, @displayName, @intelligenceRank, @speedRank, @sizeLabel,+ NULL, NULL, NULL, NULL, '', NULL, 1, @keyId,COALESCE(@tools, 1), COALESCE(@vision, 0), 'user')ON CONFLICT(platform, model_id)DO UPDATE SET@@ -581,7 +740,10 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {enabled = 1,supports_tools = COALESCE(@tools, supports_tools),supports_vision = COALESCE(@vision, supports_vision)- `).run({ modelId, displayName, keyId: bindKeyId, tools: toolsParam, vision: visionParam });+ `).run({+ modelId, displayName, keyId: bindKeyId, tools: toolsParam, vision: visionParam,+ intelligenceRank: seed.intelligenceRank, speedRank: seed.speedRank, sizeLabel: seed.sizeLabel,+ });const modelRow = db.prepare("SELECT id, supports_tools, supports_vision FROM models WHERE platform = 'custom' AND model_id = ?").get(modelId) as { id: number; supports_tools: number; supports_vision: number };@@ -599,6 +761,7 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {displayName,supportsTools: modelRow.supports_tools === 1,supportsVision: modelRow.supports_vision === 1,+ created,});}@@ -620,6 +783,10 @@ keysRouter.post('/custom', async (req: Request, res: Response) => {supportsTools: first.supportsTools,supportsVision: first.supportsVision,models: registered,+ // Bulk registration (#488) needs to tell the user what actually changed:+ // picking a whole discovered list re-submits ids that are already there.+ created: registered.filter(m => m.created).length,+ alreadyRegistered: registered.filter(m => !m.created).length,maskedKey: maskKey(storedKeyForMask),});});diff --git a/server/src/services/custom-endpoint.ts b/server/src/services/custom-endpoint.tsindex 07be0b39..dbb14642 100644--- a/server/src/services/custom-endpoint.ts+++ b/server/src/services/custom-endpoint.ts@@ -69,18 +69,28 @@ function insertKey(db: Db, baseUrl: string, secret: string, label: string | unde* - a key already on record → update that row (label / re-enable)* - a new key, placeholder-only endpoint → replace the placeholder in place* - a new key, endpoint already has one → INSERT a second credential (#619)+ *+ * `pinnedKeyId` lets a caller that already knows WHICH credential of the pool+ * it is acting for name it — the bulk registration of discovered models (#488)+ * comes back holding the key row the user fetched the list with. It only+ * applies when that row really serves this base_url and no new secret was+ * submitted; a new secret still goes through the rules above.*/export function resolveCustomEndpointKey(db: Db,baseUrl: string,providedKey: string | undefined,label: string | undefined,+ pinnedKeyId?: number,): ResolvedEndpointKey {const rows = endpointKeyRows(db, baseUrl);const stored = rows.map(row => ({ row, secret: plaintextOf(row) }));if (!providedKey) {- const first = stored[0];+ const pinned = pinnedKeyId === undefined+ ? undefined+ : stored.find(s => s.row.id === pinnedKeyId);+ const first = pinned ?? stored[0];if (!first) return insertKey(db, baseUrl, NO_KEY, label);touch(db, first.row.id, label);return { keyId: first.row.id, storedKey: first.secret ?? NO_KEY, created: false };diff --git a/server/src/services/custom-model-seed.ts b/server/src/services/custom-model-seed.tsnew file mode 100644index 00000000..5c936020--- /dev/null+++ b/server/src/services/custom-model-seed.ts@@ -0,0 +1,79 @@+import { tierValue, TIER_VALUE } from './scoring.js';+import type { Db } from '../db/types.js';++// ── Seeding a custom model's routing ranks (#488) ───────────────────────────+//+// A model registered against a user's own endpoint carries no catalog metadata:+// nobody has benchmarked "whatever bynara.id is proxying today". The old+// defaults answered that with the FLOOR — size_label 'Custom' (not a tier, so+// intelligenceComposite scores it below every real model) plus rank 50 — and+// the bandit's intelligence axis duly handed it 0. Every routing strategy+// except Manual then ignored the endpoint completely, which is exactly the+// complaint in #488: "all of the added models by custom providers have the same+// default weights … this makes them literally unusable with Routing Strategies".+//+// "Unknown" is not "worst", it is "no opinion", so seed at the catalog MEDIAN+// on each axis instead. A new custom model starts mid-pack, gets explored like+// anything else, and the bandit's own reliability/speed evidence moves it from+// there within a handful of requests. The operator can still tune the ranks by+// hand afterwards — re-registering the model never rewrites them.+//+// This is measured against the operator's LOCAL models table only. It reads no+// remote catalog and refreshes nothing: purely a starting point for the user's+// own endpoint.++export interface CustomModelSeed {+ sizeLabel: string;+ intelligenceRank: number;+ speedRank: number;+}++/** Used when there is no catalog to measure (fresh install, catalog cleared).+ * Mid-tier and mid-rank, matching the historical numeric defaults but with a+ * size_label the router can actually score. */+export const FALLBACK_CUSTOM_SEED: CustomModelSeed = {+ sizeLabel: 'Medium',+ intelligenceRank: 50,+ speedRank: 50,+};++/** Lower median: on an even-sized sample take the smaller of the two middles so+ * the seed never over-claims a tier the catalog only half supports. */+function lowerMedian<T>(values: T[], rank: (value: T) => number): T | undefined {+ if (values.length === 0) return undefined;+ const sorted = [...values].sort((a, b) => rank(a) - rank(b));+ return sorted[Math.floor((sorted.length - 1) / 2)];+}++interface CatalogRankRow {+ size_label: string;+ intelligence_rank: number;+ speed_rank: number;+}++/**+ * The intelligence/speed/tier a newly registered custom model should start at:+ * the median of the operator's catalog models. Custom rows are excluded so the+ * seed can't drift toward previously seeded custom models, and size labels the+ * router doesn't recognize are ignored when picking the median tier.+ */+export function customModelSeed(db: Db): CustomModelSeed {+ const rows = db.prepare(`+ SELECT size_label, intelligence_rank, speed_rank+ FROM models+ WHERE platform != 'custom'+ `).all() as CatalogRankRow[];++ if (rows.length === 0) return FALLBACK_CUSTOM_SEED;++ const tiered = rows.filter(r => r.size_label in TIER_VALUE);+ const medianTier = lowerMedian(tiered, r => tierValue(r.size_label));+ const medianIntelligence = lowerMedian(rows, r => r.intelligence_rank);+ const medianSpeed = lowerMedian(rows, r => r.speed_rank);++ return {+ sizeLabel: medianTier?.size_label ?? FALLBACK_CUSTOM_SEED.sizeLabel,+ intelligenceRank: medianIntelligence?.intelligence_rank ?? FALLBACK_CUSTOM_SEED.intelligenceRank,+ speedRank: medianSpeed?.speed_rank ?? FALLBACK_CUSTOM_SEED.speedRank,+ };+}diff --git a/server/src/services/declarative-config.ts b/server/src/services/declarative-config.tsindex c364e732..20df5c8f 100644--- a/server/src/services/declarative-config.ts+++ b/server/src/services/declarative-config.ts@@ -6,6 +6,7 @@ import { encrypt } from '../lib/crypto.js';import { resolveProvider } from '../providers/index.js';import { setCustomWeights, setRoutingStrategy } from './router.js';import { ensureModelInProfiles } from './profile-models.js';+import { customModelSeed } from './custom-model-seed.js';import {clearCatalogModelTombstone,isCatalogManagedModel,@@ -225,6 +226,10 @@ function registerCustomProvider(db: Db, input: z.infer<typeof customProviderSchebaseUrl: input.baseUrl,enabled: true,});+ // Same median seeding as the dashboard's custom-model path (#488): an+ // undeclared rank means "unknown", not "worst". An explicitly declared rank+ // always wins.+ const seed = customModelSeed(db);let registered = 0;for (const entry of input.models) {const model = normalizeModelEntry(entry);@@ -249,9 +254,9 @@ function registerCustomProvider(db: Db, input: z.infer<typeof customProviderSche`).run(model.modelId,model.displayName,- model.intelligenceRank ?? 50,- model.speedRank ?? 50,- model.sizeLabel ?? 'Custom',+ model.intelligenceRank ?? seed.intelligenceRank,+ model.speedRank ?? seed.speedRank,+ model.sizeLabel ?? seed.sizeLabel,model.monthlyTokenBudget ?? '',model.contextWindow ?? null,model.supportsVision ? 1 : 0,diff --git a/server/src/services/model-discovery.ts b/server/src/services/model-discovery.tsnew file mode 100644index 00000000..28dff422--- /dev/null+++ b/server/src/services/model-discovery.ts@@ -0,0 +1,225 @@+import { OpenAICompatProvider } from '../providers/openai-compat.js';+import { isAbortLikeError } from '../lib/error-classify.js';++// ── Model discovery on a user's own custom endpoint (#488) ──────────────────+//+// Relay services add and drop models weekly, so registering them by hand from a+// `curl .../v1/models | jq` goes stale immediately. This asks the operator's+// OWN endpoint, with the operator's OWN key, what it currently serves.+//+// Scope: this reads one user-configured base_url. It does not read, refresh or+// publish the provider catalog — nothing here touches catalog sync.+//+// Everything in here assumes the upstream is hostile-by-accident: relays are+// wildly inconsistent about the /models envelope, some answer HTML, and a+// misconfigured base_url can point at something that streams forever. So: cap+// the body, cap the list, accept every envelope we've actually seen, and turn+// any surprise into a clean error instead of a 500.++/** Hard cap on the catalog body we will read. The largest real OpenAI-style+ * catalog (OpenRouter, ~400 models with metadata) is well under 1 MB. */+export const MAX_CATALOG_BYTES = 2 * 1024 * 1024;++/** Hard cap on how many ids we hand back — a checkbox list, not a data dump. */+export const MAX_DISCOVERED_MODELS = 500;++/** Ids longer than this are certainly not model ids; skip rather than store. */+const MAX_MODEL_ID_LENGTH = 256;++export interface DiscoveredModel {+ id: string;+ ownedBy: string | null;+}++/** Carries the HTTP status the route should answer with, so a relay's 401 stays+ * a 401 and an unreachable box reads as a gateway problem. */+export class ModelDiscoveryError extends Error {+ readonly status: number;+ constructor(status: number, message: string) {+ super(message);+ this.name = 'ModelDiscoveryError';+ this.status = status;+ }+}++// Envelope keys seen in the wild: OpenAI/most relays use `data`, Ollama and a+// few gateways use `models`, some wrap the list one level deeper.+const LIST_KEYS = ['data', 'models', 'result', 'results', 'items'] as const;+// Id aliases: `id` (OpenAI), `name`/`model` (Ollama), plus the snake/camel and+// slug spellings assorted relays ship.+const ID_KEYS = ['id', 'name', 'model', 'model_id', 'modelId', 'slug'] as const;+const OWNER_KEYS = ['owned_by', 'ownedBy', 'organization', 'owner', 'provider', 'publisher'] as const;++function asRecord(value: unknown): Record<string, unknown> | null {+ return value && typeof value === 'object' && !Array.isArray(value)+ ? (value as Record<string, unknown>)+ : null;+}++/** The model array inside whatever envelope this relay chose. Descends at most+ * one nesting level ({ data: { models: [...] } }) before giving up. */+function findModelArray(payload: unknown, depth = 0): unknown[] | null {+ if (Array.isArray(payload)) return payload;+ const record = asRecord(payload);+ if (!record) return null;+ for (const key of LIST_KEYS) {+ const value = record[key];+ if (Array.isArray(value)) return value;+ if (depth < 1 && asRecord(value)) {+ const nested = findModelArray(value, depth + 1);+ if (nested) return nested;+ }+ }+ return null;+}++function firstString(record: Record<string, unknown>, keys: readonly string[]): string | null {+ for (const key of keys) {+ const value = record[key];+ if (typeof value === 'string' && value.trim().length > 0) return value.trim();+ }+ return null;+}++function toDiscovered(entry: unknown): DiscoveredModel | null {+ if (typeof entry === 'string') {+ const id = entry.trim();+ return id ? { id, ownedBy: null } : null;+ }+ const record = asRecord(entry);+ if (!record) return null;+ const id = firstString(record, ID_KEYS);+ return id ? { id, ownedBy: firstString(record, OWNER_KEYS) } : null;+}++/** Whether this payload carries a model list at all — the difference between+ * an endpoint that genuinely serves nothing and one whose answer we can't+ * read (an HTML error page, a login redirect, a bare error object). */+export function hasModelList(payload: unknown): boolean {+ return findModelArray(payload) !== null;+}++/**+ * Model ids out of any /models envelope we recognize, deduped, sorted and+ * capped. Returns an empty list for a payload with no list in it — the caller+ * decides whether that's an error worth surfacing.+ */+export function parseModelCatalog(payload: unknown): DiscoveredModel[] {+ const entries = findModelArray(payload);+ if (!entries) return [];++ const byId = new Map<string, DiscoveredModel>();+ for (const entry of entries) {+ const model = toDiscovered(entry);+ if (!model || model.id.length > MAX_MODEL_ID_LENGTH) continue;+ if (!byId.has(model.id)) byId.set(model.id, model);+ }++ return [...byId.values()]+ .sort((a, b) => a.id.localeCompare(b.id))+ .slice(0, MAX_DISCOVERED_MODELS);+}++/**+ * Read a response body with a hard byte cap. A declared Content-Length over the+ * cap is refused without reading anything; otherwise the stream is abandoned+ * the moment it runs past the cap, so a base_url pointed at something that+ * never stops can't take the process with it.+ */+export async function readCappedBody(res: Response, maxBytes = MAX_CATALOG_BYTES): Promise<string> {+ const tooLarge = () => new ModelDiscoveryError(+ 502, `The endpoint's model list is larger than ${Math.round(maxBytes / 1024)} KB — refusing to read it.`,+ );++ const declared = Number(res.headers?.get?.('content-length') ?? '');+ if (Number.isFinite(declared) && declared > maxBytes) throw tooLarge();++ const body = res.body as ReadableStream<Uint8Array> | null | undefined;+ if (!body || typeof body.getReader !== 'function') {+ const text = await res.text();+ if (Buffer.byteLength(text, 'utf8') > maxBytes) throw tooLarge();+ return text;+ }++ const reader = body.getReader();+ const chunks: Uint8Array[] = [];+ let total = 0;+ try {+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ if (!value) continue;+ total += value.byteLength;+ if (total > maxBytes) throw tooLarge();+ chunks.push(value);+ }+ } finally {+ await reader.cancel().catch(() => {});+ }+ return Buffer.concat(chunks.map(c => Buffer.from(c))).toString('utf8');+}++/** The provider's own error text, when it bothered to send one. */+function upstreamMessage(bodyText: string): string | null {+ try {+ const parsed = JSON.parse(bodyText) as Record<string, unknown>;+ const error = asRecord(parsed.error);+ const detail = [+ typeof error?.message === 'string' ? error.message : null,+ typeof parsed.message === 'string' ? parsed.message : null,+ typeof parsed.detail === 'string' ? parsed.detail : null,+ typeof parsed.error === 'string' ? parsed.error : null,+ ].find(value => typeof value === 'string' && value.trim().length > 0);+ return detail ? detail.trim().slice(0, 300) : null;+ } catch {+ return null;+ }+}++/**+ * Ask a custom OpenAI-compatible endpoint what it serves. Reuses the provider+ * adapter's own catalog fetch (auth header, proxy, timeout, quota bookkeeping)+ * rather than re-implementing an HTTP call here.+ */+export async function discoverEndpointModels(baseUrl: string, apiKey: string): Promise<DiscoveredModel[]> {+ const provider = new OpenAICompatProvider({+ platform: 'custom',+ name: 'Custom (OpenAI-compatible)',+ baseUrl,+ // Discovery is interactive — the operator is watching a spinner — so don't+ // inherit the 120s custom-provider chat timeout.+ timeoutMs: 30_000,+ });++ let res: Response;+ try {+ res = await provider.fetchModelCatalog(apiKey);+ } catch (err) {+ const reason = isAbortLikeError(err) ? 'timed out' : ((err as Error)?.message ?? 'unknown error');+ throw new ModelDiscoveryError(502, `Could not reach ${baseUrl}/models: ${reason}`);+ }++ const bodyText = await readCappedBody(res);++ if (!res.ok) {+ const detail = upstreamMessage(bodyText);+ if (res.status === 401 || res.status === 403) {+ throw new ModelDiscoveryError(401, `The endpoint rejected the key (HTTP ${res.status})${detail ? `: ${detail}` : ''}`);+ }+ throw new ModelDiscoveryError(502, `${baseUrl}/models returned HTTP ${res.status}${detail ? `: ${detail}` : ''}`);+ }++ let payload: unknown;+ try {+ payload = JSON.parse(bodyText);+ } catch {+ throw new ModelDiscoveryError(502, `${baseUrl}/models did not return a model list (response was not JSON).`);+ }++ // An endpoint that genuinely serves nothing answers `{"data": []}` and that+ // is a valid (if disappointing) result; an unreadable envelope is an error.+ if (!hasModelList(payload)) {+ throw new ModelDiscoveryError(502, `${baseUrl}/models did not return a model list in a format this gateway understands.`);+ }+ return parseModelCatalog(payload);+}diff --git a/server/src/services/router.ts b/server/src/services/router.tsindex b7b0ae7c..455a15f1 100644--- a/server/src/services/router.ts+++ b/server/src/services/router.ts@@ -16,7 +16,7 @@ import {import {BANDIT_PRESETS, DEFAULT_STRATEGY, type RoutingStrategy, type RoutingWeights,reliabilityPosterior, expectedReliability, sampleBeta,- speedScore, intelligenceScore, headroomFactor, rateLimitFactor, combineScore,+ speedScore, intelligenceScore, intelligenceComposite, headroomFactor, rateLimitFactor, combineScore,observedSpeedRank, TIMEOUT_LATENCY_CAP_MS,} from './scoring.js';import { TIMEOUT_ERROR_MARKERS } from '../lib/error-classify.js';@@ -565,15 +565,9 @@ export function writeObservedSpeedRanks(db: Db): number {return written;}-// Composite intelligence: size_label is the cross-provider capability tier-// (issue #135 — intelligence_rank is only meaningful within one provider), so-// tier dominates and intelligence_rank breaks ties inside a tier.-const TIER_VALUE: Record<string, number> = { Frontier: 4, Large: 3, Medium: 2, Small: 1 };-function intelligenceComposite(sizeLabel: string, intelligenceRank: number): number {- const tier = TIER_VALUE[sizeLabel] ?? 0;- // tier*1000 keeps tiers strictly separated; -rank prefers lower rank in-tier.- return tier * 1000 - intelligenceRank;-}+// Composite intelligence (tier-first, rank-as-tiebreaker) lives in scoring.ts+// so the seeding path can reason about the same tier ladder the router scores+// on — see intelligenceComposite there.// Per-model axis values + the final score. `sampled` chooses Thompson sampling// (for routing) vs. the expected value (for a stable dashboard display).diff --git a/server/src/services/scoring.ts b/server/src/services/scoring.tsindex 4520604c..7124171b 100644--- a/server/src/services/scoring.ts+++ b/server/src/services/scoring.ts@@ -142,7 +142,23 @@ export function observedSpeedRank(speed: number): number {}// ── Intelligence ────────────────────────────────────────────────────────────-// Caller supplies a composite (tier-first, rank-as-tiebreaker — see router) and+// `size_label` is the CROSS-PROVIDER capability tier (issue #135 —+// intelligence_rank is only meaningful within one provider's own catalog), so+// tier dominates and intelligence_rank breaks ties inside a tier. A label we+// don't recognize scores below every real tier, which is also why a model+// seeded with a placeholder label can never win an auto-route (#488).+export const TIER_VALUE: Record<string, number> = { Frontier: 4, Large: 3, Medium: 2, Small: 1 };++export function tierValue(sizeLabel: string): number {+ return TIER_VALUE[sizeLabel] ?? 0;+}++export function intelligenceComposite(sizeLabel: string, intelligenceRank: number): number {+ // tier*1000 keeps tiers strictly separated; -rank prefers lower rank in-tier.+ return tierValue(sizeLabel) * 1000 - intelligenceRank;+}++// Caller supplies a composite (tier-first, rank-as-tiebreaker — see above) and// the min/max across the enabled chain. We min-max normalize to [0,1], 1 = best.export function intelligenceScore(composite: number, min: number, max: number): number {if (max <= min) return 1; // single model or all equal → neutral-high