
非官方的 typed .NET SDK 用于开放代码 HTTP API(预发布;计划中的 MCP 服务器)。
概览
本项目与OpenCode团队无任何关联或认可。 这些包现在是 OpenCodeDotNet.Sdk 和 OpenCodeDotNet.Sdk.Extensions;OpenCodeAI.Sdk 和 OpenCodeAI.Sdk.Extensions 已被弃用。命名空间保持不变,只有 PackageReference 发生了变化。仓库迁移到 opencode-dotnet 组织,旧链接重定向。 一个强类型 .NET 客户端用于 opencode 服务器——每个 opencode 前端(TUI、桌面、Web UI、插件)都使用的 HTTP API。SDK 使用 OpenCode 2.x API;不支持 1.x 服务器 API。 在置顶的 OpenAPI 快照中,可以调用——140 次生成的 HTTP 调用,以及两个终端 WebSocket 连接,通过手写传输。这三种连接模式都有效:SDK 启动的私有服务器、你已经运行的服务器,以及 opencode CLI 注册的后台服务。 - 🚧 发布版本为 0.9.0-preview.N。审查过的基线锁定了公开表面,但在 1.0.0 之前仍可能更改。
概述(AI 翻译)
** 🚀 快速入门**:安装 |快速入门 |指南 |API覆盖范围
非官方。 本项目与 OpenCode团队。
** 📦 新包裹ID和新家(
0.9.0-preview.5)。** 包裹现在是OpenCodeDotNet.Sdk和OpenCodeDotNet.Sdk.Extensions;OpenCodeAI.Sdk和OpenCodeAI.Sdk.Extensions已被弃用。命名空间保持不变,因此 仅对PackageReference的更改。仓库迁移到了opencode-dotnet组织, 和旧链接重定向。
一个强类型 .NET 客户端用于 opencode 服务器 — 每个开源代码前端(TUI、桌面、Web UI、插件)都使用的HTTP API。SDK说话 OpenCode 2.x API;1.x 服务器 API 不被支持。
🎉 项目状态
1.0 之前,协议表面已完成。 全部142个操作在固定的OpenAPI中 快照是可调用的——生成的HTTP调用有140次,两个终端WebSocket连接 通过手写传输。三种连接模式都有效:私有服务器 SDK Starts,一个你已经运行的服务器,以及OpenCode CLI注册的后台服务。
- 🚧 发布次数为
0.9.0-preview.N。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
opencode SDK for .NET
🚀 Quick Start: Install | Quick start | Guide | API coverage
Unofficial. This project is not affiliated with or endorsed by the opencode team.
📦 New package ids and a new home (
0.9.0-preview.5). The packages are nowOpenCodeDotNet.SdkandOpenCodeDotNet.Sdk.Extensions;OpenCodeAI.SdkandOpenCodeAI.Sdk.Extensionsare deprecated. Namespaces are unchanged, so only thePackageReferencechanges. The repository moved to theopencode-dotnetorganization, and old links redirect.
A strongly typed .NET client for the opencode server — the HTTP API that every opencode front-end (TUI, desktop, web UI, plugins) uses. The SDK speaks the OpenCode 2.x API; the 1.x server API is not supported.
await using var server = await OpenCodeServer.StartAsync();
using var client = server.CreateClient();
var created = await client.Sessions.CreateSessionAsync(new SessionCreateRequest { Title = "hello from .NET" });
Console.WriteLine($"session {created.Session.Id}");
🎉 Project Status
Pre-1.0, and the protocol surface is complete. All 142 operations in the pinned OpenAPI snapshot are callable — 140 as generated HTTP calls, and the two terminal WebSocket connections through hand-written transports. All three connection modes work: a private server the SDK starts, a server you already run, and the background service that the opencode CLI registers.
- 🚧 Releases are
0.9.0-preview.N. A reviewed baseline locks the public surface, but it can still change before1.0.0. See CHANGELOG.md. - 📌 The SDK builds against a snapshot of an upstream release tag, never a live branch.
spec/SNAPSHOT.mdowns the exact pin and the refresh procedure.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →