RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: add Hubris as a model provider (#19341)
Konstantin Romankov4731ee332297
diff --git a/conf/llm_factories.json b/conf/llm_factories.jsonindex e149c4a80f..5ea9bb36d3 100644--- a/conf/llm_factories.json+++ b/conf/llm_factories.json@@ -5384,6 +5384,13 @@"status": "1","llm": []},+ {+ "name": "Hubris",+ "logo": "",+ "tags": "LLM,TEXT EMBEDDING",+ "status": "1",+ "llm": []+ },{"name": "HuggingFace","logo": "",diff --git a/conf/models/hubris.json b/conf/models/hubris.jsonnew file mode 100644index 0000000000..05cff89509--- /dev/null+++ b/conf/models/hubris.json@@ -0,0 +1,249 @@+{+ "name": "Hubris",+ "url": {+ "default": "https://api.hubris.pw/v1"+ },+ "url_suffix": {+ "chat": "chat/completions",+ "models": "models",+ "embedding": "embeddings"+ },+ "class": "hubris",+ "models": [+ {+ "name": "anthropic/claude-haiku-4.5",+ "context_length": 200000,+ "max_output": 64000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "anthropic/claude-opus-5",+ "context_length": 1000000,+ "max_output": 128000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "anthropic/claude-sonnet-5",+ "context_length": 1000000,+ "max_output": 128000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "deepseek/deepseek-v4-flash",+ "context_length": 1048576,+ "max_output": 384000,+ "model_types": [+ "chat"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "deepseek/deepseek-v4-pro",+ "context_length": 1048576,+ "max_output": 384000,+ "model_types": [+ "chat"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "google/gemini-3.7-flash",+ "context_length": 1048576,+ "max_output": 65536,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "google/gemini-3.8-flash",+ "context_length": 1048576,+ "max_output": 65536,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "minimax/minimax-m3",+ "context_length": 1048576,+ "max_output": 512000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "moonshotai/kimi-k3",+ "context_length": 1048576,+ "max_output": 943718,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "openai/gpt-5.4-mini",+ "context_length": 400000,+ "max_output": 128000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "openai/gpt-5.6-luna",+ "context_length": 1050000,+ "max_output": 128000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "openai/gpt-6-astra",+ "context_length": 1050000,+ "max_output": 128000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": false,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "x-ai/grok-4.6",+ "context_length": 500000,+ "max_output": 450000,+ "model_types": [+ "chat",+ "vision"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "z-ai/glm-5.3",+ "context_length": 1310720,+ "max_output": 943718,+ "model_types": [+ "chat"+ ],+ "thinking": {+ "default_value": true,+ "clear_thinking": true+ },+ "tools": {+ "support": true+ }+ },+ {+ "name": "openai/text-embedding-3-large",+ "max_tokens": 8192,+ "model_types": [+ "embedding"+ ]+ },+ {+ "name": "openai/text-embedding-3-small",+ "max_tokens": 8192,+ "model_types": [+ "embedding"+ ]+ }+ ]+}diff --git a/docs/guides/models/supported_models.mdx b/docs/guides/models/supported_models.mdxindex 5608857452..fad33b8725 100644--- a/docs/guides/models/supported_models.mdx+++ b/docs/guides/models/supported_models.mdx@@ -43,6 +43,7 @@ A complete list of model providers supported by RAGFlow, which will continue to| GPUStack | `https://gpustack.ai` || GreenPT | `https://greenpt.ai` || Groq | `https://groq.com` |+| Hubris | `https://hubris.pw` || HuggingFace | `https://huggingface.co` || Jiekou.AI | `https://jiekou.ai` || Jina | `https://jina.ai` |diff --git a/internal/entity/models/factory.go b/internal/entity/models/factory.goindex 63101bcfd8..5bcd22df91 100644--- a/internal/entity/models/factory.go+++ b/internal/entity/models/factory.go@@ -61,6 +61,8 @@ func (f *ModelFactory) CreateModelDriver(providerName string, baseURL map[stringreturn NewMWSModel(baseURL, urlSuffix), nilcase "xai":return NewXAIModel(baseURL, urlSuffix), nil+ case "hubris":+ return NewHubrisModel(baseURL, urlSuffix), nilcase "lm-studio":return NewLmStudioModel(baseURL, urlSuffix), nilcase "llmman":diff --git a/internal/entity/models/hubris.go b/internal/entity/models/hubris.gonew file mode 100644index 0000000000..8887fc25ca--- /dev/null+++ b/internal/entity/models/hubris.go@@ -0,0 +1,41 @@+//+// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.+//++package models++// HubrisModel drives Hubris, a hosted gateway that fronts models from several+// vendors behind one OpenAI-compatible endpoint, so the embedded+// OpenAIAPICompatibleModel covers every call.+type HubrisModel struct {+ *OpenAIAPICompatibleModel+}++// NewHubrisModel creates a Hubris driver.+func NewHubrisModel(baseURL map[string]string, urlSuffix URLSuffix) *HubrisModel {+ return &HubrisModel{+ OpenAIAPICompatibleModel: NewOpenAIAPICompatibleModel(baseURL, urlSuffix),+ }+}++// Name returns the driver name.+func (m *HubrisModel) Name() string {+ return "hubris"+}++// NewInstance returns a driver bound to the given base URL.+func (m *HubrisModel) NewInstance(baseURL map[string]string) ModelDriver {+ return NewHubrisModel(baseURL, m.baseModel.URLSuffix)+}diff --git a/internal/entity/models/hubris_test.go b/internal/entity/models/hubris_test.gonew file mode 100644index 0000000000..735a1f34e0--- /dev/null+++ b/internal/entity/models/hubris_test.go@@ -0,0 +1,132 @@+package models++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "ragflow/internal/common"+ "testing"+)++var testAPIKey = "sk-gw-test"++func newHubrisForTest(baseURL string) *HubrisModel {+ return NewHubrisModel(+ map[string]string{"default": baseURL},+ URLSuffix{Chat: "chat/completions", Models: "models", Embedding: "embeddings"},+ )+}++func TestHubrisName(t *testing.T) {+ if got := newHubrisForTest("http://unused").Name(); got != "hubris" {+ t.Errorf("Name()=%q", got)+ }+}++func TestHubrisFactory(t *testing.T) {+ driver, err := NewModelFactory().CreateModelDriver("hubris", map[string]string{"default": "http://unused"}, URLSuffix{})+ if err != nil {+ t.Fatalf("CreateModelDriver: %v", err)+ }+ if _, ok := driver.(*HubrisModel); !ok {+ t.Fatalf("driver type=%T, want *HubrisModel", driver)+ }+ if _, ok := driver.NewInstance(map[string]string{"default": "http://other"}).(*HubrisModel); !ok {+ t.Fatal("NewInstance did not return *HubrisModel")+ }+}++// Hubris is a hosted gateway, so unlike a local server it must receive the+// tenant's key as a bearer token on every call.+func TestHubrisChatSendsAPIKey(t *testing.T) {+ withSSRFBypass(t)+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/chat/completions" {+ t.Errorf("path=%s", r.URL.Path)+ }+ if got := r.Header.Get("Authorization"); got != "Bearer sk-gw-test" {+ t.Errorf("Authorization=%q", got)+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "id": "chat-hubris",+ "choices": []map[string]any{{"message": map[string]any{"content": "pong"}}},+ "usage": map[string]any{"prompt_tokens": 3, "completion_tokens": 5, "total_tokens": 8},+ })+ }))+ defer srv.Close()++ usage := &common.ModelUsage{}+ resp, err := newHubrisForTest(srv.URL).ChatWithMessages(+ t.Context(),+ "anthropic/claude-sonnet-5",+ []Message{{Role: "user", Content: "ping"}},+ &APIConfig{ApiKey: &testAPIKey},+ nil,+ usage,+ )+ if err != nil {+ t.Fatalf("ChatWithMessages: %v", err)+ }+ if *resp.Answer != "pong" {+ t.Errorf("Answer=%q", *resp.Answer)+ }+ assertModelUsage(t, usage, 3, 5, 8)+}++func TestHubrisEmbed(t *testing.T) {+ withSSRFBypass(t)+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/embeddings" {+ t.Errorf("path=%s", r.URL.Path)+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "data": []map[string]any{{"embedding": []float64{0.1, 0.2}, "index": 0}},+ "usage": map[string]any{"prompt_tokens": 7, "total_tokens": 7},+ })+ }))+ defer srv.Close()++ modelName := "openai/text-embedding-3-small"+ embeddings, err := newHubrisForTest(srv.URL).Embed(+ t.Context(),+ &modelName,+ EmbedRequest{Texts: []string{"document"}},+ &APIConfig{ApiKey: &testAPIKey},+ nil,+ &common.ModelUsage{},+ )+ if err != nil {+ t.Fatalf("Embed: %v", err)+ }+ if len(embeddings) != 1 || len(embeddings[0].Embedding) != 2 {+ t.Fatalf("embeddings=%#v", embeddings)+ }+}++func TestHubrisListModelsAndCheckConnection(t *testing.T) {+ withSSRFBypass(t)+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.Method != http.MethodGet || r.URL.Path != "/models" {+ t.Errorf("%s %s", r.Method, r.URL.Path)+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "data": []map[string]any{+ {"id": "anthropic/claude-sonnet-5"},+ {"id": "openai/text-embedding-3-small"},+ },+ })+ }))+ defer srv.Close()++ model := newHubrisForTest(srv.URL)+ list, err := model.ListModels(t.Context(), &APIConfig{ApiKey: &testAPIKey})+ if err != nil {+ t.Fatalf("ListModels: %v", err)+ }+ if joinModelNames(list, ",") != "anthropic/claude-sonnet-5,openai/text-embedding-3-small" {+ t.Errorf("models=%v", list)+ }+ if err := model.CheckConnection(t.Context(), &APIConfig{ApiKey: &testAPIKey}); err != nil {+ t.Fatalf("CheckConnection: %v", err)+ }+}diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.pyindex 9018544611..33d308679d 100644--- a/rag/llm/chat_model.py+++ b/rag/llm/chat_model.py@@ -1169,6 +1169,28 @@ class LlmmanChat(Base):super().__init__("llmman", model_name, base_url, **kwargs)+class HubrisChat(Base):+ """Hubris OpenAI-compatible chat adapter.++ The endpoint is fixed rather than configurable. Hubris is a hosted gateway+ on one known host, so a tenant-supplied ``base_url`` would have no+ legitimate use and would send the Hubris API key to whatever host was+ configured.+ """++ _FACTORY_NAME = "Hubris"++ _BASE_URL = "https://api.hubris.pw/v1"++ def __init__(self, key, model_name, base_url=None, **kwargs):+ """Build the client against the fixed Hubris endpoint.++ ``base_url`` is accepted for signature compatibility with the other+ chat adapters and deliberately ignored.+ """+ super().__init__(key, model_name, self._BASE_URL, **kwargs)++class OpenAI_APIChat(Base):_FACTORY_NAME = ["VLLM", "OpenAI-API-Compatible"]diff --git a/rag/llm/embedding_model.py b/rag/llm/embedding_model.pyindex 208eda97ce..db4e1d2c62 100644--- a/rag/llm/embedding_model.py+++ b/rag/llm/embedding_model.py@@ -918,6 +918,22 @@ class LlmmanEmbed(LocalAIEmbed):_FACTORY_NAME = "llmman"+class HubrisEmbed(OpenAIEmbed):+ """Hubris embeddings.++ The endpoint is fixed rather than configurable, matching HubrisChat. Hubris+ is a hosted gateway on one known host, so a tenant-supplied ``base_url``+ would have no legitimate use and would send the tenant's key elsewhere.+ """++ _FACTORY_NAME = "Hubris"++ _BASE_URL = "https://api.hubris.pw/v1"++ def __init__(self, key, model_name, base_url=None):+ super().__init__(key, model_name, self._BASE_URL)++class OpenAI_APIEmbed(OpenAIEmbed):_FACTORY_NAME = ["VLLM", "OpenAI-API-Compatible"]diff --git a/rag/llm/model_meta.py b/rag/llm/model_meta.pyindex aafa5dad9b..157de63a07 100644--- a/rag/llm/model_meta.py+++ b/rag/llm/model_meta.py@@ -1132,6 +1132,23 @@ class Llmman(OpenAIAPICompatible):_FACTORY_NAME = "llmman"+class Hubris(OpenAIAPICompatible):+ """Hubris model metadata.++ ``_get_model_list_url`` is pinned for the same reason the chat and+ embedding classes pin their endpoint: the catalogue must be read from the+ gateway itself, never from a host supplied by the tenant.+ """++ _FACTORY_NAME = "Hubris"++ _BASE_URL = "https://api.hubris.pw/v1"++ def _get_model_list_url(self):+ """Return the catalogue URL, ignoring any tenant-configured base URL."""+ return f"{self._BASE_URL}/models"++class NewAPI(OpenAIAPICompatible):_FACTORY_NAME = "New API"