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-candela

v0.1.0

Published

OpenCode plugin for Candela — session tracking, cost toasts, and budget warnings for LLM observability

Downloads

135

Readme

opencode-candela

OpenCode plugin for Candela — session tracking, cost toasts, rich budget warnings, and budget-aware session compaction.

npm License

What It Does

When you use OpenCode with Candela running locally, this plugin automatically:

| Feature | Description | |---------|-------------| | Session cost toasts | Shows token usage and cost when a session goes idle | | Rich budget warnings | Daily spend, active grants, reset countdowns, color-coded urgency | | Shell env injection | Sets CANDELA_PROXY_URL and OPENAI_BASE_URL in all shells | | Compaction context | Injects current budget + grant state into session compaction summaries |

If Candela is not running, the plugin gracefully no-ops — zero overhead.


Installation

Option 1: npm (recommended)

Add to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-candela"]
}

Option 2: Local install

# Project-scoped
mkdir -p .opencode/plugins
cp -r node_modules/opencode-candela/src .opencode/plugins/opencode-candela/

# Global
mkdir -p ~/.config/opencode/plugins/opencode-candela
cp -r node_modules/opencode-candela/src/* ~/.config/opencode/plugins/opencode-candela/

Prerequisites

  1. Candela running locallycandela start (requires candela v0.4.6+)
  2. Authentication — run candela auth login once to set up Google OAuth credentials (no gcloud CLI dependency)
  3. OpenCode installednpm install -g opencode-ai

The plugin auto-detects Candela on localhost:8181. To use a custom URL:

export CANDELA_PROXY_URL="http://localhost:9090"

How It Works

Session Cost Toast

When your OpenCode session goes idle, the plugin shows a summary:

📊 142.3K tokens · $0.47 · 12 calls · 3m42s

Budget Warnings

On startup and after each session, the plugin checks your full budget state:

💰 Budget: $10.00 remaining (80% used)
   Active grants: +$5.00 bonus (resets in 3d 14h)
   Total remaining (waterfall): $15.00
⚠️ Daily budget is running low!

Shell Environment

Every shell spawned by OpenCode gets Candela's proxy URL injected:

echo $CANDELA_PROXY_URL    # http://localhost:8181
echo $OPENAI_BASE_URL      # http://localhost:8181/proxy/openai/v1

Compaction Context

When OpenCode compacts a long session, current budget and grant state is injected:

This session has used 142.3K tokens ($0.47) across 12 LLM calls. Model breakdown:

  • claude-sonnet-4 (anthropic): 98.2K tokens, $0.31
  • gemini-2.5-pro (google): 44.1K tokens, $0.16 Daily budget: $10.00 remaining of $50.00 (80% used). Active grants: +$5.00 bonus (resets in 3d 14h). Total remaining: $15.00.

Configuration

The plugin works with zero configuration. Optional env vars:

| Variable | Default | Description | |----------|---------|-------------| | CANDELA_PROXY_URL | http://localhost:8181 | Candela server URL |


Combining with Candela Provider Config

For full integration, use this plugin alongside Candela providers in your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-candela"],
  "provider": {
    "candela-anthropic": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Claude via Candela",
      "options": {
        "baseURL": "http://localhost:8181/proxy/anthropic/v1"
      },
      "models": {
        "claude-sonnet-4-20250514": { "name": "Claude Sonnet 4" },
        "claude-opus-4-20250514": { "name": "Claude Opus 4" }
      }
    },
    "candela-gemini": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Gemini via Candela",
      "options": {
        "baseURL": "http://localhost:8181/proxy/gemini-oai/v1"
      },
      "models": {
        "gemini-3.5-pro": { "name": "Gemini 3.5 Pro" },
        "gemini-3.5-flash": { "name": "Gemini 3.5 Flash" },
        "gemini-2.5-pro": { "name": "Gemini 2.5 Pro" },
        "gemini-2.5-flash": { "name": "Gemini 2.5 Flash" }
      }
    }
  }
}

Related


License

Apache License 2.0. See LICENSE for details.