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

@kozer/opencode-copilot-cli-auth

v0.0.24

Published

Package on npm: https://www.npmjs.com/package/@kozer/opencode-copilot-cli-auth

Readme

opencode-copilot-cli-auth

Package on npm: https://www.npmjs.com/package/@kozer/opencode-copilot-cli-auth

This fork replaces the older GitHub Copilot chat-auth flow with the newer Copilot CLI-style OAuth flow and makes opencode use the live Copilot model metadata for your account.

How to use

Add the plugin to your opencode config:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "@kozer/[email protected]"
  ]
}

Then start opencode and log in to the github-copilot provider. The plugin handles the Copilot CLI-style device flow and will reuse the stored GitHub OAuth token afterward.

For local development before publishing, you can load the file directly:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "file:///absolute/path/to/index.mjs"
  ]
}

Important: if the file path contains opencode-copilot-auth, current opencode builds may skip loading it because of a hardcoded plugin-name filter. Use a path that does not contain that substring.

What changed in this fork

  • Auth flow: uses the Copilot CLI-style OAuth client flow and keeps the GitHub OAuth token directly.
  • Entitlement: fetches /copilot_internal/user and uses the entitlement-provided Copilot API base URL.
  • Token exchange: does not call /copilot_internal/v2/token.
  • Request profile: uses the newer copilot-developer-cli headers instead of the older chat profile.
  • Model metadata: fetches the live Copilot /models response via the plugin provider.models hook so the final opencode model list comes from the entitlement-backed Copilot API.
  • Synthetic message detection: includes the behavior from anomalyco/opencode#8721, which builds on #8393 to avoid excess premium charges when OpenCode emits synthetic user messages during agent/tool continuations.

Synthetic message detection

This fork also includes the logic proposed in anomalyco/opencode#8721.

That change fixes the premium-request misclassification described in #8030 by extending the official plugin work from #8393.

The #8393 plugin logic treated a request as agent-initiated only when the last message was not from the user. That misses OpenCode-generated synthetic user messages such as compaction prompts, tool attachment summaries, and subtask markers.

VSCode Copilot Chat handles this with explicit continuation flags in its internal request flow. OpenCode does not expose equivalent flags, so this fork infers the same intent from conversation history.

The detection rules are:

  • If any assistant or tool message already exists in the conversation, treat the request as agent.
  • If the last user message matches a known synthetic pattern, treat the request as agent.
  • Otherwise, treat the request as user.

Synthetic patterns currently detected:

  • What did we do so far?
  • Tool X returned an attachment:
  • The following tool was executed by the user
  • Tool result:
  • Tool output:

This keeps real first-turn user requests premium-billed while preventing synthetic follow-up messages from being billed like fresh user prompts.

The implementation also unifies vision detection across both the Completions and Responses APIs, and the repo includes focused regression tests covering synthetic detection and agent detection.

Context window and model limits

The main practical difference from upstream is that this fork patches live per-model limits from Copilot instead of relying only on static metadata.

That means opencode can see the Copilot-advertised values for:

  • limit.context
  • limit.input
  • limit.output

As of March 10, 2026, the live GitHub Copilot /models response used by this fork exposes the Copilot CLI model profile. The table below compares the live Copilot CLI context window against the static github-copilot catalog on models.dev.

| Model | This Fork (CLI Context) | models.dev Context | Difference | | ------------------- | ----------------------: | -------------------: | ---------: | | claude-opus-4.6 | 200,000 | 128,000 | +72,000 | | claude-sonnet-4.6 | 200,000 | 128,000 | +72,000 | | claude-haiku-4.5 | 144,000 | 128,000 | +16,000 |

The practical takeaway is that this fork exposes larger live Claude context windows than the static models.dev values.

Examples observed with this fork:

  • claude-sonnet-4.6
    • context window: 200000
    • prompt/input limit: 168000
    • output limit: 32000
  • claude-opus-4.6
    • context window: 200000
    • prompt/input limit: 168000
    • output limit: 64000
  • claude-haiku-4.5
    • context window: 144000
    • prompt/input limit: 128000
    • output limit: 32000

Without this patching, opencode may show stale or smaller limits depending on the static model catalog it started from.

Claude thinking budget behavior

This fork also changes Copilot Claude request behavior:

  • when the thinking variant is selected, it sends thinking_budget: 16000
  • when no variant is selected, it omits thinking_budget entirely

This differs from upstream opencode, which currently sends thinking_budget: 4000 for the built-in thinking variant.

The plugin intentionally does not try to change the opencode core UI. So the visible Claude variant list is still controlled by opencode itself; this fork changes the request behavior, not the built-in variant picker labels.

Publishing

./script/publish.ts