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-plugin-tsaperture

v0.4.0

Published

OpenCode plugin to automatically populate models from Tailscale Aperture API

Readme

NPM Version

OpenCode Tailscale Aperture Plugin

Automatically populate models from Tailscale Aperture.

OpenCode compatibility

The same package supports OpenCode v1 (1.4.0 or newer) and the new v2 plugin API. The default export provides v1 server and v2 setup entry points; direct callers can still import the named TailscaleAperturePlugin function for v1. The v2 adapter targets the API shipped in @opencode/plugin 2.0.5.

Both entry points share model discovery, provider grouping, protocol selection, and Models.dev enrichment. V2 registers replayable provider transforms and maps limits, modalities, costs, release dates, and reasoning variants to its model schema. Existing catalog settings take precedence over discovery defaults. Effort variants use each protocol's wire format; they are not generated for Bedrock or custom SDKs, which have no common effort parameter.

The two model lookup tools remain v1-only and v2 diagnostics go to stderr. OpenCode v2 supplies project, session, and client headers to model requests. V2's model schema also has no equivalent for v1's reasoning, temperature, attachment, or interleaved flags; input modalities still describe supported attachments.

Configuration

Configure the Aperture base URL using one of these methods (in order of precedence):

1. Plugin Options (opencode.json)

OpenCode v1:

{
  "plugin": [
    ["opencode-plugin-tsaperture", { "baseUrl": "http://ai.my-tailnet.ts.net" }]
  ]
}

OpenCode v2:

{
  "plugins": [
    {
      "package": "opencode-plugin-tsaperture",
      "options": { "baseUrl": "http://ai.my-tailnet.ts.net" }
    }
  ]
}

2. Environment Variable

export APERTURE_BASE_URL="http://ai.my-tailnet.ts.net"

3. Config File (aperture.json)

Create aperture.json in the opencode config directory:

macOS:

~/Library/Application\ Support/opencode/aperture.json

Linux:

~/.config/opencode/aperture.json

Windows:

%APPDATA%\opencode\aperture.json

Contents:

{
  "baseUrl": "http://ai.my-tailnet.ts.net",
  "apiKey": ""
}

apiKey is optional. Set it when your Aperture endpoint requires bearer auth. If omitted, the plugin passes an empty key to the generated providers.

API compatibility

The plugin reads Aperture provider compatibility metadata and registers each provider with the matching OpenCode provider package and endpoint. It supports OpenAI Responses and Chat Completions, Anthropic Messages, Google Vertex, Amazon Bedrock, and Gemini Generate Content routes.

Models.dev enrichment

The plugin enriches Aperture's /v1/models response with the same Models.dev catalog OpenCode uses. When a discovered model matches a catalog provider/model ID, the generated OpenCode config includes the catalog's family, release date, cost, modalities, reasoning/tool/temperature support, interleaved reasoning field, variants, and accurate limit.context, limit.input, and limit.output values.

Important: For full provider-specific feature support, the Aperture provider id and model id should match the Models.dev respective IDs. Provider IDs with an -x- suffix use the base ID for Models.dev lookup, so opencode-go-x-anthropic and opencode-go-x-responses both use the opencode-go catalog entry while retaining their separate API compatibility and SDK configuration.

Optional aperture.json fields:

{
  "modelsDevUrl": "https://models.dev",
  "modelsDevPath": "/path/to/models-dev-api.json",
  "disableModelsDev": false
}

The plugin also honors OpenCode's OPENCODE_MODELS_URL, OPENCODE_MODELS_PATH, and OPENCODE_DISABLE_MODELS_FETCH environment variables.

Usage

Once configured, Aperture models appear in the model picker. On v1, the assistant can also call these plugin tools:

  • list_aperture_models - List available models from Aperture
  • get_aperture_model with modelId - Get model details