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 CloudGPU as a model provider (#21543)
CloudGPU0cfa864cc69c
diff --git a/conf/llm_factories.json b/conf/llm_factories.jsonindex fc656450c4..a2a232aa67 100644--- a/conf/llm_factories.json+++ b/conf/llm_factories.json@@ -3532,6 +3532,14 @@"llm": [],"url": "https://api.runcrate.ai/v1"},+ {+ "name": "CloudGPU",+ "logo": "",+ "tags": "LLM,IMAGE2TEXT",+ "status": "1",+ "llm": [],+ "url": "https://cloudgpu.app/v1"+ },{"name": "StepFun","logo": "",diff --git a/conf/model.md b/conf/model.mdindex a5191abcd0..d67b12143b 100644--- a/conf/model.md+++ b/conf/model.md@@ -176,6 +176,7 @@ The following providers are **aggregators** — they host models from multiple u| **AstraFlow** | Multi-provider aggregator || **Avian** | Multi-provider aggregator || **Baidu (Qianwen)** | Ernie + third-party models |+| **CloudGPU** | GPU cloud with an OpenAI-compatible inference API for open models || **CometAPI** | Multi-provider aggregator || **DeepInfra** | Open-source model hosting || **Demon Route** | OpenAI-compatible router |diff --git a/conf/models/cloudgpu.json b/conf/models/cloudgpu.jsonnew file mode 100644index 0000000000..53a420a36e--- /dev/null+++ b/conf/models/cloudgpu.json@@ -0,0 +1,108 @@+{+ "name": "CloudGPU",+ "url": {+ "default": "https://cloudgpu.app/v1"+ },+ "url_suffix": {+ "chat": "chat/completions",+ "models": "models"+ },+ "class": "cloudgpu",+ "models": [+ {+ "name": "deepseek-v4.1-flash",+ "context_length": 1048576,+ "model_types": [+ "chat",+ "vision"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "deepseek-v4-flash",+ "context_length": 1048576,+ "model_types": [+ "chat"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "deepseek-v4-pro",+ "context_length": 1048576,+ "model_types": [+ "chat"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "kimi-k2.7-code",+ "context_length": 262144,+ "model_types": [+ "chat",+ "vision"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "kimi-k2.6",+ "context_length": 262144,+ "model_types": [+ "chat",+ "vision"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "glm-5.3-flash",+ "context_length": 1048576,+ "model_types": [+ "chat",+ "vision"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "glm-5.2",+ "context_length": 1048576,+ "model_types": [+ "chat"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "qwen3-coder-480b",+ "context_length": 262144,+ "model_types": [+ "chat"+ ],+ "tools": {+ "support": true+ }+ },+ {+ "name": "minimax-m3",+ "context_length": 1048576,+ "model_types": [+ "chat",+ "vision"+ ],+ "tools": {+ "support": true+ }+ }+ ]+}diff --git a/internal/entity/models/cloudgpu.go b/internal/entity/models/cloudgpu.gonew file mode 100644index 0000000000..c3debb167b--- /dev/null+++ b/internal/entity/models/cloudgpu.go@@ -0,0 +1,70 @@+//+// 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++import "context"++// CloudGPUModel drives CloudGPU (https://cloudgpu.app/v1), a GPU cloud whose+// inference API serves open models through OpenAI-compatible chat and+// model-list endpoints, so the embedded OpenAIAPICompatibleModel covers+// every call.+type CloudGPUModel struct {+ *OpenAIAPICompatibleModel+}++// NewCloudGPUModel creates a CloudGPU driver.+func NewCloudGPUModel(baseURL map[string]string, urlSuffix URLSuffix) *CloudGPUModel {+ return &CloudGPUModel{+ OpenAIAPICompatibleModel: NewOpenAIAPICompatibleModel(baseURL, urlSuffix),+ }+}++// Name returns the driver name.+func (m *CloudGPUModel) Name() string {+ return "cloudgpu"+}++// NewInstance returns a driver bound to the given base URL.+func (m *CloudGPUModel) NewInstance(baseURL map[string]string) ModelDriver {+ return NewCloudGPUModel(baseURL, m.baseModel.URLSuffix)+}++// ListModels lists CloudGPU models and, for ids in the CloudGPU catalog+// (conf/models/cloudgpu.json), returns the catalogued model types so vision+// models keep their image-input capability. Unknown ids keep the name-based+// inference of the embedded driver.+func (m *CloudGPUModel) ListModels(ctx context.Context, apiConfig *APIConfig) ([]ListModelResponse, error) {+ models, err := m.OpenAIAPICompatibleModel.ListModels(ctx, apiConfig)+ if err != nil {+ return nil, err+ }++ pm := GetProviderManager()+ if pm == nil {+ return models, nil+ }+ provider := pm.FindProvider("CloudGPU")+ if provider == nil {+ return models, nil+ }+ for i := range models {+ if known := pm.FindModel(provider, models[i].Name); known != nil && len(known.ModelTypes) > 0 {+ models[i].ModelTypes = append([]string(nil), known.ModelTypes...)+ }+ }+ return models, nil+}diff --git a/internal/entity/models/cloudgpu_test.go b/internal/entity/models/cloudgpu_test.gonew file mode 100644index 0000000000..840e72022c--- /dev/null+++ b/internal/entity/models/cloudgpu_test.go@@ -0,0 +1,194 @@+//+// 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++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "ragflow/internal/common"+ "strings"+ "testing"+)++// newCloudGPUForTest creates a CloudGPUModel instance for testing.+func newCloudGPUForTest(baseURL string) *CloudGPUModel {+ return NewCloudGPUModel(+ map[string]string{"default": baseURL},+ URLSuffix{Chat: "chat/completions", Models: "models"},+ )+}++// TestCloudGPUName tests the driver name.+func TestCloudGPUName(t *testing.T) {+ if got := newCloudGPUForTest("http://unused").Name(); got != "cloudgpu" {+ t.Errorf("Name()=%q", got)+ }+}++// TestCloudGPUFactory tests creating the driver from factory.+func TestCloudGPUFactory(t *testing.T) {+ driver, err := NewModelFactory().CreateModelDriver("cloudgpu", map[string]string{"default": "http://unused"}, URLSuffix{})+ if err != nil {+ t.Fatalf("CreateModelDriver: %v", err)+ }+ if _, ok := driver.(*CloudGPUModel); !ok {+ t.Fatalf("driver type=%T, want *CloudGPUModel", driver)+ }+ if _, ok := driver.NewInstance(map[string]string{"default": "http://other"}).(*CloudGPUModel); !ok {+ t.Fatal("NewInstance did not return *CloudGPUModel")+ }+}++// The shipped config must resolve to the CloudGPU driver. CreateModelDriver+// dispatches on strings.ToLower(name), so the "CloudGPU" provider name has+// to match the "cloudgpu" case; anything else silently falls through to+// DummyModel.+func TestCloudGPUProviderConfig(t *testing.T) {+ dir, restore := setupProviderTestDir(t, "cloudgpu.json")+ defer restore()++ if err := InitProviderManager(dir); err != nil {+ t.Fatalf("InitProviderManager: %v", err)+ }++ provider := GetProviderManager().FindProvider("CloudGPU")+ if provider == nil {+ t.Fatal("CloudGPU provider not found")+ }+ if _, ok := provider.ModelDriver.(*CloudGPUModel); !ok {+ t.Fatalf("ModelDriver=%T, want *models.CloudGPUModel", provider.ModelDriver)+ }+}++// TestCloudGPUChatSendsAPIKey tests chat completion authentication and that+// the model id reaches the API unchanged.+func TestCloudGPUChatSendsAPIKey(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)+ }+ var body struct {+ Model string `json:"model"`+ }+ if err := json.NewDecoder(r.Body).Decode(&body); err != nil {+ t.Errorf("decode request: %v", err)+ }+ if body.Model != "deepseek-v4.1-flash" {+ t.Errorf("model=%q", body.Model)+ }+ _ = json.NewEncoder(w).Encode(map[string]any{+ "id": "chat-cloudgpu",+ "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 := newCloudGPUForTest(srv.URL).ChatWithMessages(+ t.Context(),+ "deepseek-v4.1-flash",+ []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)+}++// TestCloudGPUListModelsAndCheckConnection tests model listing and connectivity check.+func TestCloudGPUListModelsAndCheckConnection(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": "deepseek-v4.1-flash"},+ {"id": "kimi-k2.6"},+ },+ })+ }))+ defer srv.Close()++ model := newCloudGPUForTest(srv.URL)+ list, err := model.ListModels(t.Context(), &APIConfig{ApiKey: &testAPIKey})+ if err != nil {+ t.Fatalf("ListModels: %v", err)+ }+ if joinModelNames(list, ",") != "deepseek-v4.1-flash,kimi-k2.6" {+ t.Errorf("models=%v", list)+ }+ if err := model.CheckConnection(t.Context(), &APIConfig{ApiKey: &testAPIKey}); err != nil {+ t.Fatalf("CheckConnection: %v", err)+ }+}++// Known CloudGPU models must report their catalogued types, so the vision+// models are not downgraded to chat-only by name inference. Unknown ids keep+// the name-based fallback.+func TestCloudGPUListModelsUsesCatalogTypes(t *testing.T) {+ withSSRFBypass(t)+ dir, restore := setupProviderTestDir(t, "cloudgpu.json")+ defer restore()+ if err := InitProviderManager(dir); err != nil {+ t.Fatalf("InitProviderManager: %v", err)+ }++ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ _ = json.NewEncoder(w).Encode(map[string]any{+ "data": []map[string]any{+ {"id": "deepseek-v4.1-flash"},+ {"id": "kimi-k2.6"},+ {"id": "glm-5.2"},+ {"id": "some-new-vl-model"},+ },+ })+ }))+ defer srv.Close()++ list, err := newCloudGPUForTest(srv.URL).ListModels(t.Context(), &APIConfig{ApiKey: &testAPIKey})+ if err != nil {+ t.Fatalf("ListModels: %v", err)+ }+ want := map[string]string{+ "deepseek-v4.1-flash": "chat,vision",+ "kimi-k2.6": "chat,vision",+ "glm-5.2": "chat",+ "some-new-vl-model": "chat,vision",+ }+ if len(list) != len(want) {+ t.Fatalf("models=%v", list)+ }+ for _, model := range list {+ if got := strings.Join(model.ModelTypes, ","); got != want[model.Name] {+ t.Errorf("%s types=%q, want %q", model.Name, got, want[model.Name])+ }+ }+}diff --git a/internal/entity/models/factory.go b/internal/entity/models/factory.goindex 7dcda49b28..32beef1341 100644--- a/internal/entity/models/factory.go+++ b/internal/entity/models/factory.go@@ -201,6 +201,8 @@ func (f *ModelFactory) CreateModelDriver(providerName string, baseURL map[stringreturn NewEmpirioLabsModel(baseURL, urlSuffix), nilcase "runcrate":return NewRuncrateModel(baseURL, urlSuffix), nil+ case "cloudgpu":+ return NewCloudGPUModel(baseURL, urlSuffix), nilcase "new api":return NewNewAPIModel(baseURL, urlSuffix), nildefault:diff --git a/web/src/assets/svg/llm/cloudgpu.svg b/web/src/assets/svg/llm/cloudgpu.svgnew file mode 100644index 0000000000..bf817f0536--- /dev/null+++ b/web/src/assets/svg/llm/cloudgpu.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="8" fill="#111827"/><g fill="none" stroke="#FFFFFF" stroke-linecap="round"><path d="M6 24H26" stroke-width="2" opacity=".38"/><path d="M6 18.5H26" stroke-width="2" opacity=".62"/><path d="M6 13C13 13 19 13 26 6" stroke-width="2.4"/></g></svg>diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsxindex 0775a9601c..f85be88ed3 100644--- a/web/src/components/svg-icon.tsx+++ b/web/src/components/svg-icon.tsx@@ -122,6 +122,7 @@ const svgIcons = [LLMFactory.EmpirioLabs,LLMFactory.AIStupidLevel,LLMFactory.Runcrate,+ LLMFactory.CloudGPU,];export const LlmIcon = ({diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.tsindex 1e509788b1..bd9a4f218b 100644--- a/web/src/constants/llm.ts+++ b/web/src/constants/llm.ts@@ -117,6 +117,7 @@ export enum LLMFactory {EmpirioLabs = 'EmpirioLabs AI',AIStupidLevel = 'AI Stupid Level',Runcrate = 'Runcrate',+ CloudGPU = 'CloudGPU',SystemOne = 'SystemOne',}@@ -217,6 +218,7 @@ export const IconMap = {[LLMFactory.EmpirioLabs]: 'empiriolabs',[LLMFactory.AIStupidLevel]: 'aistupidlevel',[LLMFactory.Runcrate]: 'runcrate',+ [LLMFactory.CloudGPU]: 'cloudgpu',};/**@@ -265,6 +267,7 @@ export const APIMapUrl = {[LLMFactory.AIStupidLevel]: 'https://aistupidlevel.info/router/keys',[LLMFactory.Runcrate]:'https://www.runcrate.ai/dashboard/api-keys?utm_source=ragflow&utm_medium=directory&utm_campaign=gpu_pricing',+ [LLMFactory.CloudGPU]: 'https://cloudgpu.app/api/console',[LLMFactory.MWS]:'https://mws.ru/docs/cloud-platform/gpt/general/inference-text.html',[LLMFactory.Anthropic]: 'https://console.anthropic.com/settings/keys',