npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@misakacloud/opencode-auto-model-config

v0.3.0

Published

OpenCode plugin: auto-fill model metadata from models.dev for custom providers

Readme

opencode-auto-model-config

OpenCode 插件:根据 models.dev 数据为自定义 provider 自动填充模型元数据。

介绍

当你在 OpenCode 中配置自定义 provider(如 OpenAI 兼容 API、第三方模型服务)时,需要手动填写模型的详细信息(上下文窗口、能力、费用等)。这个插件可以自动从 models.dev 获取这些元数据,并填充到你的 OpenCode 配置中。

主要功能:

  • 自动从 models.dev 获取模型元数据
  • 支持自定义 provider 和模型 ID 映射
  • 本地缓存(24 小时),避免频繁请求
  • 不覆盖用户已填写的字段
  • 支持调试模式,可查看配置变更

使用

安装

npm install <npm-package-name>
# 或
bun add <npm-package-name>

在 OpenCode 中启用

opencode.json 中添加插件:

{
	"plugin": ["@misakacloud/opencode-auto-model-config"]
}

配置

插件会自动在 ~/.config/opencode/oc-auto-model-config.json 创建配置文件。首次运行后,编辑该文件添加模型映射。

配置文件格式

{
	"mapping": {
		"your-provider-name": {
			"model-id": "modelsdev-provider/modelsdev-model-id"
		}
	}
}

示例

假设你的 OpenCode 配置中有:

{
	"provider": {
		"my-openai": {
			"models": {
				"gpt-4o": {}
			}
		}
	}
}

oc-auto-model-config.json 中添加映射:

{
	"mapping": {
		"my-openai": {
			"gpt-4o": "openai/gpt-4o"
		}
	}
}

重启 OpenCode 后,gpt-4o 模型会自动填充以下字段:

  • name: 模型显示名称
  • modalities: 输入输出模态
  • limit: 上下文窗口和输出限制
  • attachment: 是否支持附件
  • tool_call: 是否支持工具调用
  • reasoning: 是否支持推理
  • structured_output: 是否支持结构化输出
  • cost: 每百万 token 费用
  • knowledge: 知识截止日期

配置选项

{
  "mapping": { ... },
  "cacheTTL": 86400,
  "cachePath": "~/.config/opencode/models-dev.json",
  "debug": {
    "enabled": false,
    "dumpPath": "~/.config/opencode/expanded-config.json",
    "diffOnly": true
  }
}
  • mapping: 模型映射关系(必填)
  • cacheTTL: 缓存有效期,单位秒(默认 86400 = 24 小时)
  • cachePath: 自定义缓存文件路径
  • debug.enabled: 启用调试输出
  • debug.dumpPath: 调试输出文件路径
  • debug.diffOnly: 仅输出变更的字段(默认 true)