opencode-copilot-cost-override
v0.1.2
Published
Custom GitHub Copilot provider model configuration with personalized cost values for the highest subscription tier
Downloads
38
Maintainers
Readme
opencode-copilot-cost-override
GitHub Copilot 提供商模型自定义配置 —— 按个人订阅类型调整 model cost 与参数
背景
GitHub Copilot 针对不同订阅类型提供不同的模型上限和计费标准。本插件按个人最高订阅类型的实际情况,硬编码了 Copilot provider 的模型列表和 cost 参数,不依赖内部插件的默认值(默认值为 0)或不准确的 API 返回。
方案
一个 OpenCode 用户侧插件,直接返回硬编码的模型定义(包含真实的 cost 值)。不走外部 /models API 调用,所有配置内聚在插件中,随时可手动调整。
安装与使用
方式一:从 npm 安装
opencode plugin install opencode-copilot-cost-override@latest或手动在 ~/.config/opencode/opencode.jsonc 中添加:
{
"plugin": ["opencode-copilot-cost-override@latest"]
}方式二:从本地路径加载
{
"plugin": [
"file:///path/to/opencode-github-copilot-provider"
]
}当前模型配置
| 模型 | input | output | cache_read | cache_write | context | |------|-------|--------|------------|-------------|---------| | gemini-3.1-pro-preview | 2 | 12 | 0.2 | 0 | 1,000,000 | | claude-haiku-4.5 | 1 | 5 | 0.1 | 1.25 | 200,000 | | gpt-5.4 | 2.5 | 15 | 0.25 | 0 | 1,050,000 | | claude-sonnet-4.6 | 3 | 15 | 0.3 | 3.75 | 200,000 | | claude-opus-4.6 | 5 | 25 | 0.5 | 6.25 | 1,000,000 |
以上 cost 对应个人最高订阅类型的实际计费标准。
验证
opencode models github-copilot自定义模型
要添加/修改/删除模型,编辑 src/models.ts。每个模型需要包含完整字段:
id,providerID("github-copilot")api({ id, url, npm: "@ai-sdk/github-copilot" })name,family,release_datecost({ input, output, cache: { read, write } })limit({ context, input, output })capabilities(temperature, reasoning, attachment, toolcall, input/output, interleaved)options,headers,variants
本地开发用 file:// 路径加载即可,opencode 直接读取 .ts 源码。
发布到 npm
# 1. 更新版本号
pnpm version patch # 或 minor / major
# 2. 发布(opencode 直接加载 .ts 源码,无需编译)
npm publish --access public --registry https://registry.npmjs.org/License
MIT
