Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

feat: add Opper as a model provider (#20577)

Felix536f8fa7a633
diff --git a/conf/llm_factories.json b/conf/llm_factories.json
index fbbc970f6a..270b5f04f3 100644
--- a/conf/llm_factories.json
+++ b/conf/llm_factories.json
@@ -3484,6 +3484,14 @@
"rank": "989",
"url": "https://openrouter.ai/api/v1"
},
+ {
+ "name": "Opper",
+ "logo": "",
+ "tags": "LLM,TEXT EMBEDDING,IMAGE2TEXT",
+ "status": "1",
+ "llm": [],
+ "url": "https://api.opper.ai/v3/compat"
+ },
{
"name": "StepFun",
"logo": "",
diff --git a/conf/models/opper.json b/conf/models/opper.json
new file mode 100644
index 0000000000..84525f2850
--- /dev/null
+++ b/conf/models/opper.json
@@ -0,0 +1,80 @@
+{
+ "name": "Opper",
+ "url": {
+ "default": "https://api.opper.ai/v3/compat"
+ },
+ "url_suffix": {
+ "chat": "chat/completions",
+ "models": "models",
+ "embedding": "embeddings"
+ },
+ "class": "opper",
+ "models": [
+ {
+ "name": "claude-sonnet-4-6",
+ "context_length": 1000000,
+ "max_output": 64000,
+ "model_types": [
+ "chat",
+ "vision"
+ ],
+ "tools": {
+ "support": true
+ }
+ },
+ {
+ "name": "gpt-5.5",
+ "context_length": 1050000,
+ "max_output": 128000,
+ "model_types": [
+ "chat",
+ "vision"
+ ],
+ "tools": {
+ "support": true
+ }
+ },
+ {
+ "name": "gpt-5.4-mini",
+ "context_length": 400000,
+ "max_output": 128000,
+ "model_types": [
+ "chat",
+ "vision"
+ ],
+ "tools": {
+ "support": true
+ }
+ },
+ {
+ "name": "gemini-3.8-flash",
+ "context_length": 1048576,
+ "max_output": 65536,
+ "model_types": [
+ "chat",
+ "vision"
+ ],
+ "tools": {
+ "support": true
+ }
+ },
+ {
+ "name": "deepseek-v4-pro",
+ "context_length": 1048576,
+ "max_output": 65536,
+ "model_types": [
+ "chat"
+ ],
+ "tools": {
+ "support": true
+ }
+ },
+ {
+ "name": "text-embedding-3-small",
+ "max_tokens": 8191,
+ "model_types": [
+ "embedding"
+ ]
+ }
+ ]
+}
diff --git a/docs/guides/models/supported_models.mdx b/docs/guides/models/supported_models.mdx
index 622514a471..eda54373dc 100644
--- a/docs/guides/models/supported_models.mdx
+++ b/docs/guides/models/supported_models.mdx
@@ -72,6 +72,7 @@ A complete list of model providers supported by RAGFlow, which will continue to
| OpenAI-API-Compatible | N/A |
| OpenDataLoader | — |
| OpenRouter | `https://openrouter.ai` |
+| Opper | `https://opper.ai` |
| PaddleOCR | — |
| Perplexity | `https://www.perplexity.ai` |
| PPIO | `https://ppio.com` |
diff --git a/internal/entity/models/factory.go b/internal/entity/models/factory.go
index 3729c50003..1642961b04 100644
--- a/internal/entity/models/factory.go
+++ b/internal/entity/models/factory.go
@@ -179,6 +179,8 @@ func (f *ModelFactory) CreateModelDriver(providerName string, baseURL map[string
return NewAnonRouterModel(baseURL, urlSuffix), nil
case "api-route":
return NewApiRouteModel(baseURL, urlSuffix), nil
+ case "opper":
+ return NewOpperModel(baseURL, urlSuffix), nil
default:
return NewDummyModel(baseURL, urlSuffix), nil
}
diff --git a/internal/entity/models/opper.go b/internal/entity/models/opper.go
new file mode 100644
index 0000000000..bfbe9e6acd
--- /dev/null
+++ b/internal/entity/models/opper.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
+
+// OpperModel drives Opper, an EU-hosted AI gateway that serves models from
+// many providers behind one OpenAI-compatible API, so the embedded
+// OpenAIAPICompatibleModel covers every call.
+type OpperModel struct {
+ *OpenAIAPICompatibleModel
+}
+
+// NewOpperModel creates an Opper driver.
+func NewOpperModel(baseURL map[string]string, urlSuffix URLSuffix) *OpperModel {
+ return &OpperModel{
+ OpenAIAPICompatibleModel: NewOpenAIAPICompatibleModel(baseURL, urlSuffix),
+ }
+}
+
+// Name returns the driver name.
+func (m *OpperModel) Name() string {
+ return "opper"
+}
+
+// NewInstance returns a driver bound to the given base URL.
+func (m *OpperModel) NewInstance(baseURL map[string]string) ModelDriver {
+ return NewOpperModel(baseURL, m.baseModel.URLSuffix)
+}
diff --git a/internal/entity/models/opper_test.go b/internal/entity/models/opper_test.go
new file mode 100644
index 0000000000..94ba3e705b
--- /dev/null
+++ b/internal/entity/models/opper_test.go
@@ -0,0 +1,170 @@
+//
+// 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"
+ "testing"
+)
+
+// newOpperForTest creates an OpperModel instance for testing.
+func newOpperForTest(baseURL string) *OpperModel {
+ return NewOpperModel(
+ map[string]string{"default": baseURL},
+ URLSuffix{Chat: "chat/completions", Models: "models", Embedding: "embeddings"},
+ )
+}
+
+// TestOpperName tests the driver name.
+func TestOpperName(t *testing.T) {
+ if got := newOpperForTest("http://unused").Name(); got != "opper" {
+ t.Errorf("Name()=%q", got)
+ }
+}
+
+// TestOpperFactory tests creating the driver from factory.
+func TestOpperFactory(t *testing.T) {
+ driver, err := NewModelFactory().CreateModelDriver("opper", map[string]string{"default": "http://unused"}, URLSuffix{})
+ if err != nil {
+ t.Fatalf("CreateModelDriver: %v", err)
+ }
+ if _, ok := driver.(*OpperModel); !ok {
+ t.Fatalf("driver type=%T, want *OpperModel", driver)
+ }
+ if _, ok := driver.NewInstance(map[string]string{"default": "http://other"}).(*OpperModel); !ok {
+ t.Fatal("NewInstance did not return *OpperModel")
+ }
+}
+
+// The shipped config must resolve to the Opper driver. CreateModelDriver
+// dispatches on strings.ToLower(name), so the "Opper" provider name has to
+// match the "opper" case; anything else silently falls through to DummyModel.
+func TestOpperProviderConfig(t *testing.T) {
+ dir, restore := setupProviderTestDir(t, "opper.json")
+ defer restore()
+
+ if err := InitProviderManager(dir); err != nil {
+ t.Fatalf("InitProviderManager: %v", err)
+ }
+
+ provider := GetProviderManager().FindProvider("Opper")
+ if provider == nil {
+ t.Fatal("Opper provider not found")
+ }
+ if _, ok := provider.ModelDriver.(*OpperModel); !ok {
+ t.Fatalf("ModelDriver=%T, want *models.OpperModel", provider.ModelDriver)
+ }
+}
+
+// TestOpperChatSendsAPIKey tests chat completion authentication.
+func TestOpperChatSendsAPIKey(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-opper",
+ "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 := newOpperForTest(srv.URL).ChatWithMessages(
+ t.Context(),
+ "claude-sonnet-4-6",
+ []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)
+}
+
+// TestOpperEmbed tests embedding requests.
+func TestOpperEmbed(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 := "text-embedding-3-small"
+ embeddings, err := newOpperForTest(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)
+ }
+}
+
+// TestOpperListModelsAndCheckConnection tests model listing and connectivity check.
+func TestOpperListModelsAndCheckConnection(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": "claude-sonnet-4-6"},
+ {"id": "text-embedding-3-small"},
+ },
+ })
+ }))
+ defer srv.Close()
+
+ model := newOpperForTest(srv.URL)
+ list, err := model.ListModels(t.Context(), &APIConfig{ApiKey: &testAPIKey})
+ if err != nil {
+ t.Fatalf("ListModels: %v", err)
+ }
+ if joinModelNames(list, ",") != "claude-sonnet-4-6,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/web/src/assets/svg/llm/opper.svg b/web/src/assets/svg/llm/opper.svg
new file mode 100644
index 0000000000..ad69cb9b48
--- /dev/null
+++ b/web/src/assets/svg/llm/opper.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 120 120">
+ <rect width="120" height="120" rx="24" fill="#1B2E40"/>
+ <path transform="translate(35.31 24) scale(0.228571)" fill="#fff" fill-rule="evenodd" clip-rule="evenodd" d="M159.78 315C71.53 315 0 244.49 0 157.5C0 -18.9499 159.78 0.650075 159.78 0.650075C159.78 87.2201 88.36 157.4 0.2 157.5C149.8 157.64 159.78 315 159.78 315ZM160.52 217.98C160.52 217.98 156.94 161.65 105.04 157.52C120.6 157.34 160.52 151.54 160.52 96.5601C160.52 151.54 200.44 157.34 216 157.52C164.1 161.63 160.52 217.98 160.52 217.98Z"/>
+</svg>
diff --git a/web/src/components/svg-icon.tsx b/web/src/components/svg-icon.tsx
index 6403a63bb6..1786c374e1 100644
--- a/web/src/components/svg-icon.tsx
+++ b/web/src/components/svg-icon.tsx
@@ -117,6 +117,7 @@ const svgIcons = [
LLMFactory.ApiRoute,
LLMFactory.MWS,
LLMFactory.CheaperInference,
+ LLMFactory.Opper,
];
export const LlmIcon = ({
diff --git a/web/src/constants/llm.ts b/web/src/constants/llm.ts
index f30a4ad894..80fbc0c3fd 100644
--- a/web/src/constants/llm.ts
+++ b/web/src/constants/llm.ts
@@ -110,6 +110,7 @@ export enum LLMFactory {
Synthorai = 'Synthorai',
ApiRoute = 'API-Route',
CheaperInference = 'Cheaper Inference',
+ Opper = 'Opper',
}
// Please lowercase the file name
@@ -203,6 +204,7 @@ export const IconMap = {
[LLMFactory.ApiRoute]: 'apiroute',
[LLMFactory.MWS]: 'mws',
[LLMFactory.CheaperInference]: 'cheaperinference',
+ [LLMFactory.Opper]: 'opper',
};
export const ModelTypeToField: Record<string, string> = {
@@ -231,6 +233,7 @@ export const APIMapUrl = {
[LLMFactory.ApiRoute]: 'https://www.api-route.com',
[LLMFactory.DaoXE]: 'https://daoxe.com',
[LLMFactory.CheaperInference]: 'https://cheaperinference.com',
+ [LLMFactory.Opper]: 'https://platform.opper.ai',
[LLMFactory.MWS]:
'https://mws.ru/docs/cloud-platform/gpt/general/inference-text.html',
[LLMFactory.Anthropic]: 'https://console.anthropic.com/settings/keys',