coding-proxy 0.2.0a2__py3-none-any.whl → 0.2.1a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of coding-proxy might be problematic. Click here for more details.
- coding/proxy/cli/__init__.py +8 -1
- coding/proxy/config/config.default.yaml +21 -2
- coding/proxy/config/server.py +12 -0
- coding/proxy/config/vendors.py +1 -0
- coding/proxy/logging/__init__.py +142 -4
- coding/proxy/logging/formatters.py +49 -0
- coding/proxy/routing/quota_guard.py +9 -2
- coding/proxy/routing/usage_recorder.py +1 -1
- coding/proxy/server/app.py +2 -5
- coding/proxy/server/request_normalizer.py +2 -117
- coding/proxy/vendors/antigravity.py +83 -10
- {coding_proxy-0.2.0a2.dist-info → coding_proxy-0.2.1a2.dist-info}/METADATA +2 -2
- {coding_proxy-0.2.0a2.dist-info → coding_proxy-0.2.1a2.dist-info}/RECORD +16 -15
- {coding_proxy-0.2.0a2.dist-info → coding_proxy-0.2.1a2.dist-info}/WHEEL +0 -0
- {coding_proxy-0.2.0a2.dist-info → coding_proxy-0.2.1a2.dist-info}/entry_points.txt +0 -0
- {coding_proxy-0.2.0a2.dist-info → coding_proxy-0.2.1a2.dist-info}/licenses/LICENSE +0 -0
coding/proxy/cli/__init__.py
CHANGED
|
@@ -104,11 +104,18 @@ def start(
|
|
|
104
104
|
# 打印启动品牌横幅
|
|
105
105
|
print_banner(console, host=cfg.server.host, port=cfg.server.port)
|
|
106
106
|
|
|
107
|
+
# 解析文件日志路径:未显式配置时使用默认值
|
|
108
|
+
_file_path: str | None = cfg.logging.file or "coding-proxy.log"
|
|
107
109
|
uvicorn.run(
|
|
108
110
|
fastapi_app,
|
|
109
111
|
host=cfg.server.host,
|
|
110
112
|
port=cfg.server.port,
|
|
111
|
-
log_config=build_log_config(
|
|
113
|
+
log_config=build_log_config(
|
|
114
|
+
level=cfg.logging.level,
|
|
115
|
+
file_path=_file_path,
|
|
116
|
+
max_bytes=cfg.logging.max_bytes,
|
|
117
|
+
backup_count=cfg.logging.backup_count,
|
|
118
|
+
),
|
|
112
119
|
)
|
|
113
120
|
|
|
114
121
|
|
|
@@ -8,6 +8,9 @@ server:
|
|
|
8
8
|
|
|
9
9
|
logging:
|
|
10
10
|
level: "INFO"
|
|
11
|
+
# file: "coding-proxy.log" # 文件日志路径;设为 null 或空字符串禁用
|
|
12
|
+
# max_bytes: 5242880 # 单文件上限(5 MB),触发轮转
|
|
13
|
+
# backup_count: 5 # 保留 gzip 压缩备份文件数
|
|
11
14
|
|
|
12
15
|
# === 降级链路优先级(可选) ===
|
|
13
16
|
#
|
|
@@ -232,11 +235,15 @@ model_mapping:
|
|
|
232
235
|
# Google Antigravity 模型映射
|
|
233
236
|
- pattern: "claude-sonnet-.*"
|
|
234
237
|
vendors: ["antigravity"]
|
|
235
|
-
target: "
|
|
238
|
+
target: "Claude Sonnet 4.6"
|
|
236
239
|
is_regex: true
|
|
237
240
|
- pattern: "claude-opus-.*"
|
|
238
241
|
vendors: ["antigravity"]
|
|
239
|
-
target: "
|
|
242
|
+
target: "Claude Opus 4.6 Thinking"
|
|
243
|
+
is_regex: true
|
|
244
|
+
- pattern: "claude-haiku-.*"
|
|
245
|
+
vendors: ["antigravity"]
|
|
246
|
+
target: "Gemini 3 Flash"
|
|
240
247
|
is_regex: true
|
|
241
248
|
# 智谱 GLM 映射(官方原生 Anthropic 兼容端点)
|
|
242
249
|
# glm-5v-turbo 完整承载 Claude Code 满血能力(tool calling / thinking / 多模态)
|
|
@@ -349,6 +356,12 @@ pricing:
|
|
|
349
356
|
output_cost_per_mtok: $25.0
|
|
350
357
|
cache_write_cost_per_mtok: $6.25
|
|
351
358
|
cache_read_cost_per_mtok: $0.50
|
|
359
|
+
- vendor: copilot
|
|
360
|
+
model: Claude Opus 4.6
|
|
361
|
+
input_cost_per_mtok: $5.0
|
|
362
|
+
output_cost_per_mtok: $25.0
|
|
363
|
+
cache_write_cost_per_mtok: $6.25
|
|
364
|
+
cache_read_cost_per_mtok: $0.50
|
|
352
365
|
- vendor: copilot
|
|
353
366
|
model: Claude Sonnet 4.6
|
|
354
367
|
input_cost_per_mtok: $3.0
|
|
@@ -373,6 +386,12 @@ pricing:
|
|
|
373
386
|
output_cost_per_mtok: $5
|
|
374
387
|
cache_write_cost_per_mtok: $1.25
|
|
375
388
|
cache_read_cost_per_mtok: $0.10
|
|
389
|
+
- vendor: copilot
|
|
390
|
+
model: Claude Haiku 4.5
|
|
391
|
+
input_cost_per_mtok: $1
|
|
392
|
+
output_cost_per_mtok: $5
|
|
393
|
+
cache_write_cost_per_mtok: $1.25
|
|
394
|
+
cache_read_cost_per_mtok: $0.10
|
|
376
395
|
# ── Google Antigravity(参照 Anthropic 定价估算) ──
|
|
377
396
|
- vendor: antigravity
|
|
378
397
|
model: claude-opus-4-6-thinking
|
coding/proxy/config/server.py
CHANGED
|
@@ -17,8 +17,20 @@ class DatabaseConfig(BaseModel):
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class LoggingConfig(BaseModel):
|
|
20
|
+
"""日志配置.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
level: 控制台日志级别(INFO / WARNING / DEBUG 等)。
|
|
24
|
+
file: 文件日志路径。为 ``None`` 时使用默认值 ``coding-proxy.log``;
|
|
25
|
+
设为空字符串可禁用文件日志。
|
|
26
|
+
max_bytes: 单个日志文件最大字节数(触发轮转)。默认 5 MB。
|
|
27
|
+
backup_count: 保留的已压缩备份文件数。默认 5。
|
|
28
|
+
"""
|
|
29
|
+
|
|
20
30
|
level: str = "INFO"
|
|
21
31
|
file: str | None = None
|
|
32
|
+
max_bytes: int = 5 * 1024 * 1024
|
|
33
|
+
backup_count: int = 5
|
|
22
34
|
|
|
23
35
|
|
|
24
36
|
__all__ = ["ServerConfig", "DatabaseConfig", "LoggingConfig"]
|
coding/proxy/config/vendors.py
CHANGED
|
@@ -34,6 +34,7 @@ class AntigravityConfig(BaseModel):
|
|
|
34
34
|
model_endpoint: str = "models/claude-sonnet-4-20250514"
|
|
35
35
|
timeout_ms: int = 300000
|
|
36
36
|
safety_settings: dict[str, str] | None = None
|
|
37
|
+
project_id: str = "" # GCP Project ID(v1internal 协议必填)
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
class ZhipuConfig(BaseModel):
|
coding/proxy/logging/__init__.py
CHANGED
|
@@ -1,11 +1,92 @@
|
|
|
1
|
-
"""日志模块.
|
|
1
|
+
"""日志模块.
|
|
2
|
+
|
|
3
|
+
提供 uvicorn 兼容的 dictConfig 构建、JSON 结构化格式化器、
|
|
4
|
+
以及 gzip 压缩轮转支持。
|
|
5
|
+
"""
|
|
2
6
|
|
|
3
7
|
from __future__ import annotations
|
|
4
8
|
|
|
9
|
+
import gzip
|
|
10
|
+
import logging
|
|
11
|
+
import logging.handlers
|
|
12
|
+
import os
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from .formatters import JsonFormatter
|
|
16
|
+
|
|
17
|
+
# ── 常量 ────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
_DEFAULT_MAX_BYTES = 5 * 1024 * 1024 # 5 MB per file
|
|
20
|
+
_DEFAULT_BACKUP_COUNT = 5 # Keep 5 rotated backups
|
|
21
|
+
_FILE_LOG_LEVEL = "DEBUG" # File logs capture everything
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _gzip_namer(default_name: str) -> str:
|
|
25
|
+
"""RotatingFileHandler namer: 为轮转文件添加 .gz 后缀."""
|
|
26
|
+
return default_name + ".gz"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _gzip_rotator(source: str, dest: str) -> None:
|
|
30
|
+
"""RotatingFileHandler rotator: 将源文件 gzip 压缩后写入目标.
|
|
31
|
+
|
|
32
|
+
流程:
|
|
33
|
+
1. 读取 source 文件全部内容
|
|
34
|
+
2. gzip 压缩写入 dest 文件
|
|
35
|
+
3. 删除 source 原文件
|
|
36
|
+
"""
|
|
37
|
+
with open(source, "rb") as f_in:
|
|
38
|
+
data = f_in.read()
|
|
39
|
+
with open(dest, "wb") as f_out:
|
|
40
|
+
f_out.write(gzip.compress(data, compresslevel=6))
|
|
41
|
+
os.remove(source)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _create_rotating_file_handler(
|
|
45
|
+
*,
|
|
46
|
+
filename: str,
|
|
47
|
+
maxBytes: int = _DEFAULT_MAX_BYTES,
|
|
48
|
+
backupCount: int = _DEFAULT_BACKUP_COUNT,
|
|
49
|
+
encoding: str = "utf-8",
|
|
50
|
+
) -> logging.handlers.RotatingFileHandler:
|
|
51
|
+
"""创建带 gzip 压缩轮转的 RotatingFileHandler(dictConfig 兼容工厂函数).
|
|
52
|
+
|
|
53
|
+
``logging.config.dictConfig`` 仅支持通过构造函数 kwargs 配置 handler,
|
|
54
|
+
而 ``namer`` / ``rotator`` 是实例属性而非构造参数,因此需要通过工厂函数注入。
|
|
55
|
+
"""
|
|
56
|
+
handler = logging.handlers.RotatingFileHandler(
|
|
57
|
+
filename=filename,
|
|
58
|
+
maxBytes=maxBytes,
|
|
59
|
+
backupCount=backupCount,
|
|
60
|
+
encoding=encoding,
|
|
61
|
+
)
|
|
62
|
+
handler.namer = _gzip_namer
|
|
63
|
+
handler.rotator = _gzip_rotator
|
|
64
|
+
return handler
|
|
65
|
+
|
|
5
66
|
|
|
6
|
-
def build_log_config(
|
|
7
|
-
|
|
8
|
-
|
|
67
|
+
def build_log_config(
|
|
68
|
+
level: str = "INFO",
|
|
69
|
+
file_path: str | None = None,
|
|
70
|
+
max_bytes: int = _DEFAULT_MAX_BYTES,
|
|
71
|
+
backup_count: int = _DEFAULT_BACKUP_COUNT,
|
|
72
|
+
) -> dict:
|
|
73
|
+
"""构建 uvicorn log_config,支持双写(控制台 + 文件).
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
level: 控制台日志级别(默认 INFO)。
|
|
77
|
+
file_path: 文件日志路径。为 ``None`` 时仅输出到控制台(向后兼容)。
|
|
78
|
+
max_bytes: 单个日志文件最大字节数(默认 5 MB)。
|
|
79
|
+
backup_count: 保留的轮转备份文件数(默认 5)。
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
符合 ``logging.config.dictConfig`` 规范的字典。
|
|
83
|
+
|
|
84
|
+
双写行为:
|
|
85
|
+
- 控制台:人类可读格式,级别由 ``level`` 参数控制(handler 级别过滤)
|
|
86
|
+
- 文件:JSON 结构化格式,固定 DEBUG 级别(捕获所有日志)
|
|
87
|
+
- 当 ``file_path`` 为 ``None`` 或空字符串时,退化为纯控制台模式(向后兼容)
|
|
88
|
+
"""
|
|
89
|
+
config: dict = {
|
|
9
90
|
"version": 1,
|
|
10
91
|
"disable_existing_loggers": False,
|
|
11
92
|
"formatters": {
|
|
@@ -26,11 +107,13 @@ def build_log_config(level: str = "INFO") -> dict:
|
|
|
26
107
|
"formatter": "default",
|
|
27
108
|
"class": "logging.StreamHandler",
|
|
28
109
|
"stream": "ext://sys.stderr",
|
|
110
|
+
"level": level,
|
|
29
111
|
},
|
|
30
112
|
"access": {
|
|
31
113
|
"formatter": "access",
|
|
32
114
|
"class": "logging.StreamHandler",
|
|
33
115
|
"stream": "ext://sys.stdout",
|
|
116
|
+
"level": "INFO",
|
|
34
117
|
},
|
|
35
118
|
},
|
|
36
119
|
"loggers": {
|
|
@@ -48,3 +131,58 @@ def build_log_config(level: str = "INFO") -> dict:
|
|
|
48
131
|
},
|
|
49
132
|
},
|
|
50
133
|
}
|
|
134
|
+
|
|
135
|
+
# ── 条件注入:文件日志基础设施 ────────────────────────────
|
|
136
|
+
if file_path:
|
|
137
|
+
# 确保日志目录存在
|
|
138
|
+
log_file = Path(file_path)
|
|
139
|
+
log_file.parent.mkdir(parents=True, exist_ok=True)
|
|
140
|
+
|
|
141
|
+
# 注入 JSON formatter
|
|
142
|
+
config["formatters"]["json"] = {
|
|
143
|
+
"()": "coding.proxy.logging.formatters.JsonFormatter",
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# 注入 RotatingFileHandler(gzip 压缩轮转)
|
|
147
|
+
# 使用工厂函数(而非 class + namer/rotator kwargs),
|
|
148
|
+
# 因为 dictConfig 不支持将 namer/rotator 作为构造参数传递
|
|
149
|
+
config["handlers"]["file"] = {
|
|
150
|
+
"formatter": "json",
|
|
151
|
+
"()": "coding.proxy.logging._create_rotating_file_handler",
|
|
152
|
+
"filename": str(log_file.resolve()),
|
|
153
|
+
"maxBytes": max_bytes,
|
|
154
|
+
"backupCount": backup_count,
|
|
155
|
+
"encoding": "utf-8",
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
# 为每个 logger 添加 file handler
|
|
159
|
+
# 注意:uvicorn.error 无 handlers 键(通过 propagate 继承 uvicorn 的 handler)
|
|
160
|
+
for logger_name in (
|
|
161
|
+
"uvicorn",
|
|
162
|
+
"uvicorn.error",
|
|
163
|
+
"uvicorn.access",
|
|
164
|
+
"coding.proxy",
|
|
165
|
+
):
|
|
166
|
+
logger_cfg = config["loggers"][logger_name]
|
|
167
|
+
handlers = logger_cfg.get("handlers", [])
|
|
168
|
+
if isinstance(handlers, list):
|
|
169
|
+
handlers.append("file")
|
|
170
|
+
logger_cfg["handlers"] = handlers
|
|
171
|
+
else:
|
|
172
|
+
logger_cfg["handlers"] = [handlers, "file"]
|
|
173
|
+
|
|
174
|
+
# Logger 级别设为 DEBUG(让所有消息通过到 file handler)
|
|
175
|
+
# Console handler 已设 level 过滤,确保控制台仅输出 INFO+
|
|
176
|
+
config["loggers"]["coding.proxy"]["level"] = _FILE_LOG_LEVEL
|
|
177
|
+
config["loggers"]["uvicorn"]["level"] = _FILE_LOG_LEVEL
|
|
178
|
+
config["loggers"]["uvicorn.error"]["level"] = _FILE_LOG_LEVEL
|
|
179
|
+
|
|
180
|
+
return config
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
__all__ = [
|
|
184
|
+
"build_log_config",
|
|
185
|
+
"JsonFormatter",
|
|
186
|
+
"_gzip_namer",
|
|
187
|
+
"_gzip_rotator",
|
|
188
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""结构化日志格式化器(JSON 输出).
|
|
2
|
+
|
|
3
|
+
为文件日志提供机器可读的 JSON 格式输出,
|
|
4
|
+
与控制台的人类可读格式形成正交双写。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import logging
|
|
11
|
+
from datetime import UTC, datetime
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class JsonFormatter(logging.Formatter):
|
|
15
|
+
"""将 LogRecord 格式化为单行 JSON 字符串.
|
|
16
|
+
|
|
17
|
+
输出字段:
|
|
18
|
+
- ``timestamp``: ISO 8601 UTC 时间戳
|
|
19
|
+
- ``level``: 日志级别名称(DEBUG/INFO/WARNING/ERROR)
|
|
20
|
+
- ``logger``: logger 名称(如 ``coding.proxy.routing.executor``)
|
|
21
|
+
- ``message``: 格式化后的日志消息
|
|
22
|
+
- ``exception``: 异常堆栈(仅当存在时)
|
|
23
|
+
|
|
24
|
+
设计要点:
|
|
25
|
+
- 使用 ``ensure_ascii=False`` 支持中文日志内容
|
|
26
|
+
- 异常信息(exc_info)序列化为 ``exception`` 字段
|
|
27
|
+
- 时间戳统一使用 UTC ISO 格式,便于跨时区聚合分析
|
|
28
|
+
- ``sort_keys=True`` 保证输出确定性,便于日志聚合工具处理
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def format(self, record: logging.LogRecord) -> str:
|
|
32
|
+
"""将 LogRecord 序列化为 JSON 行."""
|
|
33
|
+
message = record.getMessage()
|
|
34
|
+
|
|
35
|
+
exception: str | None = None
|
|
36
|
+
if record.exc_info and record.exc_info[0] is not None:
|
|
37
|
+
exception = self.formatException(record.exc_info)
|
|
38
|
+
|
|
39
|
+
log_entry: dict[str, object] = {
|
|
40
|
+
"timestamp": datetime.fromtimestamp(record.created, tz=UTC).isoformat(),
|
|
41
|
+
"level": record.levelname,
|
|
42
|
+
"logger": record.name,
|
|
43
|
+
"message": message,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if exception:
|
|
47
|
+
log_entry["exception"] = exception
|
|
48
|
+
|
|
49
|
+
return json.dumps(log_entry, ensure_ascii=False, sort_keys=True)
|
|
@@ -129,7 +129,7 @@ class QuotaGuard:
|
|
|
129
129
|
int(self._effective_probe_interval),
|
|
130
130
|
)
|
|
131
131
|
|
|
132
|
-
def load_baseline(self, total_tokens: int) -> None:
|
|
132
|
+
def load_baseline(self, total_tokens: int, vendor: str | None = None) -> None:
|
|
133
133
|
"""从数据库加载窗口历史用量基线."""
|
|
134
134
|
if not self._enabled or total_tokens <= 0:
|
|
135
135
|
return
|
|
@@ -137,7 +137,14 @@ class QuotaGuard:
|
|
|
137
137
|
midpoint = time.monotonic() - self._window / 2
|
|
138
138
|
self._entries.append((midpoint, total_tokens))
|
|
139
139
|
self._total += total_tokens
|
|
140
|
-
|
|
140
|
+
if vendor:
|
|
141
|
+
logger.info(
|
|
142
|
+
"Quota guard [%s]: loaded baseline %d tokens",
|
|
143
|
+
vendor,
|
|
144
|
+
total_tokens,
|
|
145
|
+
)
|
|
146
|
+
else:
|
|
147
|
+
logger.info("Quota guard: loaded baseline %d tokens", total_tokens)
|
|
141
148
|
|
|
142
149
|
def reset(self) -> None:
|
|
143
150
|
"""手动重置为 WITHIN_QUOTA 状态."""
|
|
@@ -66,7 +66,7 @@ class UsageRecorder:
|
|
|
66
66
|
)
|
|
67
67
|
if cost_value is not None:
|
|
68
68
|
cost_str = cost_value.format()
|
|
69
|
-
logger.
|
|
69
|
+
logger.debug(
|
|
70
70
|
"ModelCall: vendor=%s model_requested=%s model_served=%s "
|
|
71
71
|
"duration=%dms tokens=[in:%d out:%d cache_create:%d cache_read:%d] cost=%s",
|
|
72
72
|
vendor,
|
coding/proxy/server/app.py
CHANGED
|
@@ -60,17 +60,14 @@ async def lifespan(app: FastAPI):
|
|
|
60
60
|
tier.quota_guard.window_hours,
|
|
61
61
|
vendor=tier.name,
|
|
62
62
|
)
|
|
63
|
-
tier.quota_guard.load_baseline(total)
|
|
63
|
+
tier.quota_guard.load_baseline(total, vendor=tier.name)
|
|
64
64
|
if tier.weekly_quota_guard and tier.weekly_quota_guard.enabled:
|
|
65
65
|
total = await token_logger.query_window_total(
|
|
66
66
|
tier.weekly_quota_guard.window_hours,
|
|
67
67
|
vendor=tier.name,
|
|
68
68
|
)
|
|
69
|
-
tier.weekly_quota_guard.load_baseline(total)
|
|
69
|
+
tier.weekly_quota_guard.load_baseline(total, vendor=tier.name)
|
|
70
70
|
|
|
71
|
-
logger.info(
|
|
72
|
-
"coding-proxy started: host=%s port=%d", config.server.host, config.server.port
|
|
73
|
-
)
|
|
74
71
|
yield
|
|
75
72
|
await router.close()
|
|
76
73
|
await compat_session_store.close()
|
|
@@ -42,10 +42,9 @@ def normalize_anthropic_request(body: dict[str, Any]) -> NormalizationResult:
|
|
|
42
42
|
处理策略:
|
|
43
43
|
1. 移除供应商私有块(如 server_tool_use_delta)
|
|
44
44
|
2. 重写无效/非标准的 tool_use / tool_result ID
|
|
45
|
-
3.
|
|
45
|
+
3. **剥离错位的 tool_result 块**:Anthropic API 要求 ``tool_result`` 只能出现在
|
|
46
46
|
``user`` 消息中。当检测到非 user 消息中存在 ``tool_result`` 时,
|
|
47
|
-
|
|
48
|
-
防止上游返回 ``400 invalid_request_error`` 导致全链路降级失败。
|
|
47
|
+
直接剥离以防止上游返回 ``400 invalid_request_error`` 导致全链路降级失败。
|
|
49
48
|
"""
|
|
50
49
|
normalized = copy.deepcopy(body)
|
|
51
50
|
adaptations: list[str] = []
|
|
@@ -182,15 +181,6 @@ def normalize_anthropic_request(body: dict[str, Any]) -> NormalizationResult:
|
|
|
182
181
|
if stripped_misplaced:
|
|
183
182
|
_emit_misplaced_tool_result_summary(stripped_misplaced)
|
|
184
183
|
|
|
185
|
-
# ── 后处理:迁移错位的 tool_result 块 ──────────────────────
|
|
186
|
-
# Anthropic API 强制要求 tool_result 仅存在于 user 消息中。
|
|
187
|
-
# 多 vendor 场景下(尤其是降级恢复后的对话历史),可能出现
|
|
188
|
-
# tool_result 残留在 assistant / system 等非 user 消息中的情况,
|
|
189
|
-
# 导致 Anthropic 返回 400 invalid_request_error 并触发全链路降级。
|
|
190
|
-
relocated = _relocate_misplaced_tool_results(normalized, adaptations)
|
|
191
|
-
if relocated > 0:
|
|
192
|
-
adaptations.append(f"tool_result_relocated_from_non_user_messages({relocated})")
|
|
193
|
-
|
|
194
184
|
return NormalizationResult(
|
|
195
185
|
body=normalized,
|
|
196
186
|
adaptations=sorted(set(adaptations)),
|
|
@@ -258,108 +248,3 @@ def _emit_misplaced_tool_result_summary(
|
|
|
258
248
|
known_count,
|
|
259
249
|
", ".join(sorted(known_id_set)),
|
|
260
250
|
)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def _relocate_misplaced_tool_results(
|
|
264
|
-
body: dict[str, Any],
|
|
265
|
-
adaptations: list[str],
|
|
266
|
-
) -> int:
|
|
267
|
-
"""检测并将非 user 消息中的 tool_result 块迁移到合法位置.
|
|
268
|
-
|
|
269
|
-
策略:
|
|
270
|
-
1. 扫描所有消息,识别非 user 消息中的 tool_result 块
|
|
271
|
-
2. 将这些块从原消息中移除
|
|
272
|
-
3. 将它们挂载到最近的前置 user 消息末尾(或创建新 user 消息)
|
|
273
|
-
|
|
274
|
-
Returns:
|
|
275
|
-
被迁移的 tool_result 块数量。
|
|
276
|
-
"""
|
|
277
|
-
messages = body.get("messages", [])
|
|
278
|
-
if not messages:
|
|
279
|
-
return 0
|
|
280
|
-
|
|
281
|
-
displaced_results: list[tuple[int, dict[str, Any]]] = [] # (msg_idx, block)
|
|
282
|
-
|
|
283
|
-
for msg_idx, message in enumerate(messages):
|
|
284
|
-
if not isinstance(message, dict):
|
|
285
|
-
continue
|
|
286
|
-
role = message.get("role")
|
|
287
|
-
if role == "user":
|
|
288
|
-
continue
|
|
289
|
-
content = message.get("content")
|
|
290
|
-
if not isinstance(content, list):
|
|
291
|
-
continue
|
|
292
|
-
|
|
293
|
-
cleaned_content: list[Any] = []
|
|
294
|
-
for block in content:
|
|
295
|
-
if (
|
|
296
|
-
isinstance(block, dict)
|
|
297
|
-
and block.get("type") == "tool_result"
|
|
298
|
-
and block.get("tool_use_id")
|
|
299
|
-
):
|
|
300
|
-
displaced_results.append((msg_idx, dict(block)))
|
|
301
|
-
logger.debug(
|
|
302
|
-
"发现错位 tool_result: messages[%d], tool_use_id=%s, "
|
|
303
|
-
"将迁移至最近的 user 消息",
|
|
304
|
-
msg_idx,
|
|
305
|
-
block.get("tool_use_id", ""),
|
|
306
|
-
)
|
|
307
|
-
else:
|
|
308
|
-
cleaned_content.append(block)
|
|
309
|
-
message["content"] = cleaned_content
|
|
310
|
-
|
|
311
|
-
if not displaced_results:
|
|
312
|
-
return 0
|
|
313
|
-
|
|
314
|
-
# 查找或创建目标 user 消息:优先选择离错位块最近的前置 user 消息
|
|
315
|
-
first_displaced_idx = displaced_results[0][0]
|
|
316
|
-
target_msg_idx = _find_nearest_user_message(messages, first_displaced_idx)
|
|
317
|
-
|
|
318
|
-
if target_msg_idx is None:
|
|
319
|
-
# 无前置 user 消息:在消息列表头部插入一个新的 user 消息
|
|
320
|
-
messages.insert(
|
|
321
|
-
0,
|
|
322
|
-
{
|
|
323
|
-
"role": "user",
|
|
324
|
-
"content": [block for _, block in displaced_results],
|
|
325
|
-
},
|
|
326
|
-
)
|
|
327
|
-
logger.info(
|
|
328
|
-
"已创建新 user 消息(索引 0)以容纳 %d 个错位 tool_result 块",
|
|
329
|
-
len(displaced_results),
|
|
330
|
-
)
|
|
331
|
-
else:
|
|
332
|
-
target_msg = messages[target_msg_idx]
|
|
333
|
-
target_content = target_msg.get("content")
|
|
334
|
-
if not isinstance(target_content, list):
|
|
335
|
-
target_content = []
|
|
336
|
-
target_msg["content"] = target_content
|
|
337
|
-
for _, block in displaced_results:
|
|
338
|
-
target_content.append(block)
|
|
339
|
-
logger.info(
|
|
340
|
-
"已将 %d 个错位 tool_result 块迁移至 messages[%d] (role=user)",
|
|
341
|
-
len(displaced_results),
|
|
342
|
-
target_msg_idx,
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
return len(displaced_results)
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
def _find_nearest_user_message(
|
|
349
|
-
messages: list[dict[str, Any]],
|
|
350
|
-
from_index: int,
|
|
351
|
-
) -> int | None:
|
|
352
|
-
"""查找离指定索引最近的前置 user 消息.
|
|
353
|
-
|
|
354
|
-
Args:
|
|
355
|
-
messages: 消息列表
|
|
356
|
-
from_index: 起始搜索位置(不包含此位置)
|
|
357
|
-
|
|
358
|
-
Returns:
|
|
359
|
-
最近的前置 user 消息索引,若无则返回 None。
|
|
360
|
-
"""
|
|
361
|
-
for idx in range(from_index - 1, -1, -1):
|
|
362
|
-
msg = messages[idx]
|
|
363
|
-
if isinstance(msg, dict) and msg.get("role") == "user":
|
|
364
|
-
return idx
|
|
365
|
-
return None
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
"""Google Antigravity Claude 供应商 — OAuth2 认证 + Gemini 格式转换."""
|
|
1
|
+
"""Google Antigravity Claude 供应商 — OAuth2 认证 + Gemini/v1internal 格式转换."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import logging
|
|
7
|
+
import uuid
|
|
7
8
|
from collections.abc import AsyncIterator
|
|
8
9
|
from typing import Any
|
|
9
10
|
|
|
@@ -31,6 +32,12 @@ from .token_manager import BaseTokenManager, TokenAcquireError, TokenErrorKind
|
|
|
31
32
|
|
|
32
33
|
logger = logging.getLogger(__name__)
|
|
33
34
|
|
|
35
|
+
# v1internal 客户端指纹常量(与 Antigravity-Manager 对齐)
|
|
36
|
+
_V1INTERNAL_USER_AGENT = (
|
|
37
|
+
"Antigravity/4.1.31 (Macintosh; Intel Mac OS X 10_15_7) "
|
|
38
|
+
"Chrome/132.0.6834.160 Electron/39.2.3"
|
|
39
|
+
)
|
|
40
|
+
|
|
34
41
|
|
|
35
42
|
# ── Google OAuth2 Token 管理器(原 antigravity_token_manager.py) ──
|
|
36
43
|
|
|
@@ -97,10 +104,10 @@ class GoogleOAuthTokenManager(BaseTokenManager):
|
|
|
97
104
|
from ..auth.providers.google import GoogleOAuthProvider
|
|
98
105
|
|
|
99
106
|
if not GoogleOAuthProvider.has_required_scopes(scope):
|
|
100
|
-
|
|
101
|
-
"Google access_token
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
logger.warning(
|
|
108
|
+
"Google access_token scope 不完整(%s),"
|
|
109
|
+
"可能影响 Generative Language API 调用",
|
|
110
|
+
scope,
|
|
104
111
|
)
|
|
105
112
|
expires_in = data.get("expires_in", 3600)
|
|
106
113
|
logger.info("Google OAuth token refreshed, expires_in=%ds", expires_in)
|
|
@@ -137,10 +144,18 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
137
144
|
self._default_model = config.model_endpoint.removeprefix("models/")
|
|
138
145
|
self._last_request_adaptations: list[str] = []
|
|
139
146
|
self._safety_settings = config.safety_settings
|
|
147
|
+
# v1internal 协议字段
|
|
148
|
+
self._project_id: str = config.project_id
|
|
149
|
+
self._session_id: str = uuid.uuid4().hex[:16]
|
|
150
|
+
self._message_count: int = 0
|
|
140
151
|
|
|
141
152
|
def get_name(self) -> str:
|
|
142
153
|
return "antigravity"
|
|
143
154
|
|
|
155
|
+
def _is_v1internal_mode(self) -> bool:
|
|
156
|
+
"""检测是否启用 v1internal 协议模式(与 Antigravity-Manager 对齐)."""
|
|
157
|
+
return bool(self._project_id) and "v1internal" in self._base_url
|
|
158
|
+
|
|
144
159
|
def get_capabilities(self) -> VendorCapabilities:
|
|
145
160
|
return VendorCapabilities(
|
|
146
161
|
supports_tools=True,
|
|
@@ -199,7 +214,12 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
199
214
|
request_body: dict[str, Any],
|
|
200
215
|
headers: dict[str, str],
|
|
201
216
|
) -> tuple[dict[str, Any], dict[str, str]]:
|
|
202
|
-
"""转换 Anthropic
|
|
217
|
+
"""转换 Anthropic 请求并注入 Google OAuth token.
|
|
218
|
+
|
|
219
|
+
支持两种协议模式:
|
|
220
|
+
- 标准 Gemini 模式:直接发送 Gemini 请求体到 generativelanguage.googleapis.com
|
|
221
|
+
- v1internal 模式:将请求体包裹在 v1internal 信封中发送到 cloudcode-pa.googleapis.com
|
|
222
|
+
"""
|
|
203
223
|
resolved_model = self.map_model(request_body.get("model", "unknown"))
|
|
204
224
|
converted = convert_request(
|
|
205
225
|
request_body,
|
|
@@ -209,6 +229,10 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
209
229
|
gemini_body = converted.body
|
|
210
230
|
self._last_request_adaptations = converted.adaptations
|
|
211
231
|
token = await self._token_manager.get_token()
|
|
232
|
+
|
|
233
|
+
if self._is_v1internal_mode():
|
|
234
|
+
return self._prepare_v1internal_request(gemini_body, resolved_model, token)
|
|
235
|
+
|
|
212
236
|
new_headers = {
|
|
213
237
|
"content-type": "application/json",
|
|
214
238
|
"authorization": f"Bearer {token}",
|
|
@@ -222,10 +246,51 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
222
246
|
)
|
|
223
247
|
return gemini_body, new_headers
|
|
224
248
|
|
|
249
|
+
def _prepare_v1internal_request(
|
|
250
|
+
self,
|
|
251
|
+
gemini_body: dict[str, Any],
|
|
252
|
+
resolved_model: str,
|
|
253
|
+
token: str,
|
|
254
|
+
) -> tuple[dict[str, Any], dict[str, str]]:
|
|
255
|
+
"""将 Gemini 请求体包裹在 v1internal 信封中(与 Antigravity-Manager 对齐).
|
|
256
|
+
|
|
257
|
+
v1internal 是 Google Cloud Code 内部 API 协议,接受与标准 GLA 相同的 OAuth 凭证,
|
|
258
|
+
但需要特定的信封格式和客户端指纹 Headers。
|
|
259
|
+
"""
|
|
260
|
+
self._message_count += 1
|
|
261
|
+
envelope = {
|
|
262
|
+
"project": self._project_id,
|
|
263
|
+
"requestId": f"agent/antigravity/{self._session_id}/{self._message_count}",
|
|
264
|
+
"request": gemini_body,
|
|
265
|
+
"model": resolved_model,
|
|
266
|
+
"userAgent": "antigravity",
|
|
267
|
+
"requestType": "agent",
|
|
268
|
+
}
|
|
269
|
+
new_headers = {
|
|
270
|
+
"content-type": "application/json",
|
|
271
|
+
"authorization": f"Bearer {token}",
|
|
272
|
+
"user-agent": _V1INTERNAL_USER_AGENT,
|
|
273
|
+
"x-client-name": "antigravity",
|
|
274
|
+
"x-client-version": "4.1.31",
|
|
275
|
+
}
|
|
276
|
+
logger.debug(
|
|
277
|
+
"_prepare_v1internal_request: model=%s -> %s, project=%s, requestId=%s",
|
|
278
|
+
resolved_model,
|
|
279
|
+
resolved_model,
|
|
280
|
+
self._project_id,
|
|
281
|
+
envelope["requestId"],
|
|
282
|
+
)
|
|
283
|
+
return envelope, new_headers
|
|
284
|
+
|
|
225
285
|
def _mark_scope_error_if_needed(self, error_text: str) -> None:
|
|
226
286
|
lowered = error_text.lower()
|
|
227
287
|
if "access_token_scope_insufficient" not in lowered:
|
|
228
288
|
return
|
|
289
|
+
logger.error(
|
|
290
|
+
"Generative Language API 拒绝访问(ACCESS_TOKEN_SCOPE_INSUFFICIENT)。"
|
|
291
|
+
"如使用标准 GLA 端点,请确认凭证已授权正确的 scope;"
|
|
292
|
+
"建议切换至 v1internal 协议(配置 project_id)以获得更好的兼容性。"
|
|
293
|
+
)
|
|
229
294
|
self._token_manager.mark_error(
|
|
230
295
|
"Google access_token scope 不足,当前凭证不能调用 Generative Language API",
|
|
231
296
|
kind=TokenErrorKind.INSUFFICIENT_SCOPE,
|
|
@@ -250,11 +315,15 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
250
315
|
request_body: dict[str, Any],
|
|
251
316
|
headers: dict[str, str],
|
|
252
317
|
) -> VendorResponse:
|
|
253
|
-
"""覆写: Gemini 端点 + 响应逆转换."""
|
|
318
|
+
"""覆写: Gemini / v1internal 端点 + 响应逆转换."""
|
|
254
319
|
body, prepared_headers = await self._prepare_request(request_body, headers)
|
|
255
320
|
client = self._get_client()
|
|
256
321
|
resolved_model = self._last_resolved_model
|
|
257
|
-
endpoint =
|
|
322
|
+
endpoint = (
|
|
323
|
+
":generateContent"
|
|
324
|
+
if self._is_v1internal_mode()
|
|
325
|
+
else f"/models/{resolved_model}:generateContent"
|
|
326
|
+
)
|
|
258
327
|
|
|
259
328
|
logger.debug("send_message: POST %s", endpoint)
|
|
260
329
|
response = await client.post(endpoint, json=body, headers=prepared_headers)
|
|
@@ -292,11 +361,15 @@ class AntigravityVendor(TokenBackendMixin, BaseVendor):
|
|
|
292
361
|
request_body: dict[str, Any],
|
|
293
362
|
headers: dict[str, str],
|
|
294
363
|
) -> AsyncIterator[bytes]:
|
|
295
|
-
"""覆写: Gemini SSE 流 -> Anthropic SSE 流适配."""
|
|
364
|
+
"""覆写: Gemini / v1internal SSE 流 -> Anthropic SSE 流适配."""
|
|
296
365
|
body, prepared_headers = await self._prepare_request(request_body, headers)
|
|
297
366
|
client = self._get_client()
|
|
298
367
|
resolved_model = self._last_resolved_model
|
|
299
|
-
endpoint =
|
|
368
|
+
endpoint = (
|
|
369
|
+
":streamGenerateContent?alt=sse"
|
|
370
|
+
if self._is_v1internal_mode()
|
|
371
|
+
else f"/models/{resolved_model}:streamGenerateContent?alt=sse"
|
|
372
|
+
)
|
|
300
373
|
|
|
301
374
|
logger.debug("send_message_stream: POST %s", endpoint)
|
|
302
375
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM
|
|
3
|
+
Version: 0.2.1a2
|
|
4
|
+
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM, MiniMax, Qwen, Xiaomi, Kimi, Doubao...
|
|
5
5
|
Project-URL: Source Code, https://github.com/ThreeFish-AI/coding-proxy
|
|
6
6
|
Project-URL: User Guide, https://github.com/ThreeFish-AI/coding-proxy/blob/master/docs/user-guide.md
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/ThreeFish-AI/coding-proxy/issues
|
|
@@ -9,7 +9,7 @@ coding/proxy/auth/providers/__init__.py,sha256=hnGL_aSHcMxiZHK6HKPWD0_tWSPcwuxwQ
|
|
|
9
9
|
coding/proxy/auth/providers/base.py,sha256=TOtCi2b81-UBdEoWMv7HbYSmRxAjGSvnF1yBxazqai0,1092
|
|
10
10
|
coding/proxy/auth/providers/github.py,sha256=xH6yygAzt8vI-MXV8EHl2tg4RcOmLaLBns93PBCyVG8,4835
|
|
11
11
|
coding/proxy/auth/providers/google.py,sha256=MhbM5PXmgwQBgWCMDkhK_7GYyvS-IdPV4ATxKYH6WXM,8402
|
|
12
|
-
coding/proxy/cli/__init__.py,sha256=
|
|
12
|
+
coding/proxy/cli/__init__.py,sha256=glGVFdTj8fMLYSSWNtFGU4u9D2AoYBTLNgaSkjyQEnM,7911
|
|
13
13
|
coding/proxy/cli/auth_commands.py,sha256=tN5jWJo8sJP8jgoN4WH5iTl9rhi4xWPLMptgeTHIFpE,9212
|
|
14
14
|
coding/proxy/cli/banner.py,sha256=gat7QGpfocL0wiAw3-MSUsCviyc59Sf-XswOp7Pg6LI,1694
|
|
15
15
|
coding/proxy/compat/__init__.py,sha256=-msRszArsk2YJJtOeaidYDd1tAQEzeE91LvCi1CyMis,721
|
|
@@ -17,21 +17,22 @@ coding/proxy/compat/canonical.py,sha256=-zcuEwZ402xeH3C545RmuYRkT2HDuvFloyFydDv8
|
|
|
17
17
|
coding/proxy/compat/session_store.py,sha256=B9IFjjQJnHMg1244m__jG9gnqGWi26-JyEtwopEri6Q,5244
|
|
18
18
|
coding/proxy/config/__init__.py,sha256=hzgU5noJGecjj13UY38cC_p6jpWO3GO7okSW-A2XkJ0,127
|
|
19
19
|
coding/proxy/config/auth_schema.py,sha256=LYrJQU_fgW-6AoQdjXt4-MgPJjXjv9HrghlCcZwotnA,696
|
|
20
|
-
coding/proxy/config/config.default.yaml,sha256=
|
|
20
|
+
coding/proxy/config/config.default.yaml,sha256=UjtM6b4FNAJvilCm2fgjNvN5hPfDHt0EYKLlvL_0UDU,16404
|
|
21
21
|
coding/proxy/config/loader.py,sha256=1J_RBJgjuC8RwB2mwewLMS7vy9WEhUqttZG2igeDm-w,8984
|
|
22
22
|
coding/proxy/config/resiliency.py,sha256=GnzY-LoyfFqXFM1l6xEru418v-cKlv97-HM0noGPdks,1308
|
|
23
23
|
coding/proxy/config/routing.py,sha256=aJMhfCRyoZIvemM3Q2_KV9rpWxUsFnoY0ZdCr4TwSs8,11765
|
|
24
24
|
coding/proxy/config/schema.py,sha256=yDPQfxUzJToAfXH-fJxoujXoYAb6WMeq7VyySbvMYC8,12205
|
|
25
|
-
coding/proxy/config/server.py,sha256=
|
|
26
|
-
coding/proxy/config/vendors.py,sha256=
|
|
25
|
+
coding/proxy/config/server.py,sha256=NJbx4L1YuhfwmYpC8ZxiqUdqROoA0CfObWf-ujqjCPo,996
|
|
26
|
+
coding/proxy/config/vendors.py,sha256=11npZ5Ad9tDw6AtXjonVkU01rOkAQhnA5aRf7ZtyWPc,2868
|
|
27
27
|
coding/proxy/convert/__init__.py,sha256=0D3Q9TdY_AWCaMMf9f_i3jn0RIiWmqlcIAA79Ki8uJc,458
|
|
28
28
|
coding/proxy/convert/anthropic_to_gemini.py,sha256=9mRQ0CRAGJyWQADNlfMqoCJ_vY8ZZBGWaS_R8Vbe_l0,13201
|
|
29
29
|
coding/proxy/convert/anthropic_to_openai.py,sha256=crE8gi780Tr-dI58hce75BiaKzlh_dEyzvMxwLgAa8A,13435
|
|
30
30
|
coding/proxy/convert/gemini_sse_adapter.py,sha256=b7zQ9wBBn1bbG46WpLrAYOl0ExpyMTzpTorxoTadWaM,7395
|
|
31
31
|
coding/proxy/convert/gemini_to_anthropic.py,sha256=EE_rUsLmWTsF2QSYWqIYzsjyk1mKXFp2sziqj_S2W5U,3446
|
|
32
32
|
coding/proxy/convert/openai_to_anthropic.py,sha256=8rg8NZs_1up27MixrXRJAfmSiYrOkh_lkAJuytDGZow,3694
|
|
33
|
-
coding/proxy/logging/__init__.py,sha256=
|
|
33
|
+
coding/proxy/logging/__init__.py,sha256=VQ0GTb95cER0yIIrwfPTGEbRdUW4d2pnTv4NClmuG_o,6591
|
|
34
34
|
coding/proxy/logging/db.py,sha256=uARNaaAXWxemwfyybp660ujpi6UikNtFokG0pzXYwR8,19058
|
|
35
|
+
coding/proxy/logging/formatters.py,sha256=au9fsFvm6x5JLUyx-UVKq24yOcGOJhxgyTf9QBWcfns,1677
|
|
35
36
|
coding/proxy/logging/stats.py,sha256=JlhJC4a2RmuCjbaseSUONScbcgn41KNR_sNsZ0OScbw,9203
|
|
36
37
|
coding/proxy/model/__init__.py,sha256=E8E59yabP-CF5GIwHE4OEGPLiJj3yTLjFWmCorkQTxc,3947
|
|
37
38
|
coding/proxy/model/auth.py,sha256=NiiIPdLdxPtuHNrsGoxFASUXwJU5pkDuVRorQe_1Z-Q,934
|
|
@@ -45,18 +46,18 @@ coding/proxy/routing/circuit_breaker.py,sha256=fKodIYxJ-3hhil2rEjsGqvyHTspliN_eS
|
|
|
45
46
|
coding/proxy/routing/error_classifier.py,sha256=oDxp69sCb-pdfe1hWce29A9tsN3jAbhqfl2fRECBtCo,3747
|
|
46
47
|
coding/proxy/routing/executor.py,sha256=xQw3rtHd00n3BBgUHzqAli1GUoFNOxc0odKEaq-Dw7A,28206
|
|
47
48
|
coding/proxy/routing/model_mapper.py,sha256=b72CGRdusLAwoq7p8-8TWAv9-Zv8BozssiZC8XnNTx4,3574
|
|
48
|
-
coding/proxy/routing/quota_guard.py,sha256=
|
|
49
|
+
coding/proxy/routing/quota_guard.py,sha256=TRJs3mjdRMc_u0HCw-hZn--osha_m11dEtAUxOO2P5A,6806
|
|
49
50
|
coding/proxy/routing/rate_limit.py,sha256=i2cCqtbmXrP6wjRUTWXLP4DdYwVj0C4o59QdYGkPQj0,5122
|
|
50
51
|
coding/proxy/routing/retry.py,sha256=KEYVToBkBOtXdqY7He70RrtVWFqIpnOQf2VVksdLrlk,2386
|
|
51
52
|
coding/proxy/routing/router.py,sha256=bXaglxuT-5qYzrSMk7ZE4mpQynP4Z6F2pm9hnCbdG90,3440
|
|
52
53
|
coding/proxy/routing/session_manager.py,sha256=kpEPCo67CdsELX71hoe6G7sb2dcda7gTNL0FtpgRK7I,2950
|
|
53
54
|
coding/proxy/routing/tier.py,sha256=U12Mw0eTE1AO5RuHNpoOuXDdujz_Hkx_iyIrqkZbtyA,7024
|
|
54
55
|
coding/proxy/routing/usage_parser.py,sha256=j4G0ArFduQ2D4Yeuad94DVlwdc-JvSh7SJLVzc-hLcs,8480
|
|
55
|
-
coding/proxy/routing/usage_recorder.py,sha256=
|
|
56
|
+
coding/proxy/routing/usage_recorder.py,sha256=pObOrX2yIITTiyojl1fJcqO0yWWpbP4KqsJvFdmlt04,6273
|
|
56
57
|
coding/proxy/server/__init__.py,sha256=KeH7mEu36v9v27m3VgeSxSeFz9sLTJrxS_EVATJ7Vks,20
|
|
57
|
-
coding/proxy/server/app.py,sha256=
|
|
58
|
+
coding/proxy/server/app.py,sha256=ITCbtDrweNMp-l4_uNN-8wQ33BXpjvCk6p2dn8E0424,5538
|
|
58
59
|
coding/proxy/server/factory.py,sha256=I4asjFw_1ET49DC-xkCpfV7oyfSv4G6xUB_Z5N_SHY8,9920
|
|
59
|
-
coding/proxy/server/request_normalizer.py,sha256=
|
|
60
|
+
coding/proxy/server/request_normalizer.py,sha256=F_mgxxuA3i7cN1CEWlto7Mm9VT_QG2QNspiUWeYVBpM,10511
|
|
60
61
|
coding/proxy/server/responses.py,sha256=i0ugnLRNOdRYGHEWxkwsxR35ChmdMQsSaD8AjRluTn4,2167
|
|
61
62
|
coding/proxy/server/routes.py,sha256=QeEsYczjvPfVhOrED2qe1V6CpwVBZbQHs8dP0OGdGXQ,11734
|
|
62
63
|
coding/proxy/streaming/__init__.py,sha256=0al5TC-zJt8Bz0CibTmd8WPza-Cs-qcuZWvT2fKPqHI,23
|
|
@@ -64,7 +65,7 @@ coding/proxy/streaming/anthropic_compat.py,sha256=cycYiJ-glN88OmfLTR7FroHRethONl
|
|
|
64
65
|
coding/proxy/vendors/__init__.py,sha256=fehSpQ2-kUlZY6N8cNMGVJYMXspQmi3V4e0FgC4Ay4k,1011
|
|
65
66
|
coding/proxy/vendors/alibaba.py,sha256=vYhvk8hZEeOpqUrtGT-uaK89y6uolrDUAT2BvTD_IQY,876
|
|
66
67
|
coding/proxy/vendors/anthropic.py,sha256=KA_fvOxagGBggH2pc3l9Zoyl_XYUyRdfR8bI-eVj_e4,6328
|
|
67
|
-
coding/proxy/vendors/antigravity.py,sha256=
|
|
68
|
+
coding/proxy/vendors/antigravity.py,sha256=byFa64uUmPJv0CnoseF6dEkgYhPC_Jlrw3h0H43vkZ8,16164
|
|
68
69
|
coding/proxy/vendors/base.py,sha256=vrAaI_4uLtzaFcPWtBStVMHU5AgkCWTNLEgVeoHHgLE,14781
|
|
69
70
|
coding/proxy/vendors/copilot.py,sha256=qAFTO2xMqnawaFlvZS2a9-7f_UEkfODIFfDlgOBiQl4,29590
|
|
70
71
|
coding/proxy/vendors/copilot_models.py,sha256=UckIQYA4qLyNwEA09koQGBOZ65Nxhuo3ytUuDNqtzRU,15514
|
|
@@ -78,8 +79,8 @@ coding/proxy/vendors/native_anthropic.py,sha256=SxtM71PDci0gqLqiwCrFnT410SnSoD7F
|
|
|
78
79
|
coding/proxy/vendors/token_manager.py,sha256=s10t4Com0jNnKGkPyJ_HpG5SjHrCEJvfArEOAaPKA_k,4189
|
|
79
80
|
coding/proxy/vendors/xiaomi.py,sha256=E-GcmJBZh7GOtDFonxZmlf0hKRhrlrXzL0IxHFRYcRo,860
|
|
80
81
|
coding/proxy/vendors/zhipu.py,sha256=3j_rqNFu1CX-B5ugtrL6Y1OeWSy9yiqsVa9Bi1ssaAA,1062
|
|
81
|
-
coding_proxy-0.2.
|
|
82
|
-
coding_proxy-0.2.
|
|
83
|
-
coding_proxy-0.2.
|
|
84
|
-
coding_proxy-0.2.
|
|
85
|
-
coding_proxy-0.2.
|
|
82
|
+
coding_proxy-0.2.1a2.dist-info/METADATA,sha256=-xhbcbCthQVTX7CN4d3XQTPLRWhpLN2TH130IKN3Awo,10821
|
|
83
|
+
coding_proxy-0.2.1a2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
84
|
+
coding_proxy-0.2.1a2.dist-info/entry_points.txt,sha256=moIVzt5ho0Wk9B47LOo2SEAbhzuDDHWi-EfM30U0XBg,54
|
|
85
|
+
coding_proxy-0.2.1a2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
86
|
+
coding_proxy-0.2.1a2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|