参考:
项目:https://github.com/anomalyco/opencode
文档:https://opencode.ai/docs/cli/
安装:
# YOLO curl -fsSL https://opencode.ai/install | bash # Package managers npm i -g opencode-ai@latest # or bun/pnpm/yarn scoop bucket add extras; scoop install extras/opencode # Windows choco install opencode # Windows brew install opencode # macOS and Linux paru -S opencode-bin # Arch Linux mise use -g opencode # Any OS nix run nixpkgs#opencode # or github:anomalyco/opencode for latest dev branch这里windows安装:choco install opencode,参考https://blog.csdn.net/weixin_42357472/article/details/156562946
配置
参考:https://docs.bigmodel.cn/cn/coding-plan/tool/opencode
1、模型配置 --智谱glm
cd C:\Users\loong.config\opencode
编辑opencode.json
{ "$schema": "https://opencode.ai/config.json", "provider": { "zhipuai": { "api": "https://open.bigmodel.cn/api/coding/paas/v4" } } }2、登录
opencode auth login如果报错:error: CERT_HAS_EXPIRED downloading package manifest opencode-copilot-auth
解决:
# 清理OpenCode缓存 Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode" -ErrorAction SilentlyContinue # 设置环境变量绕过SSL验证 $env:NODE_TLS_REJECT_UNAUTHORIZED="0" $env:BUN_CONFIG_NO_VERIFY_TLS="1" # 重试登录 opencode auth login使用
运行:
opencode案例
前端网页:
Build an interactive kanban-style board. It should have 4 columns TODO, In Progress, Review, and Done.
svg图像生成:
Generate an SVG of a pelican riding a bicycle