# blazemore **Repository Path**: opencode-plugin/blazemore ## Basic Information - **Project Name**: blazemore - **Description**: blaze-支持多key轮询 - **Primary Language**: TypeScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-09 - **Last Updated**: 2026-08-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # opencode-blazemore OpenCode BlazeAPI 多模型聚合服务的多 API Key 轮询提供商插件。 提供 BlazeAPI free 计划下实测可用的多模型支持,附带多 Key 自动轮询、错误转移、故障恢复能力。 ## 支持的模型 | 模型 | 计划 | 上下文 | 最大输出 | 推理 | |------|------|--------|----------|------| | `deepseek-r1` | free | 164K | 16K | ✅ | | `llama-3` | free | 128K | 16K | — | | `minimax-m3` | free | 1M | 512K | ✅ | | `deepseek-v4-flash` | free | 1M | 384K | ✅ | | `deepseek-v4-pro` | free | 1M | 384K | ✅ | > **说明**: > - context/output 取自用户指定或模型官方规格(Blaze `/models` 接口返回的数值与模型真实能力不符,已弃用) > - `✅` 表示支持 interleaved 推理,推理字段 `reasoning_content` > - free 计划下另有多个 starter 计划 / 不可用模型未在此暴露,可在 `src/constants.ts` 中按需启用 ## 安装 ### 1. 构建项目 ```bash cd blazemore npm install npm run build ``` ### 2. 配置 OpenCode 在 OpenCode 的 `opencode.json` 或 `opencode.jsonc` 中添加插件配置: ```json { "plugin": [ "/path/to/blazemore" ] } ``` ### 3. 连接授权 ```bash opencode connect blazemore ``` 按提示输入 API Key(支持多个 Key,用逗号分隔)。 ## 获取 API Key 前往 https://blazeapi.org/dashboard 创建你的 API Key。 ## 多 Key 轮询机制 - 输入多个 Key(逗号分隔)时自动启用轮询 - 按顺序依次使用每个 Key - 单个 Key 连续失败 3 次后自动跳过(通过 `fetch` 中间件捕获 401/403/429/5xx 响应递增错误计数) - 所有 Key 均失败后自动重置错误计数,重新从头开始轮询 - 单 Key 模式直接使用,不启动轮询 - 错误响应原样返回给 OpenCode 上层,不在此层做重试 ## 调试日志 通过环境变量开启调试日志: ```bash # 方式一:全局 DEBUG 开关 DEBUG=1 opencode # 方式二:仅本插件 OPENCODE_BLAZEMORE_DEBUG=1 opencode ``` 日志文件位置:`%USERPROFILE%\.blazemore\debug.log` ## 开发 ```bash # 构建 npm run build # 类型检查 npm run typecheck ``` ## 项目结构 ``` blazemore/ ├── package.json # 项目配置 ├── tsconfig.json # TypeScript 配置 ├── README.md ├── src/ │ ├── index.ts # 主入口:auth hooks、config、key 轮询 │ ├── constants.ts # 模型定义与常量 │ ├── plugin/ │ │ ├── auth.ts # API Key 持久化存储 │ │ └── key-manager.ts # 多 Key 轮询调度器 │ └── utils/ │ └── debug-logger.ts # 调试日志工具 └── dist/ # 编译产物 ``` ## 注意事项 - 插件不实现节流/重试机制,由 OpenCode 框架统一处理 - 401/403/429 错误将原始 Response 返回给 OpenCode 上层,由 @ai-sdk/provider-utils 的 handleFetchError 自行判断重试或 fallback - 错误通过 throw 传播给 OpenCode 框架进行 fallback 处理 - 不使用 `console.error` / `console.log`,日志全部走 `debug-logger.ts`