opencode-sdk

opencode-sdk is a skill for Claude Code, Codex from Timmy6942025/opencode-builder-skill. It costs 78 tokens per session (11,478 once invoked), scanned A, original, MIT.

A JavaScript and TypeScript software development kit for controlling OpenCode, an AI coding tool, from another program. It can connect to an existing server or start and manage one itself.

In plain words
What is it for?
Use it to create OpenCode sessions, send prompts, manage files, control the terminal interface, stream events, and build automated or external integrations.
Why use it?
It removes the need to build raw HTTP requests and manually define the API data structures. Type checking helps catch incorrect calls while building an integration.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md; mentions OpenCode.

Good fit Use it to create OpenCode sessions, send prompts, manage files, control the terminal interface, stream events, and build automated or external integrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/timmy6942025/opencode-builder-skill/opencode-sdk
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.

Any agent
npx skills add Timmy6942025/opencode-builder-skill --skill opencode-sdk
Clone the repo
git clone --depth 1 https://github.com/Timmy6942025/opencode-builder-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for opencode-sdk

README.md
[![agentmods](https://agentmods.dev/badge/skills/timmy6942025/opencode-builder-skill/opencode-sdk/github.svg)](https://agentmods.dev/skills/timmy6942025/opencode-builder-skill/opencode-sdk)
Your own site
<a href="https://agentmods.dev/skills/timmy6942025/opencode-builder-skill/opencode-sdk"><img src="https://agentmods.dev/badge/skills/timmy6942025/opencode-builder-skill/opencode-sdk/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for opencode-sdk

Your own site · 80×15
<a href="https://agentmods.dev/skills/timmy6942025/opencode-builder-skill/opencode-sdk"><img src="https://agentmods.dev/badge/skills/timmy6942025/opencode-builder-skill/opencode-sdk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 11,478 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00078 $0.11478
Opus 5.5 $0.00031 $0.04591
Sonnet 5.5 $0.00016 $0.02296
Haiku 4.5 $0.00008 $0.01148

Measured 1mo ago against content hash 5bb00883233a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

opencode-sdk scanned grade A with 0 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/opencode-sdk/SKILL.md · 1,684 lines

How it starts

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

OpenCode JavaScript/TypeScript SDK (@opencode-ai/sdk)

📚 Official Docs: For the latest information, always refer to the official documentation: https://opencode.ai/docs/sdk/

Type-safe JavaScript/TypeScript client for the OpenCode server. Use it to build integrations, automate workflows, and control OpenCode programmatically.

All types are auto-generated from the server's OpenAPI 3.1 specification and available in the types file.


Installation

npm install @opencode-ai/sdk
# or
bun add @opencode-ai/sdk

Two Client Modes

Full Lifecycle (createOpencode)

Starts an OpenCode server and returns a connected client. Use this when you own the server lifecycle.

import { createOpencode } from "@opencode-ai/sdk"

const { client, server } = await createOpencode({
  hostname: "127.0.0.1",
  port: 4096,
  timeout: 5000,
  config: {
    model: "anthropic/claude-3-5-sonnet-20241022",
  },
})

console.log(`Server running at ${server.url}`)

// Use the client...

server.close()

Options:

Option Type Description Default
hostname string Server hostname 127.0.0.1
port number Server port 4096
signal AbortSignal Abort signal for cancellation undefined
timeout number Timeout in ms for server start 5000
config Config Configuration object {}

The instance still picks up your opencode.json, but inline config overrides or adds to it. The returned server object has a .url property and a .close() method to shut down the server process.

Client Only (createOpencodeClient)

Connects to an already-running OpenCode server. Use this when the server is managed externally (e.g., opencode serve or a TUI instance).

import { createOpencodeClient } from "@opencode-ai/sdk"

const client = createOpencodeClient({
  baseUrl: "http://localhost:4096",
  throwOnError: true,
  responseStyle: "data",
})

Read the full file on GitHub · 1,684 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. 1mo ago First seen · 1,684 lines · 78 tokens per session scan A 5bb00883233a

Subscribe to this mod's changes

opencode-sdk is a skill published in the GitHub repository Timmy6942025/opencode-builder-skill (2 stars, last pushed 4mo ago), licensed MIT. It adds 78 tokens to every session and 11,478 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

arkts-syntax-assistant

ArkTS syntax, migration, and optimization guide for HarmonyOS/OpenHarmony development. Triggers on: .ets files, ArkTS keywords, HarmonyOS/OpenHarmony context, @ohos packages. Help with syntax reference, TypeScript migration, performance optimization, compile errors, state management, component development, and…

SummerKaze/skill-arkts-syntax-assistant · 71 tokens

nestjs-expert

Creates and configures NestJS modules, controllers, services, DTOs, guards, and interceptors for enterprise-grade TypeScript backend applications. Use when building NestJS REST APIs or GraphQL services, implementing dependency injection, scaffolding modular architecture, adding JWT/Passport authentication, integrating…

Jeffallan/claude-skills · 107 tokens

typescript-pro

Implements advanced TypeScript type systems, creates custom type guards, utility types, and branded types, and configures tRPC for end-to-end type safety. Use when building TypeScript applications requiring advanced generics, conditional or mapped types, discriminated unions, monorepo setup, or full-stack type safety…

Jeffallan/claude-skills · 69 tokens

programming

Applies strict, modern language practice (typed errors, exhaustive match, tests that can fail) for Python, Rust, TypeScript, and Go. Use for work on .py, .rs, .ts, or .go files.

code-yeongyu/oh-my-openagent · 51 tokens

electron-dev

Electron desktop apps with React, TypeScript, and Vite. Use for IPC, window/tray, PTY terminals, WebRTC, and packaging.

jamditis/claude-skills-journalism · 34 tokens

kysely

Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.

Mindrally/skills · 26 tokens