-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvendors.py
More file actions
124 lines (89 loc) · 3.39 KB
/
Copy pathvendors.py
File metadata and controls
124 lines (89 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""供应商专属配置模型."""
from __future__ import annotations
from pydantic import BaseModel, Field
class ZhipuConcurrencyConfig(BaseModel):
"""Zhipu 每模型并发限制配置."""
default: int = Field(default=3, ge=1, le=20, description="全局默认并行度")
models: dict[str, int] = Field(
default_factory=dict,
description="按映射后模型名自定义并行度(覆盖 default)",
)
def get_limit(self, model: str) -> int:
"""获取指定模型的并行度限制."""
return self.models.get(model, self.default)
class AnthropicConfig(BaseModel):
enabled: bool = True
base_url: str = "https://api.anthropic.com"
timeout_ms: int = 300000
class CopilotConfig(BaseModel):
"""GitHub Copilot 供应商配置."""
enabled: bool = False
github_token: str = ""
account_type: str = "individual"
token_url: str = "https://api.github.com/copilot_internal/v2/token"
base_url: str = ""
models_cache_ttl_seconds: int = 300
timeout_ms: int = 300000
class AntigravityConfig(BaseModel):
"""Google Antigravity Claude 供应商配置."""
enabled: bool = False
client_id: str = ""
client_secret: str = ""
refresh_token: str = ""
base_url: str = "https://generativelanguage.googleapis.com/v1beta"
model_endpoint: str = "models/claude-sonnet-4-20250514"
timeout_ms: int = 300000
safety_settings: dict[str, str] | None = None
project_id: str = "" # GCP Project ID(v1internal 协议必填)
class ZhipuConfig(BaseModel):
"""智谱 GLM 供应商配置(原生 Anthropic 兼容端点).
官方端点已完整支持 Anthropic Messages API 协议,
无需工具截断、thinking 剥离等适配逻辑.
"""
enabled: bool = True
base_url: str = "https://open.bigmodel.cn/api/anthropic"
api_key: str = ""
timeout_ms: int = 3000000
concurrency: ZhipuConcurrencyConfig = Field(default_factory=ZhipuConcurrencyConfig)
class MinimaxConfig(BaseModel):
"""MiniMax 供应商配置(原生 Anthropic 兼容端点)."""
enabled: bool = True
base_url: str = "https://api.minimaxi.com/anthropic"
api_key: str = ""
timeout_ms: int = 3000000
class KimiConfig(BaseModel):
"""Kimi 供应商配置(原生 Anthropic 兼容端点)."""
enabled: bool = True
base_url: str = "https://api.kimi.com/coding/"
api_key: str = ""
timeout_ms: int = 3000000
class DoubaoConfig(BaseModel):
"""豆包 Doubao 供应商配置(原生 Anthropic 兼容端点)."""
enabled: bool = True
base_url: str = "https://ark.cn-beijing.volces.com/api/coding"
api_key: str = ""
timeout_ms: int = 3000000
class XiaomiConfig(BaseModel):
"""小米 MiMo 供应商配置(原生 Anthropic 兼容端点)."""
enabled: bool = True
base_url: str = "https://token-plan-cn.xiaomimimo.com/anthropic"
api_key: str = ""
timeout_ms: int = 3000000
class AlibabaConfig(BaseModel):
"""阿里 Qwen 供应商配置(原生 Anthropic 兼容端点)."""
enabled: bool = True
base_url: str = "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic"
api_key: str = ""
timeout_ms: int = 3000000
__all__ = [
"AnthropicConfig",
"CopilotConfig",
"AntigravityConfig",
"ZhipuConfig",
"ZhipuConcurrencyConfig",
"MinimaxConfig",
"KimiConfig",
"DoubaoConfig",
"XiaomiConfig",
"AlibabaConfig",
]