Skip to main content

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.yml
    • push / pull_requestmain 时自动执行测试与打包校验
  • .github/workflows/release.yml
    • push 标签 v*(如 v0.1.1)时自动构建并发布 GitHub Release,上传 wheel/sdist
  • .github/workflows/pypi-publish.yml
    • 当 GitHub Release published 时自动发布到 PyPI

PyPI 发布配置

支持两种方式,推荐第 1 种(更安全):

  1. Trusted Publishing(推荐)
    • 在 PyPI 项目里配置 GitHub OIDC Publisher:
      • Owner: sperictao
      • Repository: nanobot-switch
      • Workflow: pypi-publish.yml
      • Environment: pypi
  2. API Token(兼容方式)
    • 在 GitHub 仓库设置 Secret:PYPI_API_TOKEN
    • 可用命令:
gh secret set PYPI_API_TOKEN --repo sperictao/nanobot-switch

Release files for nanobot-switch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanobot-switch 0.1.0
File Size Uploaded
nanobot_switch-0.1.0.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nanobot-switch 0.1.0
File Interpreter ABI Platform
nanobot_switch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / nanobot_switch-0.1.0.tar.gz

Download URL nanobot_switch-0.1.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ec658802c16e581b682ec387610307e967592114646342fbd9ff89cbb567c87c
BLAKE2b-256 checksum
How to use checksums
bb599b6dafdabeabf43995fdc85bda97bdc10eef018ada975237a12c2e494bc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.

Transparency log

Release files / nanobot_switch-0.1.0-py3-none-any.whl

Download URL nanobot_switch-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caa566428019f69bde95875cfcd7e2d1f300452d0d72a2d1f794994ef1c6c745
BLAKE2b-256 checksum
How to use checksums
4cab85bd24ed484bad8918a9a0b85559422519cbd158f4b66f42985f70b9e557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page