Skip to content

Commit 3c7fecc

Browse files
authored
Feat/support multi providers , OpenViking支持多providers (#192)
* support multi-provider * revise readme, fix bugs
1 parent 8af2b03 commit 3c7fecc

File tree

8 files changed

+721
-32
lines changed

8 files changed

+721
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,4 @@ benchmark_stress_db/
168168
examples/data/
169169
third_party/agfs/bin/
170170
openviking/_version.py
171+
specs/

README.md

Lines changed: 113 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,115 @@ OpenViking requires the following model capabilities:
8989
- **VLM Model**: For image and content understanding
9090
- **Embedding Model**: For vectorization and semantic retrieval
9191

92-
OpenViking supports various model services:
93-
- **OpenAI Models**: Supports GPT-4V and other VLM models, and OpenAI Embedding models.
94-
- **Volcengine (Doubao Models)**: Recommended for low cost and high performance, with free quotas for new users. For purchase and activation, please refer to: [Volcengine Purchase Guide](./docs/en/guides/02-volcengine-purchase-guide.md).
95-
- **Other Custom Model Services**: Supports model services compatible with the OpenAI API format.
92+
#### Supported VLM Providers
93+
94+
OpenViking supports multiple VLM providers:
95+
96+
| Provider | Model | Get API Key |
97+
|----------|-------|-------------|
98+
| `volcengine` | doubao | [Volcengine Console](https://console.volcengine.com/ark) |
99+
| `openai` | gpt | [OpenAI Platform](https://platform.openai.com) |
100+
| `anthropic` | claude | [Anthropic Console](https://console.anthropic.com) |
101+
| `deepseek` | deepseek | [DeepSeek Platform](https://platform.deepseek.com) |
102+
| `gemini` | gemini | [Google AI Studio](https://aistudio.google.com) |
103+
| `moonshot` | kimi | [Moonshot Platform](https://platform.moonshot.cn) |
104+
| `zhipu` | glm | [Zhipu Open Platform](https://open.bigmodel.cn) |
105+
| `dashscope` | qwen | [DashScope Console](https://dashscope.console.aliyun.com) |
106+
| `minimax` | minimax | [MiniMax Platform](https://platform.minimax.io) |
107+
| `openrouter` | (any model) | [OpenRouter](https://openrouter.ai) |
108+
| `vllm` | (local model) ||
109+
110+
> 💡 **Tip**: OpenViking uses a **Provider Registry** for unified model access. The system automatically detects the provider based on model name keywords, so you can switch between providers seamlessly.
111+
112+
#### Provider-Specific Notes
113+
114+
<details>
115+
<summary><b>Volcengine (Doubao)</b></summary>
116+
117+
Volcengine supports both model names and endpoint IDs. Using model names is recommended for simplicity:
118+
119+
```json
120+
{
121+
"vlm": {
122+
"provider": "volcengine",
123+
"model": "doubao-seed-1-6-240615",
124+
"api_key": "your-api-key"
125+
}
126+
}
127+
```
128+
129+
You can also use endpoint IDs (found in [Volcengine ARK Console](https://console.volcengine.com/ark)):
130+
131+
```json
132+
{
133+
"vlm": {
134+
"provider": "volcengine",
135+
"model": "ep-20241220174930-xxxxx",
136+
"api_key": "your-api-key"
137+
}
138+
}
139+
```
140+
141+
</details>
142+
143+
<details>
144+
<summary><b>Zhipu AI (智谱)</b></summary>
145+
146+
If you're on Zhipu's coding plan, use the coding API endpoint:
147+
148+
```json
149+
{
150+
"vlm": {
151+
"provider": "zhipu",
152+
"model": "glm-4-plus",
153+
"api_key": "your-api-key",
154+
"api_base": "https://open.bigmodel.cn/api/coding/paas/v4"
155+
}
156+
}
157+
```
158+
159+
</details>
160+
161+
<details>
162+
<summary><b>MiniMax (中国大陆)</b></summary>
163+
164+
For MiniMax's mainland China platform (minimaxi.com), specify the API base:
165+
166+
```json
167+
{
168+
"vlm": {
169+
"provider": "minimax",
170+
"model": "abab6.5s-chat",
171+
"api_key": "your-api-key",
172+
"api_base": "https://api.minimaxi.com/v1"
173+
}
174+
}
175+
```
176+
177+
</details>
178+
179+
<details>
180+
<summary><b>Local Models (vLLM)</b></summary>
181+
182+
Run OpenViking with your own local models using vLLM:
183+
184+
```bash
185+
# Start vLLM server
186+
vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
187+
```
188+
189+
```json
190+
{
191+
"vlm": {
192+
"provider": "vllm",
193+
"model": "meta-llama/Llama-3.1-8B-Instruct",
194+
"api_key": "dummy",
195+
"api_base": "http://localhost:8000/v1"
196+
}
197+
}
198+
```
199+
200+
</details>
96201

97202
### 3. Environment Configuration
98203

@@ -106,20 +211,22 @@ Create a configuration file `~/.openviking/ov.conf`:
106211
"dense": {
107212
"api_base" : "<api-endpoint>", // API endpoint address
108213
"api_key" : "<your-api-key>", // Model service API Key
109-
"provider" : "<provider-type>", // Provider type (volcengine or openai)
214+
"provider" : "<provider-type>", // Provider type: "volcengine" or "openai" (currently supported)
110215
"dimension": 1024, // Vector dimension
111216
"model" : "<model-name>" // Embedding model name (e.g., doubao-embedding-vision-250615 or text-embedding-3-large)
112217
}
113218
},
114219
"vlm": {
115220
"api_base" : "<api-endpoint>", // API endpoint address
116221
"api_key" : "<your-api-key>", // Model service API Key
117-
"provider" : "<provider-type>", // Provider type (volcengine or openai)
222+
"provider" : "<provider-type>", // Provider type (volcengine, openai, deepseek, anthropic, etc.)
118223
"model" : "<model-name>" // VLM model name (e.g., doubao-seed-1-8-251228 or gpt-4-vision-preview)
119224
}
120225
}
121226
```
122227

228+
> **Note**: For embedding models, currently only `volcengine` (Doubao) and `openai` providers are supported. For VLM models, we support multiple providers including volcengine, openai, deepseek, anthropic, gemini, moonshot, zhipu, dashscope, minimax, and more.
229+
123230
#### Configuration Examples
124231

125232
👇 Expand to see the configuration example for your model service:

openviking/models/vlm/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@
22
# SPDX-License-Identifier: Apache-2.0
33
"""VLM (Vision-Language Model) module"""
44

5+
from .backends.litellm_vlm import LiteLLMVLMProvider
56
from .backends.openai_vlm import OpenAIVLM
67
from .backends.volcengine_vlm import VolcEngineVLM
78
from .base import VLMBase, VLMFactory
9+
from .registry import (
10+
PROVIDERS,
11+
ProviderSpec,
12+
find_by_model,
13+
find_by_name,
14+
find_gateway,
15+
get_all_provider_names,
16+
)
817

918
__all__ = [
1019
"VLMBase",
1120
"VLMFactory",
1221
"OpenAIVLM",
1322
"VolcEngineVLM",
23+
"LiteLLMVLMProvider",
24+
"ProviderSpec",
25+
"PROVIDERS",
26+
"find_by_model",
27+
"find_by_name",
28+
"find_gateway",
29+
"get_all_provider_names",
1430
]

0 commit comments

Comments
 (0)