Standalone one-click provider switch and health checker for nanobot
Project description
nanobot-switch
一个独立于 nanobot 仓库的切换工具,提供:
- 一键切换 Provider / Model / BaseURL / API Key
- Profile 保存与复用
- 自动健康检查(后台守护)
- 失败阈值触发自动切换到 fallback profile
- 类似 cc-switch 的可视化交互菜单
安装
cd /Users/erictao/temp/nanobot-switch
uv tool install --editable .
快速开始
# 打开可视化菜单
nanobot-switch menu
# 命令式一键切换
nanobot-switch apply \
--provider vllm \
--model claude-sonnet-4-5-20250929 \
--api-base https://example.com/v1 \
--api-key sk-xxx \
--save-as main
# 健康检查一次
nanobot-switch health once
# 启动自动健康检查(连续失败 3 次后切到 fallback)
nanobot-switch health start \
--interval 60 \
--fail-threshold 3 \
--fallback-profile main
文件
工具使用以下文件:
~/.nanobot/config.json~/.nanobot/switch_profiles.json~/.nanobot/healthcheck_state.json~/.nanobot/healthcheck_runtime.json~/.nanobot/healthcheck.log
CI/CD 自动化
仓库已内置 3 个工作流:
.github/workflows/ci.ymlpush/pull_request到main时自动执行测试与打包校验
.github/workflows/release.ymlpush标签v*(如v0.1.1)时自动构建并发布 GitHub Release,上传 wheel/sdist
.github/workflows/pypi-publish.yml- 当 GitHub Release
published时自动发布到 PyPI
- 当 GitHub Release
PyPI 发布配置
支持两种方式,推荐第 1 种(更安全):
- Trusted Publishing(推荐)
- 在 PyPI 项目里配置 GitHub OIDC Publisher:
- Owner:
sperictao - Repository:
nanobot-switch - Workflow:
pypi-publish.yml - Environment:
pypi
- Owner:
- 在 PyPI 项目里配置 GitHub OIDC Publisher:
- API Token(兼容方式)
- 在 GitHub 仓库设置 Secret:
PYPI_API_TOKEN - 可用命令:
- 在 GitHub 仓库设置 Secret:
gh secret set PYPI_API_TOKEN --repo sperictao/nanobot-switch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanobot_switch-0.1.0.tar.gz.
File metadata
- Download URL: nanobot_switch-0.1.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec658802c16e581b682ec387610307e967592114646342fbd9ff89cbb567c87c
|
|
| MD5 |
0eba316f5a1dcd586feb35fe63e06760
|
|
| BLAKE2b-256 |
bb599b6dafdabeabf43995fdc85bda97bdc10eef018ada975237a12c2e494bc4
|
Provenance
The following attestation bundles were made for nanobot_switch-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on sperictao/nanobot-switch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobot_switch-0.1.0.tar.gz -
Subject digest:
ec658802c16e581b682ec387610307e967592114646342fbd9ff89cbb567c87c - Sigstore transparency entry: 927297901
- Sigstore integration time:
-
Permalink:
sperictao/nanobot-switch@de9c7f4f7d28b7a4da8938adf659f5c725234c7b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sperictao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@de9c7f4f7d28b7a4da8938adf659f5c725234c7b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nanobot_switch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nanobot_switch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caa566428019f69bde95875cfcd7e2d1f300452d0d72a2d1f794994ef1c6c745
|
|
| MD5 |
9416f30014a8bb84316122528a4469a2
|
|
| BLAKE2b-256 |
4cab85bd24ed484bad8918a9a0b85559422519cbd158f4b66f42985f70b9e557
|
Provenance
The following attestation bundles were made for nanobot_switch-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on sperictao/nanobot-switch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobot_switch-0.1.0-py3-none-any.whl -
Subject digest:
caa566428019f69bde95875cfcd7e2d1f300452d0d72a2d1f794994ef1c6c745 - Sigstore transparency entry: 927297902
- Sigstore integration time:
-
Permalink:
sperictao/nanobot-switch@de9c7f4f7d28b7a4da8938adf659f5c725234c7b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sperictao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@de9c7f4f7d28b7a4da8938adf659f5c725234c7b -
Trigger Event:
workflow_dispatch
-
Statement type: