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

crofai-opencode-plugin

v1.2.0

Published

OpenCode plugin for CrofAI model loading and usage tracking

Downloads

35

Readme

CrofAI Plugin for OpenCode

A plugin suite for OpenCode that integrates CrofAI models and usage tracking.

Features

  • Auto-sync models: Automatically fetches and syncs models from CrofAI's /v1/models API
  • Reasoning support: Supports reasoning models with interleaved thinking (DeepSeek, Kimi, GLM, etc.)
  • Auto-generated variants: OpenCode automatically generates reasoning effort variants (low, medium, high, max for deepseek-v4)
  • Clean model names: No redundant provider prefix in the TUI
  • Usage tracking: Check your remaining requests and credits directly from OpenCode
  • API key authentication: Secure file-based API key reference

Quick Start

# Clone the repo
git clone https://github.com/squispeb/crofai-opencode-plugin.git /tmp/crofai-opencode-plugin

# Copy plugins
cp /tmp/crofai-opencode-plugin/plugins/*.ts ~/.config/opencode/plugins/

# Set up API key
mkdir -p ~/.config/opencode
echo "your-api-key-here" > ~/.config/opencode/crofai-key
chmod 600 ~/.config/opencode/crofai-key

Then add to your ~/.config/opencode/opencode.json:

{
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "plugin": ["crofai-opencode-plugin"]
}

Restart OpenCode to load the plugins.

Installation

Option 1: npm (Recommended)

Install globally:

npm install -g crofai-opencode-plugin

Then add to your ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "plugin": ["crofai-opencode-plugin"]
}

Option 2: Manual Installation

1. Copy the plugin files

mkdir -p ~/.config/opencode/plugins
cp plugins/crofai-models.ts ~/.config/opencode/plugins/
cp plugins/crofai-usage.ts ~/.config/opencode/plugins/

2. Set up your API key

Create the API key file:

mkdir -p ~/.config/opencode
echo "your-api-key-here" > ~/.config/opencode/crofai-key
chmod 600 ~/.config/opencode/crofai-key

3. Configure OpenCode

Add the plugin to your ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "plugin": ["crofai-models", "crofai-usage"]
}

4. Restart OpenCode

The plugins will automatically load all available models from the CrofAI API and provide the usage tracking tool.

Configuration

Minimal Setup

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "plugin": ["crofai-opencode-plugin"]
}

Full Setup with Cost-Effective Subagents

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "agent": {
    "explore": {
      "description": "Fast read-only codebase discovery",
      "mode": "subagent",
      "model": "CrofAI/qwen3.5-9b"
    },
    "execution": {
      "description": "Low-cost implementation subagent",
      "mode": "subagent",
      "model": "CrofAI/glm-4.7-flash"
    },
    "ui": {
      "description": "Frontend and interface specialist",
      "mode": "subagent",
      "model": "CrofAI/greg-1-mini"
    }
  },
  "plugin": ["crofai-opencode-plugin"]
}

Available Models

Models are automatically synced from the CrofAI API. Here's the current list:

Reasoning Models

| Model | Context | Output | Prompt ($/M) | Completion ($/M) | |-------|---------|--------|--------------|------------------| | deepseek-v4-pro | 1M | 131K | $0.30 | $0.50 | | deepseek-v4-flash | 1M | 131K | $0.12 | $0.21 | | kimi-k2.6 | 262K | 262K | $0.50 | $1.99 | | kimi-k2.5 | 262K | 262K | $0.35 | $1.70 | | glm-5.1 | 202K | 202K | $0.45 | $2.10 | | qwen3.5-397b-a17b | 262K | 262K | $0.35 | $1.75 | | qwen3.6-27b | 262K | 262K | $0.20 | $1.50 | | qwen3.5-9b | 262K | 262K | $0.04 | $0.15 | | gemma-4-31b-it | 262K | 262K | $0.10 | $0.30 |

Non-Reasoning Models

| Model | Context | Output | Prompt ($/M) | Completion ($/M) | |-------|---------|--------|--------------|------------------| | deepseek-v3.2 | 163K | 163K | $0.28 | $0.38 | | glm-4.7 | 202K | 202K | $0.25 | $1.10 | | glm-4.7-flash | 202K | 131K | $0.04 | $0.30 | | greg-1-mini | 229K | 229K | $0.07 | $0.15 | | greg-1 | 229K | 229K | $0.10 | $0.30 | | minimax-m2.5 | 204K | 131K | $0.11 | $0.95 |

Cost-Effective Recommendations

For subagents, we recommend:

| Agent | Model | Why | |-------|-------|-----| | explore | qwen3.5-9b | Cheapest with reasoning ($0.04/M prompt) | | execution | glm-4.7-flash | Cheapest overall ($0.04/M prompt) | | ui | greg-1-mini | Good balance ($0.07/M prompt) |

Usage Tracking

Using the Tool

Ask OpenCode to check your usage:

Check my CrofAI usage

Or use the tool directly:

@crofai-usage

The tool will return:

CrofAI Usage:

  450 requests remaining today
  $12.3456 credits available

For more details, visit: https://crof.ai

API Reference

Check your remaining usage and credits:

curl https://crof.ai/usage_api/ \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "usable_requests": 450,
  "credits": 12.3456
}
  • usable_requests: Requests left today (null if not on a subscription plan)
  • credits: Available credit balance

Troubleshooting

Models not loading

  1. Check your API key file exists:

    cat ~/.config/opencode/crofai-key
  2. Verify the plugins are loaded:

    opencode debug info
  3. Check models are listed:

    opencode models CrofAI

TUI not responding

If the TUI shows the model but no response, ensure your opencode.json has the correct structure. The minimal working config is:

{
  "provider": {
    "CrofAI": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1",
        "apiKey": "{file:~/.config/opencode/crofai-key}"
      }
    }
  },
  "plugin": ["crofai-opencode-plugin"]
}

Reasoning content not showing

The plugin automatically configures reasoning: true and interleaved: { field: "reasoning_content" } for models that support it. If you don't see thinking content, verify the model supports reasoning in the model list above.

Reasoning Variants

The plugin sets reasoning: true and interleaved: { field: "reasoning_content" } for models that support reasoning. OpenCode automatically generates reasoning effort variants based on the model ID:

  • Standard: low, medium, high
  • DeepSeek V4: low, medium, high, max

No manual variant configuration is needed. Use the variant keybind in the TUI to cycle through available variants.

License

MIT License - see LICENSE for details.