Skip to content

OpenCode 配置

OpenCode 可以使用 OpenAI 兼容环境变量接入 TimeSniper。

安装

请使用 OpenCode 官方推荐的安装方式。安装完成后确认:

bash
opencode --version

配置

macOS / Linux:

bash
export OPENAI_API_KEY="sk-你的Key"
export OPENAI_BASE_URL="https://timesniper.club/v1"
opencode

Windows PowerShell:

powershell
$env:OPENAI_API_KEY="sk-你的Key"
$env:OPENAI_BASE_URL="https://timesniper.club/v1"
opencode

建议

如果 OpenCode 支持本地配置文件,优先把 Key 放入工具自己的密钥管理或系统环境变量,不要把真实 Key 提交到项目仓库。

使用官方工具包与 TimeSniper 自有配置编写,不复制第三方站点内容。