Skip to main content

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.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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanobot_switch-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanobot_switch-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

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

Hashes for nanobot_switch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ec658802c16e581b682ec387610307e967592114646342fbd9ff89cbb567c87c
MD5 0eba316f5a1dcd586feb35fe63e06760
BLAKE2b-256 bb599b6dafdabeabf43995fdc85bda97bdc10eef018ada975237a12c2e494bc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanobot_switch-0.1.0.tar.gz:

Publisher: pypi-publish.yml on sperictao/nanobot-switch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for nanobot_switch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 caa566428019f69bde95875cfcd7e2d1f300452d0d72a2d1f794994ef1c6c745
MD5 9416f30014a8bb84316122528a4469a2
BLAKE2b-256 4cab85bd24ed484bad8918a9a0b85559422519cbd158f4b66f42985f70b9e557

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page