coding-proxy 0.2.0a1__tar.gz → 0.2.1a1__tar.gz
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-0.2.1a1/.github/workflows/release.yml +326 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/CHANGELOG.md +11 -5
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/PKG-INFO +1 -1
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/pyproject.toml +1 -1
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/config.default.yaml +89 -72
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/routing.py +2 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/quota_guard.py +9 -2
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/app.py +2 -5
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/request_normalizer.py +2 -117
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/antigravity.py +4 -4
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_antigravity.py +13 -8
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_schema.py +17 -5
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_token_logger.py +18 -4
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/uv.lock +1 -1
- coding_proxy-0.2.0a1/.github/workflows/promote.yml +0 -176
- coding_proxy-0.2.0a1/.github/workflows/release.yml +0 -159
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/.github/workflows/ci.yml +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/.github/workflows/coverage.yml +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/.gitignore +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/AGENTS.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/CLAUDE.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/LICENSE +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/README.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/docs/ci-cd.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/docs/framework.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/docs/user-guide.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/docs/zh-CN/README.md +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/__main__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/providers/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/providers/base.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/providers/github.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/providers/google.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/runtime.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/auth/store.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/cli/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/cli/auth_commands.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/cli/banner.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/compat/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/compat/canonical.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/compat/session_store.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/auth_schema.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/loader.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/resiliency.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/schema.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/server.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/config/vendors.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/anthropic_to_gemini.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/anthropic_to_openai.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/gemini_sse_adapter.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/gemini_to_anthropic.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/convert/openai_to_anthropic.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/logging/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/logging/db.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/logging/stats.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/auth.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/compat.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/constants.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/pricing.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/token.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/model/vendor.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/pricing.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/circuit_breaker.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/error_classifier.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/executor.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/model_mapper.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/rate_limit.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/retry.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/router.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/session_manager.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/tier.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/usage_parser.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/routing/usage_recorder.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/factory.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/responses.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/server/routes.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/streaming/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/streaming/anthropic_compat.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/alibaba.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/anthropic.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/base.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/copilot.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/copilot_models.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/copilot_token_manager.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/copilot_urls.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/doubao.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/kimi.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/minimax.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/mixins.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/native_anthropic.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/token_manager.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/xiaomi.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/src/coding/proxy/vendors/zhipu.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/__init__.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_app_routes.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_auto_login.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_banner.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_circuit_breaker.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_cli_usage.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_compat.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_config_init.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_config_loader.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_convert_request.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_convert_response.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_convert_sse.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_copilot.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_copilot_convert_request.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_copilot_convert_response.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_copilot_models.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_copilot_urls.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_currency.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_error_classifier.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_mixins.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_auth.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_compat.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_constants.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_mapper.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_pricing.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_token.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_model_vendor.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_native_vendors.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_parse_usage.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_pricing.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_quota_guard.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_rate_limit.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_request_normalizer.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_router_chain.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_router_executor.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_runtime_reauth.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_streaming_anthropic_compat.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_tier.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_tiers_config.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_time_range.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_token_manager.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_types.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_vendor_streaming.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_vendors.py +0 -0
- {coding_proxy-0.2.0a1 → coding_proxy-0.2.1a1}/tests/test_zhipu.py +0 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# coding-proxy: PyPI Publishing Pipeline (4-Stage Unified Pipeline)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Trigger: GitHub Release publication event (release.types: [published])
|
|
5
|
+
#
|
|
6
|
+
# Architecture: 4-Stage Serial Pipeline (prerelease only — 所有生产发布均走预发布)
|
|
7
|
+
#
|
|
8
|
+
# Stage 1 (build): 矩阵构建 3.12/3.13/3.14,上传 artifacts
|
|
9
|
+
# Stage 2 (publish-testpypi): 发布到 TestPyPI 供验证
|
|
10
|
+
# Stage 3 (publish-to-pypi): ⏸ Production Approval Gate (environment: pypi)
|
|
11
|
+
# 审批通过后自动:Promote Release + Publish to PyPI
|
|
12
|
+
# Stage 4 (update-changelog): 从 Release notes 生成 Changelog PR → master
|
|
13
|
+
#
|
|
14
|
+
# 设计决策 — Stage 3 合并审批与发布的理由:
|
|
15
|
+
# pypa/gh-action-pypi-publish@release/v1 始终优先尝试 OIDC Trusted Publishing。
|
|
16
|
+
# 若将审批与发布拆分为两个 job,则无法同时满足:
|
|
17
|
+
# - 单一人工审批(不能两个 job 都声明 environment: pypi 触发二次审批)
|
|
18
|
+
# - OIDC 需要 environment: pypi 声明才能匹配 PyPI Trusted Publisher 配置
|
|
19
|
+
# 因此将 Approval Gate 与实际发布操作合并为同一 job,审批通过后顺序执行。
|
|
20
|
+
#
|
|
21
|
+
# Pre-requisites — 需要在 GitHub Settings 一次性手动配置:
|
|
22
|
+
# 1. repo → Settings → Environments → "pypi"
|
|
23
|
+
# → Required reviewers: 添加审批人员(Production Approval Gate 所需)
|
|
24
|
+
# 2. repo → Settings → Actions → General → Workflow permissions
|
|
25
|
+
# → "Read and write permissions"(Stage 4 推分支所需)
|
|
26
|
+
# → 勾选 "Allow GitHub Actions to create and approve pull requests"
|
|
27
|
+
#
|
|
28
|
+
# Authentication:
|
|
29
|
+
# - TEST_PYPI_API_TOKEN: TestPyPI API Token(repository secret)
|
|
30
|
+
# - PYPI Trusted Publisher: 已配置 OIDC(无需 API Token,通过 environment: pypi 自动认证)
|
|
31
|
+
#
|
|
32
|
+
# References:
|
|
33
|
+
# [1] https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
|
|
34
|
+
# [2] https://github.com/pypa/gh-action-pypi-publish
|
|
35
|
+
# [3] https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
|
|
36
|
+
# =============================================================================
|
|
37
|
+
|
|
38
|
+
name: Release / Publish Pipeline
|
|
39
|
+
|
|
40
|
+
on:
|
|
41
|
+
release:
|
|
42
|
+
types: [published]
|
|
43
|
+
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read # 全局最低权限,各 job 按需 override
|
|
46
|
+
|
|
47
|
+
env:
|
|
48
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
49
|
+
|
|
50
|
+
concurrency:
|
|
51
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
52
|
+
cancel-in-progress: false # 发布流水线不可被中断
|
|
53
|
+
|
|
54
|
+
jobs:
|
|
55
|
+
# ===========================================================================
|
|
56
|
+
# Stage 1: BUILD -- 矩阵构建,产出 sdist + wheel artifacts
|
|
57
|
+
# ===========================================================================
|
|
58
|
+
build:
|
|
59
|
+
name: Build distributions (py${{ matrix.python-version }})
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
timeout-minutes: 10
|
|
62
|
+
strategy:
|
|
63
|
+
matrix:
|
|
64
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: Checkout repository
|
|
68
|
+
uses: actions/checkout@v4
|
|
69
|
+
with:
|
|
70
|
+
persist-credentials: false
|
|
71
|
+
|
|
72
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
73
|
+
uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: ${{ matrix.python-version }}
|
|
76
|
+
|
|
77
|
+
- name: Set up uv
|
|
78
|
+
uses: astral-sh/setup-uv@v4
|
|
79
|
+
with:
|
|
80
|
+
enable-cache: true
|
|
81
|
+
|
|
82
|
+
- name: Install build dependencies
|
|
83
|
+
run: uv pip install --system build twine
|
|
84
|
+
|
|
85
|
+
- name: Build sdist and wheel
|
|
86
|
+
run: python -m build
|
|
87
|
+
|
|
88
|
+
- name: Check package metadata
|
|
89
|
+
run: twine check dist/*
|
|
90
|
+
|
|
91
|
+
- name: Upload build artifacts
|
|
92
|
+
uses: actions/upload-artifact@v4
|
|
93
|
+
with:
|
|
94
|
+
name: dist-py${{ matrix.python-version }}
|
|
95
|
+
path: dist/
|
|
96
|
+
retention-days: 14
|
|
97
|
+
|
|
98
|
+
# ===========================================================================
|
|
99
|
+
# Stage 2: PUBLISH TO TESTPYPI -- prerelease 路径专用
|
|
100
|
+
# ===========================================================================
|
|
101
|
+
publish-testpypi:
|
|
102
|
+
name: Publish to TestPyPI
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
needs: build
|
|
105
|
+
if: github.event.release.prerelease == true
|
|
106
|
+
timeout-minutes: 10
|
|
107
|
+
environment:
|
|
108
|
+
name: testpypi
|
|
109
|
+
url: https://test.pypi.org/p/coding-proxy
|
|
110
|
+
permissions:
|
|
111
|
+
contents: read
|
|
112
|
+
|
|
113
|
+
steps:
|
|
114
|
+
- name: Download build artifacts
|
|
115
|
+
uses: actions/download-artifact@v4
|
|
116
|
+
with:
|
|
117
|
+
pattern: dist-py*
|
|
118
|
+
path: dist/
|
|
119
|
+
merge-multiple: true
|
|
120
|
+
|
|
121
|
+
- name: List artifacts
|
|
122
|
+
run: ls -la dist/
|
|
123
|
+
|
|
124
|
+
- name: Publish to TestPyPI
|
|
125
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
126
|
+
with:
|
|
127
|
+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
128
|
+
repository-url: https://test.pypi.org/legacy/
|
|
129
|
+
skip-existing: true
|
|
130
|
+
attestations: false # TestPyPI 不支持 attestations,必须显式禁用
|
|
131
|
+
verbose: true
|
|
132
|
+
|
|
133
|
+
# ===========================================================================
|
|
134
|
+
# Stage 3: PUBLISH TO PYPI -- Production Approval Gate + Promote + Publish
|
|
135
|
+
# ===========================================================================
|
|
136
|
+
# 设计决策:将 Approval Gate 与实际发布操作合并为同一 job。
|
|
137
|
+
#
|
|
138
|
+
# 原因:pypa/gh-action-pypi-publish@release/v1 始终优先尝试 OIDC Trusted Publishing,
|
|
139
|
+
# 需要 id-token: write + environment: pypi 同时满足才能通过 PyPI 认证。
|
|
140
|
+
# 若拆分为两个 job,则无法避免二次审批或 OIDC 认证失败。
|
|
141
|
+
#
|
|
142
|
+
# 工作流程:
|
|
143
|
+
# 1. GitHub Actions pre-job 机制检测到 environment: pypi → 挂起等待审批
|
|
144
|
+
# 2. 审批人点击 Approve → job 开始执行
|
|
145
|
+
# 3. 顺序执行:Promote Release → Download Artifacts → Publish to PyPI
|
|
146
|
+
# ===========================================================================
|
|
147
|
+
publish-to-pypi:
|
|
148
|
+
name: "⏸ Production Approval Gate → Publish to PyPI"
|
|
149
|
+
runs-on: ubuntu-latest
|
|
150
|
+
needs: publish-testpypi
|
|
151
|
+
if: github.event.release.prerelease == true
|
|
152
|
+
timeout-minutes: 1440 # 24 小时(含审批等待 + 发布执行)
|
|
153
|
+
environment:
|
|
154
|
+
name: pypi
|
|
155
|
+
url: https://pypi.org/p/coding-proxy
|
|
156
|
+
permissions:
|
|
157
|
+
contents: write # 更新 GitHub Release 元数据(prerelease=false, make_latest=true)
|
|
158
|
+
id-token: write # PyPI OIDC Trusted Publishing 所需
|
|
159
|
+
|
|
160
|
+
steps:
|
|
161
|
+
- name: Approval granted — proceeding to PyPI production
|
|
162
|
+
run: |
|
|
163
|
+
echo "✅ Production deployment approved"
|
|
164
|
+
echo "Tag: ${{ github.ref_name }}"
|
|
165
|
+
echo "Release: ${{ github.event.release.name }}"
|
|
166
|
+
|
|
167
|
+
- name: Promote GitHub Release to stable
|
|
168
|
+
uses: actions/github-script@v7
|
|
169
|
+
with:
|
|
170
|
+
script: |
|
|
171
|
+
const { owner, repo } = context.repo;
|
|
172
|
+
const releaseId = ${{ github.event.release.id }};
|
|
173
|
+
const tagName = '${{ github.ref_name }}';
|
|
174
|
+
|
|
175
|
+
await github.rest.repos.updateRelease({
|
|
176
|
+
owner,
|
|
177
|
+
repo,
|
|
178
|
+
release_id: releaseId,
|
|
179
|
+
prerelease: false,
|
|
180
|
+
make_latest: true,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
core.notice(`✅ Release #${releaseId} (${tagName}) promoted: prerelease=false, make_latest=true`);
|
|
184
|
+
|
|
185
|
+
- name: Download all build artifacts
|
|
186
|
+
uses: actions/download-artifact@v4
|
|
187
|
+
with:
|
|
188
|
+
pattern: dist-py*
|
|
189
|
+
path: dist/
|
|
190
|
+
merge-multiple: true
|
|
191
|
+
|
|
192
|
+
- name: List artifacts
|
|
193
|
+
run: ls -la dist/
|
|
194
|
+
|
|
195
|
+
- name: Publish to PyPI (OIDC Trusted Publishing)
|
|
196
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
197
|
+
with:
|
|
198
|
+
skip-existing: true
|
|
199
|
+
verbose: true
|
|
200
|
+
|
|
201
|
+
# ===========================================================================
|
|
202
|
+
# Stage 5: UPDATE CHANGELOG -- 自动生成 Changelog PR → master
|
|
203
|
+
# ===========================================================================
|
|
204
|
+
update-changelog:
|
|
205
|
+
name: Update Changelog
|
|
206
|
+
runs-on: ubuntu-latest
|
|
207
|
+
needs: publish-to-pypi
|
|
208
|
+
if: github.event.release.prerelease == true
|
|
209
|
+
timeout-minutes: 10
|
|
210
|
+
permissions:
|
|
211
|
+
contents: write # git push 新分支
|
|
212
|
+
pull-requests: write # 创建 PR
|
|
213
|
+
|
|
214
|
+
steps:
|
|
215
|
+
- name: Checkout repository
|
|
216
|
+
uses: actions/checkout@v4
|
|
217
|
+
with:
|
|
218
|
+
fetch-depth: 0
|
|
219
|
+
persist-credentials: true
|
|
220
|
+
|
|
221
|
+
- name: Extract stable version from prerelease tag
|
|
222
|
+
id: version
|
|
223
|
+
run: |
|
|
224
|
+
PRERELEASE_TAG="${{ github.ref_name }}"
|
|
225
|
+
# v0.2.0a1 → v0.2.0(移除预发布后缀 a*/b*/rc*)
|
|
226
|
+
STABLE_VERSION=$(echo "$PRERELEASE_TAG" | sed 's/\(v[0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
|
|
227
|
+
echo "prerelease_tag=$PRERELEASE_TAG" >> "$GITHUB_OUTPUT"
|
|
228
|
+
echo "stable_version=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
|
|
229
|
+
echo "branch_name=chore/changelog-$STABLE_VERSION" >> "$GITHUB_OUTPUT"
|
|
230
|
+
echo "Extracted: $PRERELEASE_TAG → $STABLE_VERSION"
|
|
231
|
+
|
|
232
|
+
- name: Check if Changelog entry already exists
|
|
233
|
+
id: check
|
|
234
|
+
run: |
|
|
235
|
+
STABLE="${{ steps.version.outputs.stable_version }}"
|
|
236
|
+
if grep -qF "[$STABLE]" CHANGELOG.md; then
|
|
237
|
+
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
238
|
+
echo "ℹ️ Changelog entry for $STABLE already exists, skipping PR creation"
|
|
239
|
+
else
|
|
240
|
+
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
241
|
+
echo "✅ No existing entry for $STABLE, will create PR"
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
- name: Fetch release body and update CHANGELOG.md
|
|
245
|
+
if: steps.check.outputs.exists == 'false'
|
|
246
|
+
uses: actions/github-script@v7
|
|
247
|
+
with:
|
|
248
|
+
script: |
|
|
249
|
+
const fs = require('fs');
|
|
250
|
+
const { owner, repo } = context.repo;
|
|
251
|
+
|
|
252
|
+
// 通过 API 获取 Release body,避免 shell 特殊字符注入问题
|
|
253
|
+
const release = await github.rest.repos.getReleaseByTag({
|
|
254
|
+
owner,
|
|
255
|
+
repo,
|
|
256
|
+
tag: '${{ steps.version.outputs.prerelease_tag }}',
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
const stable = '${{ steps.version.outputs.stable_version }}';
|
|
260
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
261
|
+
const releaseUrl = `https://github.com/${owner}/${repo}/releases/tag/${{ steps.version.outputs.prerelease_tag }}`;
|
|
262
|
+
const body = release.data.body || '';
|
|
263
|
+
|
|
264
|
+
// 构建新条目
|
|
265
|
+
const newEntry = `\n## [${stable}](${releaseUrl}) — ${date}\n\n${body}\n`;
|
|
266
|
+
|
|
267
|
+
// 读取 CHANGELOG.md,在 ## [Unreleased] 行后插入新条目
|
|
268
|
+
let content = fs.readFileSync('CHANGELOG.md', 'utf8');
|
|
269
|
+
const marker = '## [Unreleased]';
|
|
270
|
+
const idx = content.indexOf(marker);
|
|
271
|
+
if (idx === -1) {
|
|
272
|
+
core.setFailed('CHANGELOG.md 中未找到 ## [Unreleased] 标记,无法插入条目');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const insertPos = idx + marker.length;
|
|
276
|
+
content = content.slice(0, insertPos) + newEntry + content.slice(insertPos);
|
|
277
|
+
fs.writeFileSync('CHANGELOG.md', content, 'utf8');
|
|
278
|
+
core.info(`✅ CHANGELOG.md updated with entry for ${stable}`);
|
|
279
|
+
|
|
280
|
+
- name: Create branch and commit
|
|
281
|
+
if: steps.check.outputs.exists == 'false'
|
|
282
|
+
run: |
|
|
283
|
+
BRANCH="${{ steps.version.outputs.branch_name }}"
|
|
284
|
+
STABLE="${{ steps.version.outputs.stable_version }}"
|
|
285
|
+
|
|
286
|
+
git config user.name "github-actions[bot]"
|
|
287
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
288
|
+
|
|
289
|
+
git checkout -b "$BRANCH"
|
|
290
|
+
git add CHANGELOG.md
|
|
291
|
+
git commit -m "docs(changelog): add entry for $STABLE"
|
|
292
|
+
git push origin "$BRANCH"
|
|
293
|
+
|
|
294
|
+
- name: Create Pull Request
|
|
295
|
+
if: steps.check.outputs.exists == 'false'
|
|
296
|
+
uses: actions/github-script@v7
|
|
297
|
+
with:
|
|
298
|
+
script: |
|
|
299
|
+
const { owner, repo } = context.repo;
|
|
300
|
+
const stable = '${{ steps.version.outputs.stable_version }}';
|
|
301
|
+
const branch = '${{ steps.version.outputs.branch_name }}';
|
|
302
|
+
const prereleaseTag = '${{ steps.version.outputs.prerelease_tag }}';
|
|
303
|
+
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${{ github.run_id }}`;
|
|
304
|
+
|
|
305
|
+
const pr = await github.rest.pulls.create({
|
|
306
|
+
owner,
|
|
307
|
+
repo,
|
|
308
|
+
title: `docs(changelog): 补充 ${stable} 发版说明`,
|
|
309
|
+
body: [
|
|
310
|
+
`## 摘要`,
|
|
311
|
+
``,
|
|
312
|
+
`自动生成的 PR,为 **${stable}** 正式版补充 CHANGELOG 条目。`,
|
|
313
|
+
``,
|
|
314
|
+
`- 来源:[\`${prereleaseTag}\`](https://github.com/${owner}/${repo}/releases/tag/${prereleaseTag}) Release notes`,
|
|
315
|
+
`- 目标分支:\`master\``,
|
|
316
|
+
``,
|
|
317
|
+
`请审阅 CHANGELOG 条目后合并。`,
|
|
318
|
+
``,
|
|
319
|
+
`> 🤖 由 [发布流水线](${runUrl}) 自动生成`,
|
|
320
|
+
].join('\n'),
|
|
321
|
+
head: branch,
|
|
322
|
+
base: 'master',
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
core.notice(`✅ PR created: ${pr.data.html_url}`);
|
|
326
|
+
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
- **请求规范化死代码清理**:移除 `request_normalizer` 中永远不可达的 `tool_result` 重定位逻辑(Phase 1 剥离已覆盖全部场景,Phase 2 重定位因方向错误无法启用);更新 docstring 使之与实际行为(剥离)一致;
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug 修复
|
|
10
|
+
|
|
11
|
+
- **fix(antigravity)**: 修复 Google OAuth token 刷新后 scope 校验过严导致 403 `ACCESS_TOKEN_SCOPE_INSUFFICIENT` 的问题。将 `_acquire()` 中严格的 5-scope 全量校验降级为 warning 日志,与参考项目 Antigravity-Manager 行为对齐。Google OAuth2 规范允许 refresh_token 返回的 access_token 仅包含部分已授权 scope,此前因校验过于严格导致有效 token 被拒绝使用,触发熔断器。
|
|
12
|
+
|
|
7
13
|
## [v0.2.0](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.2.0) — 2026-04-09
|
|
8
14
|
|
|
9
15
|
> [!IMPORTANT]
|
|
@@ -14,14 +20,14 @@
|
|
|
14
20
|
|
|
15
21
|
### ✨ 核心亮点
|
|
16
22
|
|
|
17
|
-
- **5
|
|
18
|
-
- **`usage`
|
|
23
|
+
- **5 家供应商集体入场**:MiniMax、小米 MiMo、阿里千问、Kimi、豆包(火山引擎)正式入编 N-tier。备用通道数量直接翻倍,不怕堵;
|
|
24
|
+
- **`usage` 命令全面升级**:从"只有天数"进化为**日 / 周 / 月 / 全量**四档时间维度(`-d 7` / `-w` / `-m` / `-t`)。支持多值过滤——`-v anthropic,kimi` 或 `--model claude-opus-4-6,glm-5.1` 用逗号隔开随便选。表格末行自动追加**汇总行**,请求总量、Token 总计、总成本、加权平均延迟四项一览无余。Token 花在哪家、烧了多少、谁最能扛——这张表给你答案;
|
|
19
25
|
|
|
20
26
|
### 🔧 更多特性
|
|
21
27
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
28
|
+
- **品牌横幅正式上线**:`proxy start` 启动时打印 Coding Proxy 专属 ASCII Banner 与版本号,告别冷冰冰的裸日志起手式;
|
|
29
|
+
- **529 过载纳入降级触发**:HTTP `529 overloaded_error` 正式加入故障转移白名单,Anthropic 喊"我堵了"时 Proxy 不再干等;
|
|
30
|
+
- **Zhipu 跨供应商级联故障根治**:`Internal Network Failure` 纳入 500 降级条件;`tool_result` 角色错位导致的下游级联崩溃彻底斩断,再也不因历史 message 的"历史遗留问题"把整条链拖下水;
|
|
25
31
|
|
|
26
32
|
## [v0.1.3](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.1.3) — 2026-04-07
|
|
27
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1a1
|
|
4
4
|
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM.
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "coding-proxy"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.1a1"
|
|
4
4
|
description = "A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -26,12 +26,12 @@ logging:
|
|
|
26
26
|
# 示例 3:将 zhipu 提升为首选,anthropic 作为后备
|
|
27
27
|
# tiers: ["zhipu", "anthropic"]
|
|
28
28
|
|
|
29
|
-
tiers: ["
|
|
29
|
+
tiers: ["zhipu", "anthropic", "copilot", "antigravity"]
|
|
30
30
|
|
|
31
31
|
# === 供应商定义(vendors 列表) ===
|
|
32
32
|
#
|
|
33
33
|
# 每个 vendor 通过 vendor 字段指定供应商类型:
|
|
34
|
-
# anthropic |
|
|
34
|
+
# anthropic | zhipu | minimax | alibaba | xiaomi | kimi | doubao | copilot | antigravity
|
|
35
35
|
#
|
|
36
36
|
# 优先级规则:
|
|
37
37
|
# - 若配置了 tiers,以其指定的顺序为准
|
|
@@ -101,6 +101,7 @@ vendors:
|
|
|
101
101
|
|
|
102
102
|
# Vendor 3: 智谱 GLM(终端兜底,无 circuit_breaker)
|
|
103
103
|
- vendor: zhipu
|
|
104
|
+
enabled: true
|
|
104
105
|
base_url: "https://open.bigmodel.cn/api/anthropic"
|
|
105
106
|
api_key: "${ZHIPU_API_KEY}"
|
|
106
107
|
timeout_ms: 3000000
|
|
@@ -127,75 +128,75 @@ vendors:
|
|
|
127
128
|
recovery_timeout_seconds: 300
|
|
128
129
|
success_threshold: 2
|
|
129
130
|
quota_guard:
|
|
130
|
-
enabled:
|
|
131
|
+
enabled: false
|
|
131
132
|
token_budget: 1000000000
|
|
132
133
|
window_hours: 24.0
|
|
133
134
|
threshold_percent: 95.0
|
|
134
135
|
probe_interval_seconds: 300
|
|
135
136
|
|
|
136
|
-
# Vendor 5:
|
|
137
|
-
- vendor:
|
|
137
|
+
# Vendor 5: 阿里 Qwen(默认禁用)
|
|
138
|
+
- vendor: alibaba
|
|
138
139
|
enabled: false
|
|
139
|
-
base_url: "https://
|
|
140
|
-
api_key: "${
|
|
140
|
+
base_url: "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic"
|
|
141
|
+
api_key: "${ALIBABA_API_KEY}"
|
|
141
142
|
timeout_ms: 3000000
|
|
142
143
|
circuit_breaker:
|
|
143
144
|
failure_threshold: 3
|
|
144
145
|
recovery_timeout_seconds: 300
|
|
145
146
|
success_threshold: 2
|
|
146
147
|
quota_guard:
|
|
147
|
-
enabled:
|
|
148
|
+
enabled: false
|
|
148
149
|
token_budget: 1000000000
|
|
149
150
|
window_hours: 24.0
|
|
150
151
|
threshold_percent: 95.0
|
|
151
152
|
probe_interval_seconds: 300
|
|
152
153
|
|
|
153
|
-
# Vendor 6:
|
|
154
|
-
- vendor:
|
|
154
|
+
# Vendor 6: 小米 MiMo(默认禁用)
|
|
155
|
+
- vendor: xiaomi
|
|
155
156
|
enabled: false
|
|
156
|
-
base_url: "https://
|
|
157
|
-
api_key: "${
|
|
157
|
+
base_url: "https://token-plan-cn.xiaomimimo.com/anthropic"
|
|
158
|
+
api_key: "${XIAOMI_API_KEY}"
|
|
158
159
|
timeout_ms: 3000000
|
|
159
160
|
circuit_breaker:
|
|
160
161
|
failure_threshold: 3
|
|
161
162
|
recovery_timeout_seconds: 300
|
|
162
163
|
success_threshold: 2
|
|
163
164
|
quota_guard:
|
|
164
|
-
enabled:
|
|
165
|
+
enabled: false
|
|
165
166
|
token_budget: 1000000000
|
|
166
167
|
window_hours: 24.0
|
|
167
168
|
threshold_percent: 95.0
|
|
168
169
|
probe_interval_seconds: 300
|
|
169
170
|
|
|
170
|
-
# Vendor 7:
|
|
171
|
-
- vendor:
|
|
171
|
+
# Vendor 7: Kimi(默认禁用)
|
|
172
|
+
- vendor: kimi
|
|
172
173
|
enabled: false
|
|
173
|
-
base_url: "https://
|
|
174
|
-
api_key: "${
|
|
174
|
+
base_url: "https://api.kimi.com/coding/"
|
|
175
|
+
api_key: "${KIMI_API_KEY}"
|
|
175
176
|
timeout_ms: 3000000
|
|
176
177
|
circuit_breaker:
|
|
177
178
|
failure_threshold: 3
|
|
178
179
|
recovery_timeout_seconds: 300
|
|
179
180
|
success_threshold: 2
|
|
180
181
|
quota_guard:
|
|
181
|
-
enabled:
|
|
182
|
+
enabled: false
|
|
182
183
|
token_budget: 1000000000
|
|
183
184
|
window_hours: 24.0
|
|
184
185
|
threshold_percent: 95.0
|
|
185
186
|
probe_interval_seconds: 300
|
|
186
187
|
|
|
187
|
-
# Vendor 8:
|
|
188
|
-
- vendor:
|
|
188
|
+
# Vendor 8: 豆包 Doubao(默认禁用)
|
|
189
|
+
- vendor: doubao
|
|
189
190
|
enabled: false
|
|
190
|
-
base_url: "https://
|
|
191
|
-
api_key: "${
|
|
191
|
+
base_url: "https://ark.cn-beijing.volces.com/api/coding"
|
|
192
|
+
api_key: "${ARK_API_KEY}"
|
|
192
193
|
timeout_ms: 3000000
|
|
193
194
|
circuit_breaker:
|
|
194
195
|
failure_threshold: 3
|
|
195
196
|
recovery_timeout_seconds: 300
|
|
196
197
|
success_threshold: 2
|
|
197
198
|
quota_guard:
|
|
198
|
-
enabled:
|
|
199
|
+
enabled: false
|
|
199
200
|
token_budget: 1000000000
|
|
200
201
|
window_hours: 24.0
|
|
201
202
|
threshold_percent: 95.0
|
|
@@ -231,11 +232,15 @@ model_mapping:
|
|
|
231
232
|
# Google Antigravity 模型映射
|
|
232
233
|
- pattern: "claude-sonnet-.*"
|
|
233
234
|
vendors: ["antigravity"]
|
|
234
|
-
target: "
|
|
235
|
+
target: "Claude Sonnet 4.6"
|
|
235
236
|
is_regex: true
|
|
236
237
|
- pattern: "claude-opus-.*"
|
|
237
238
|
vendors: ["antigravity"]
|
|
238
|
-
target: "
|
|
239
|
+
target: "Claude Opus 4.6 Thinking"
|
|
240
|
+
is_regex: true
|
|
241
|
+
- pattern: "claude-haiku-.*"
|
|
242
|
+
vendors: ["antigravity"]
|
|
243
|
+
target: "Gemini 3 Flash"
|
|
239
244
|
is_regex: true
|
|
240
245
|
# 智谱 GLM 映射(官方原生 Anthropic 兼容端点)
|
|
241
246
|
# glm-5v-turbo 完整承载 Claude Code 满血能力(tool calling / thinking / 多模态)
|
|
@@ -264,6 +269,32 @@ model_mapping:
|
|
|
264
269
|
vendors: ["minimax"]
|
|
265
270
|
target: "minimax-m2.7"
|
|
266
271
|
is_regex: true
|
|
272
|
+
# 阿里 Qwen 模型映射(原生 Anthropic 兼容端点)
|
|
273
|
+
- pattern: "claude-sonnet-.*"
|
|
274
|
+
vendors: ["alibaba"]
|
|
275
|
+
target: "qwen3.6-plus"
|
|
276
|
+
is_regex: true
|
|
277
|
+
- pattern: "claude-opus-.*"
|
|
278
|
+
vendors: ["alibaba"]
|
|
279
|
+
target: "qwen3.6-plus"
|
|
280
|
+
is_regex: true
|
|
281
|
+
- pattern: "claude-haiku-.*"
|
|
282
|
+
vendors: ["alibaba"]
|
|
283
|
+
target: "qwen3.6-plus"
|
|
284
|
+
is_regex: true
|
|
285
|
+
# 小米 MiMo 模型映射(原生 Anthropic 兼容端点)
|
|
286
|
+
- pattern: "claude-sonnet-.*"
|
|
287
|
+
vendors: ["xiaomi"]
|
|
288
|
+
target: "mimo-v2-pro"
|
|
289
|
+
is_regex: true
|
|
290
|
+
- pattern: "claude-opus-.*"
|
|
291
|
+
vendors: ["xiaomi"]
|
|
292
|
+
target: "mimo-v2-pro"
|
|
293
|
+
is_regex: true
|
|
294
|
+
- pattern: "claude-haiku-.*"
|
|
295
|
+
vendors: ["xiaomi"]
|
|
296
|
+
target: "mimo-v2-pro"
|
|
297
|
+
is_regex: true
|
|
267
298
|
# Kimi 模型映射(原生 Anthropic 兼容端点)
|
|
268
299
|
- pattern: "claude-sonnet-.*"
|
|
269
300
|
vendors: ["kimi"]
|
|
@@ -290,32 +321,6 @@ model_mapping:
|
|
|
290
321
|
vendors: ["doubao"]
|
|
291
322
|
target: "doubao-seed-2.0-lite"
|
|
292
323
|
is_regex: true
|
|
293
|
-
# 小米 MiMo 模型映射(原生 Anthropic 兼容端点)
|
|
294
|
-
- pattern: "claude-sonnet-.*"
|
|
295
|
-
vendors: ["xiaomi"]
|
|
296
|
-
target: "mimo-v2-pro"
|
|
297
|
-
is_regex: true
|
|
298
|
-
- pattern: "claude-opus-.*"
|
|
299
|
-
vendors: ["xiaomi"]
|
|
300
|
-
target: "mimo-v2-pro"
|
|
301
|
-
is_regex: true
|
|
302
|
-
- pattern: "claude-haiku-.*"
|
|
303
|
-
vendors: ["xiaomi"]
|
|
304
|
-
target: "mimo-v2-pro"
|
|
305
|
-
is_regex: true
|
|
306
|
-
# 阿里 Qwen 模型映射(原生 Anthropic 兼容端点)
|
|
307
|
-
- pattern: "claude-sonnet-.*"
|
|
308
|
-
vendors: ["alibaba"]
|
|
309
|
-
target: "qwen3.6-plus"
|
|
310
|
-
is_regex: true
|
|
311
|
-
- pattern: "claude-opus-.*"
|
|
312
|
-
vendors: ["alibaba"]
|
|
313
|
-
target: "qwen3.6-plus"
|
|
314
|
-
is_regex: true
|
|
315
|
-
- pattern: "claude-haiku-.*"
|
|
316
|
-
vendors: ["alibaba"]
|
|
317
|
-
target: "qwen3.6-plus"
|
|
318
|
-
is_regex: true
|
|
319
324
|
|
|
320
325
|
# === 模型定价(USD / 1M tokens) ===
|
|
321
326
|
# vendor: 供应商名称(对应 `usage` 统计表中的"供应商"列)
|
|
@@ -329,6 +334,12 @@ pricing:
|
|
|
329
334
|
output_cost_per_mtok: $25.0
|
|
330
335
|
cache_write_cost_per_mtok: $6.25
|
|
331
336
|
cache_read_cost_per_mtok: $0.50
|
|
337
|
+
- vendor: anthropic
|
|
338
|
+
model: Claude Opus 4.6
|
|
339
|
+
input_cost_per_mtok: $5.0
|
|
340
|
+
output_cost_per_mtok: $25.0
|
|
341
|
+
cache_write_cost_per_mtok: $6.25
|
|
342
|
+
cache_read_cost_per_mtok: $0.50
|
|
332
343
|
- vendor: anthropic
|
|
333
344
|
model: claude-sonnet-4-6
|
|
334
345
|
input_cost_per_mtok: $3.0
|
|
@@ -341,6 +352,12 @@ pricing:
|
|
|
341
352
|
output_cost_per_mtok: $5
|
|
342
353
|
cache_write_cost_per_mtok: $1.25
|
|
343
354
|
cache_read_cost_per_mtok: $0.10
|
|
355
|
+
- vendor: anthropic
|
|
356
|
+
model: Claude Haiku 4.5
|
|
357
|
+
input_cost_per_mtok: $1
|
|
358
|
+
output_cost_per_mtok: $5
|
|
359
|
+
cache_write_cost_per_mtok: $1.25
|
|
360
|
+
cache_read_cost_per_mtok: $0.10
|
|
344
361
|
# ── GitHub Copilot(透传 Claude,参照 Anthropic 定价估算) ──
|
|
345
362
|
- vendor: copilot
|
|
346
363
|
model: claude-opus-4.6
|
|
@@ -434,6 +451,27 @@ pricing:
|
|
|
434
451
|
output_cost_per_mtok: ¥8.40
|
|
435
452
|
cache_write_cost_per_mtok: ¥2.625
|
|
436
453
|
cache_read_cost_per_mtok: ¥0.21
|
|
454
|
+
# ── 阿里 Qwen ──
|
|
455
|
+
- vendor: alibaba
|
|
456
|
+
model: qwen3.6-plus
|
|
457
|
+
input_cost_per_mtok: $0.276
|
|
458
|
+
output_cost_per_mtok: $1.651
|
|
459
|
+
# ── 小米 MiMo ──
|
|
460
|
+
- vendor: xiaomi
|
|
461
|
+
model: mimo-v2-pro
|
|
462
|
+
input_cost_per_mtok: ¥7.00
|
|
463
|
+
output_cost_per_mtok: ¥21.00
|
|
464
|
+
cache_read_cost_per_mtok: ¥1.40
|
|
465
|
+
- vendor: xiaomi
|
|
466
|
+
model: mimo-v2-omni
|
|
467
|
+
input_cost_per_mtok: ¥2.80
|
|
468
|
+
output_cost_per_mtok: ¥14.00
|
|
469
|
+
cache_read_cost_per_mtok: ¥0.56
|
|
470
|
+
- vendor: xiaomi
|
|
471
|
+
model: mimo-v2-flash
|
|
472
|
+
input_cost_per_mtok: ¥0.70
|
|
473
|
+
output_cost_per_mtok: ¥2.10
|
|
474
|
+
cache_read_cost_per_mtok: ¥0.07
|
|
437
475
|
# ── Kimi ──
|
|
438
476
|
- vendor: kimi
|
|
439
477
|
model: kimi-k2.5
|
|
@@ -458,27 +496,6 @@ pricing:
|
|
|
458
496
|
output_cost_per_mtok: ¥3.60
|
|
459
497
|
cache_write_cost_per_mtok: ¥0.12
|
|
460
498
|
cache_read_cost_per_mtok: ¥0.017
|
|
461
|
-
# ── 小米 MiMo ──
|
|
462
|
-
- vendor: xiaomi
|
|
463
|
-
model: mimo-v2-pro
|
|
464
|
-
input_cost_per_mtok: ¥7.00
|
|
465
|
-
output_cost_per_mtok: ¥21.00
|
|
466
|
-
cache_read_cost_per_mtok: ¥1.40
|
|
467
|
-
- vendor: xiaomi
|
|
468
|
-
model: mimo-v2-omni
|
|
469
|
-
input_cost_per_mtok: ¥2.80
|
|
470
|
-
output_cost_per_mtok: ¥14.00
|
|
471
|
-
cache_read_cost_per_mtok: ¥0.56
|
|
472
|
-
- vendor: xiaomi
|
|
473
|
-
model: mimo-v2-flash
|
|
474
|
-
input_cost_per_mtok: ¥0.70
|
|
475
|
-
output_cost_per_mtok: ¥2.10
|
|
476
|
-
cache_read_cost_per_mtok: ¥0.07
|
|
477
|
-
# ── 阿里 Qwen ──
|
|
478
|
-
- vendor: alibaba
|
|
479
|
-
model: qwen3.6-plus
|
|
480
|
-
input_cost_per_mtok: $0.276
|
|
481
|
-
output_cost_per_mtok: $1.651
|
|
482
499
|
|
|
483
500
|
database:
|
|
484
501
|
path: "~/.coding-proxy/usage.db"
|
|
@@ -295,6 +295,8 @@ class VendorConfig(BaseModel):
|
|
|
295
295
|
if vendor_type == self.vendor:
|
|
296
296
|
continue
|
|
297
297
|
for field_name in fields:
|
|
298
|
+
if field_name in exclusive:
|
|
299
|
+
continue
|
|
298
300
|
value = getattr(self, field_name, None)
|
|
299
301
|
if value and value != getattr(
|
|
300
302
|
VendorConfig.model_fields[field_name], "default", None
|