Register and share your invite link to earn from video plays and referrals.

Search results for OpenCode
OpenCode community
One keyword maps to one global community path.
Create community
People
Not Found
Tweets including OpenCode
# OpenCode Features and Practical Usage 🤖 Turn OpenCode from "a tool you chat with in the terminal" into "a dev server you drive from code." The SDK plus a headless server let you embed AI coding into CI and custom UIs. 🏷️ Title: Type-safe JS client and headless server 🔗 URL: 📘 Overview OpenCode can run not only as a TUI but as a headless server you control over HTTP. The type-safe `@opencode-ai/sdk` JavaScript/TypeScript client connects to that server to create sessions, send prompts, and subscribe to events. All types are generated from the server's OpenAPI spec, so completion and type-checking work out of the box. ⚙️ How It Works ・Start the server: `opencode serve` launches a headless server, defaulting to `127.0.0.1:4096`. The SDK's `createOpencode()` can both start the server and hand you a client in one call. ・Connect a client: For an existing server, use `createOpencodeClient({ baseUrl: "http://localhost:4096" })`. ・Core APIs: Create/list/get/update/delete sessions, share/unshare, abort, and revert/unrevert messages. Send prompts with `client.session.prompt()`. ・Structured output: Pass `format: { type: "json_schema", schema: {...} }` to receive validated JSON matching your schema, ideal for downstream machine processing. ・Event stream: `client.event.subscribe()` gives you server-sent events as a stream to monitor long-running operations. 🛠️ Practical Usage Starting the server from code is a few calls: `createOpencode()` returns both a `client` and `server`, then `client.session.create()` opens a session and `client.session.prompt()` sends a prompt (passing a `format` of `json_schema` for structured output), and `server.close()` shuts it down. For CI, `noReply: true` is handy when you want to inject context without triggering an AI response. 💡 Use Cases ・A review bot fetches a structured findings JSON via the SDK (instead of `opencode run`) and posts a formatted GitHub PR comment. ・A custom web UI or editor extension uses the `tui` APIs to append/submit prompts and show toasts, building a bespoke frontend. ・A nightly batch sends the same analysis prompt across many repos and stores the resulting JSON in a data platform. ⚠️ Caveats ・SDK config overrides and merges with `opencode.json` rather than replacing it entirely, so watch for lingering unintended settings. ・Structured output retries on validation failure (default 2). If it still fails, ` holds a `StructuredOutputError`. Keep schemas small and focused for reliability. ・Calls like `client.session.get()` throw on an invalid ID, so wrap them in try-catch. #OpenCode# #AIAgents#
Show more
OpenCode 2.0 now has 1M daily active users that happened in 2 weeks go upgrade everyone is having fun without you
OpenCode users are reporting unauthorized API charges after a security breach, including one report of $400 spent on an Anthropic account. OpenCode confirms that at least 1.4% of Console users were affected. Its customer email warns that third-party provider keys stored in workspaces may have been exposed through unauthorized access to a legacy system being shut down.
Show more
OpenCode 2.0 just shipped. And it's a MASSIVE update! One background server for every client. Agents can script MCP tools in one round trip. 80+ built-in plugins. v1 plugins break on upgrade. If you're updating tonight, what's the first thing you're checking?
Show more
OpenCode 2.0 is here, with a massive overhaul of the open-source AI coding agent! The biggest architectural change is a single background service shared by the terminal, desktop and web interfaces. But there's much more: • Code Mode: Agents can write JavaScript to combine MCP tools and APIs, reducing tool-call overhead and context bloat. • Background agents: Run subagents and shell commands asynchronously while you keep working. • New API: Completely redesigned for more powerful session management and orchestration. • Plugins: Over 80 internal plugins, TUI extensions and hot reloading. OpenCode can even write and load its own plugins! • New SDK: Build custom coding agents and interfaces on top of OpenCode. OpenCode is evolving from an interactive coding assistant into a fully programmable development platform.
Show more
# OpenCode Features and Practical Usage 🧰 When the built-in tools aren't enough and you need to hit an internal API or DB, you can give the LLM its own purpose-built tool. 🏷️ Title: Custom Tools 🔗 URL: 📘 Overview Custom tools are your own functions that the LLM can invoke autonomously during a conversation. They extend the built-in tools (read/write/bash) so the agent can perform domain-specific operations like internal API access or database queries. Definitions are written in TypeScript/JavaScript, but the implementation can shell out to any language. ⚙️ How It Works ・Two locations: `.opencode/tools/` for project-scoped tools, or `~/.config/opencode/tools/` for global ones. ・The filename becomes the tool name. `database.ts` creates a `database` tool. ・You can define multiple tools per file via named exports, which become `_`. ・Define tools with the `tool()` helper from `@opencode-ai/plugin`. The core fields are `description` (what the LLM sees), `args` (a Zod schema), and `execute` (the async implementation). ・Arguments are type-safe via Zod. Use `tool.schema` or import `zod` directly. ・The second argument to `execute` is a context object exposing session info: `agent`, `sessionID`, `messageID`, `directory`, and `worktree` (the git root). 🛠️ Practical Usage Minimal example at `.opencode/tools/database.ts`: a default-exported `tool()` with a `description`, an `args` Zod schema (e.g. a `query` string), and an async `execute` that runs the query and returns the result. The body can call any language. For instance, build a script path from `context.worktree` and run it with `Bun.$`python3 ...``. 💡 Use Cases Define a tool that hits your internal inventory API or an authenticated internal endpoint, and the agent can fetch or update internal data just like it uses built-in tools. The more carefully you write the `description`, the better the LLM picks the right moment to call it. ⚠️ Caveats ・A custom tool with the same name as a built-in one overrides it. Unless you mean to replace it, use unique names. If you only want to disable a built-in tool, `deny` it via permissions instead of overriding. ・Since `execute` may run external commands or internal APIs, be careful with execution rights and secret handling. #OpenCode# #AIAgents#
Show more
opencode-lightpanda plugin now works with opencode v2.
# OpenCode Features and Practical Usage 🔌 Want your agent to reach into the outside world? OpenCode's MCP server integration turns Sentry errors, library docs, and code search into tools the agent can call directly. 🏷️ Title: External Tool Connections (Local/Remote) 🔗 URL: 📘 Overview Configure MCP (Model Context Protocol) servers and external service tools become automatically available to the agent alongside OpenCode's built-in tools. Both local (process-launched) and remote (HTTP endpoint) servers are supported. ⚙️ How It Works Servers are declared in the `mcp` block of `opencode.json`, each under a unique identifier. ・Local: set `type: "local"`, give `command` as the startup command array, and optionally pass `environment` variables. `timeout` (default 5000ms) is configurable. ・Remote: set `type: "remote"` and provide `url`. Authenticate by passing a Bearer token in `headers`, or use OAuth (a 401 can trigger the flow automatically). Each server can be toggled individually with `enabled`. MCP tools appear with the server name as a prefix, and the `tools` field with wildcards (`*`, `?`) lets you enable or disable them globally or per agent. 🛠️ Practical Usage A remote Sentry integration is just an entry under `mcp` with `type: "remote"`, the `url` ` a Bearer token in `headers`, and `enabled: true`. For local servers, launch with something like `"command": ["npx", "-y", "@/modelcontextprotocol/server-everything"]`. You can just as easily add Context7 for docs search (` or Grep for GitHub code search (` as remotes. Use `opencode mcp auth ` and `opencode mcp list` to authenticate and check status. 💡 Use Cases Have the agent investigate a production error via Sentry, look up the correct usage of an up-to-date library via Context7, and find real-world implementations across repos via Grep — all in a single session, from investigation through implementation. For safety, keep servers at `enabled: false` and switch them on only for the tasks that need them. ⚠️ Caveats MCP servers consume context. Enabling a server that exposes many tools (like GitHub's) can rapidly inflate token usage and risk overflowing the context limit. Keep the set of enabled servers tight, and if you use API keys, set `oauth: false` to suppress automatic OAuth. Note that a remote server can fail to start if it exceeds its `timeout`. #OpenCode# #MCP#
Show more
OpenCode is NOT listening to me, i told it to go find aliens and it found a paper where the authors thought a star was emitting interesting light and proved that it was actually error from equipment they were using that is the OPPOSITE of finding aliens
Show more
OpenCode Go is by far the largest attempt at making agents accessible to everyone we are very close to getting all the economics figured out, the more users we have the more possible it is we do not make any money on this side of the business, we work to not lose money
Show more
0
82
1.8K
36
Forward to community