opencode

A specialized agent that connects to OpenCode, which can provide access to many AI models through OpenRouter. It helps choose models for different coding, writing, or analysis tasks.

In plain words
What is it for?
Use it to select models for coding and other tasks, compare providers, switch between them, and work within a limited budget.
Why use it?
It lets you compare model outputs and change providers or models when cost, capability, or task fit matters.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ruizrica/toolkit/opencode
Clone the repo
git clone --depth 1 https://github.com/ruizrica/toolkit
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,039 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01039
Opus 5 $0.00000 $0.00519
Sonnet 5 $0.00000 $0.00208
Haiku 4.5 $0.00000 $0.00104

Measured 2d ago against content hash 1c62d5be8566, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

opencode scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

- **OpenCode CLI** - Auto-installed: `curl -fsSL https://opencode.ai/install | bash`

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **OpenCode CLI** - Auto-installed: `curl -fsSL https://opencode.ai/install | bash`
docs/agents/opencode.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenCode Agent

A specialized agent that interfaces with OpenCode CLI to provide access to 75+ AI models through OpenRouter. Enables intelligent model selection based on task requirements, performance needs, and cost optimization.

When to Use

  • Comparing outputs from different AI models
  • Optimizing cost/performance ratios
  • Accessing the latest AI models from any provider
  • Switching between providers without vendor lock-in
  • Selecting task-specific models for coding, documentation, or analysis
  • Budget-constrained projects needing free/cheap options

Capabilities

  • Multi-Model Access - Switch between 75+ models via OpenRouter
  • Cost Optimization - Select models based on performance/cost ratio
  • Task-Specific Selection - Choose optimal models for specific tasks
  • Provider Agnostic - Seamlessly switch between Anthropic, OpenAI, Google, Meta
  • Real-Time Model Updates - Access new models immediately upon release
  • Vendor Independence - Complete flexibility in model selection

Invocation

/toolkit:opencode-agent Refactor this authentication module using Claude 3.5 Sonnet

Model Selection Strategy

For Coding Tasks

Tier Model Use Case
Premium anthropic/claude-3.5-sonnet Critical code, complex debugging
Standard openai/gpt-4o General development
Budget deepseek/deepseek-coder Routine coding
Free qwen/qwen-2.5-coder-32b Zero-budget projects

For Documentation

Tier Model Use Case
Premium openai/gpt-4-turbo Comprehensive API docs
Budget mistralai/mixtral-8x7b README files
Free meta-llama/llama-3-8b Code comments

For Architecture Design

Tier Model Use Case
Premium anthropic/claude-3-opus Microservices design
Open Source openai/gpt-oss-120b System architecture
Budget meta-llama/llama-3-70b Component design

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 134 lines · 0 tokens per session scan C 1c62d5be8566

Subscribe to this mod's changes

opencode is an agent published in the GitHub repository ruizrica/toolkit (5 stars, last pushed 17d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,039 tokens. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.