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

opencode-copilot-auto

v0.2.0

Published

OpenCode plugin that makes GitHub Copilot Free work by routing requests through Copilot's Auto mode

Readme

opencode-copilot-auto

npm

Makes GitHub Copilot Free work in OpenCode 2.x.

The problem

With a Copilot Free account connected, OpenCode's model picker shows the Copilot models for a moment and then empties. Picking one by name fails with The requested model is not supported.

Copilot Free only serves requests that go through Copilot's Auto mode: the client asks Copilot which model to use, then sends the request to that model with a short-lived session token. OpenCode only does this for plans whose models carry an Auto discount, which Free doesn't have.

What the plugin does

It turns on only when OpenCode can't serve your account by itself: GitHub marks none of your models as pickable and none has an Auto discount. That's Copilot Free today; the check doesn't rely on plan names. It then:

  • shows the chat models GitHub allows your account in the model picker, each labelled · via Auto, because Auto decides which model answers whatever you pick, and
  • routes requests for those models through Auto: it asks Copilot which model to use, switches the request to it, and adds Auto's session token. Auto keeps its pick for the session until the token is about to expire, or until the session is compacted.

On any other account it does nothing, so OpenCode's own Copilot support is untouched. A reconnect or disconnect is noticed within 30 seconds. It doesn't impersonate another client: requests use your OpenCode Copilot login and identify themselves as opencode-copilot-auto.

Smaller requests on a slow connection

This part runs on every Copilot account, paid ones too. Copilot keeps nothing between requests, so OpenCode sends the whole chat again with every message, photos included. A chat with a few photos soon means uploading 1 MB or more per message, and on a slow upload Copilot gives up with Timed out reading request body. So the plugin:

  • swaps photos and files from earlier messages for a short note, oldest first, whenever a request is over 400 KB. Photos in your latest message are always sent. The model keeps what it said about the removed ones, and asks you to send one again if it needs to look at it;
  • after a body timeout, retries once with every earlier photo removed, then stops instead of sending the same upload over and over (OpenCode tried 7 times or more). If there were no earlier photos to remove, it doesn't retry at all, since the same upload would fail again: the photos in your latest message are too big for your connection, so send fewer or smaller ones. For the rest of that chat (until OpenCode restarts), every earlier photo is left out, whatever the size.

OpenCode 2.4 already shrinks attached photos (a 2 MB photo goes out as about 400 KB) and leaves out earlier turns' reasoning, so photos are what grows.

Install

  1. Connect GitHub Copilot in OpenCode as usual.

  2. Add the plugin to opencode.json:

    { "plugins": ["opencode-copilot-auto"] }

    or copy index.js to ~/.config/opencode/plugins/copilot-auto.js.

  3. Restart OpenCode and pick any GitHub Copilot model marked · via Auto.

The model that actually answered is shown under each reply.

Your latest message (up to 2,000 characters) is sent to Copilot's /auto endpoint so Copilot can choose a model, as Copilot's own clients do.

Settings

| OPENCODE_COPILOT_AUTO | Effect | |---|---| | unset or auto | Route through Auto only when OpenCode can't serve the account (Copilot Free) | | always | Route through Auto on every plan | | off | Do nothing |

| Variable | Effect | |---|---| | OPENCODE_COPILOT_SLIM=off | Send requests as OpenCode builds them: no photo removal, no retry change | | OPENCODE_COPILOT_SLIM_KB | Size above which earlier photos are removed (default 400) | | OPENCODE_COPILOT_AUTO_DEBUG | A file path: the plugin appends what it does there (account check, request sizes, timeouts) |

Limits

  • Copilot Free has a small monthly chat allowance, and an agent sends one request per tool step, so long tasks use it up quickly.
  • Session titles aren't routed (they would spend the allowance). Set a small_model from another provider for titles.
  • It relies on OpenCode's plugin API (integration.connection, model.transform, session.hook) and on Copilot's /auto endpoint, neither of which is a documented stable API. Tested with OpenCode 2.3.2 on 2026-11-18 and 2.4.1 on 2026-11-28. On older OpenCode versions that lack the API it does nothing (2.1 has no experimental.model.resolve hook, so Auto routing doesn't run there).
  • The photo removal uses the http.request hook and reads the request body, so it only understands Copilot's Responses and Chat Completions formats; anything else is sent unchanged.
  • It sends the Copilot API versions OpenCode 2.3 sends (X-GitHub-Api-Version 2026-08-01, and 2025-04-01 for the account check). When GitHub retires those, requests fail with an HTTP error until the plugin is updated.

Development

npm test

The tests use a fake OpenCode host and a fake Copilot API; they make no network requests.