Skip to content

Repository files navigation

opencodeR

Rust port of the OpenCode AI coding agent.

License: MIT

opencodeR is a full-featured HTTP API server and CLI client for AI-assisted coding, rewritten from the original opencode TypeScript codebase into Rust. It provides the same API surface with better performance, lower memory usage, and cross-platform binaries.

Quick Start

# Download the latest release for your platform
curl -fsSL https://github.com/grave0x/opencodeR/releases/latest/download/opencodeR-x86_64-unknown-linux-gnu.tar.gz | tar xz
# Start the server
./opencodeR-server --headless --port 8081
# In another terminal, run a prompt
./opencodeR run "Explain this codebase" --port 8081

Binaries

BinaryDescriptionDefault mode
opencodeRCombined binary — server + client + TUIopencode-style agent chat TUI (home screen → sessions)
opencodeR-serverHTTP API serverServer dashboard TUI (--headless for headless)
opencodeR-clientRemote CLI clientConnects to running server (--base-url)

opencodeR (combined)

USAGE:
opencodeR [COMMAND]
COMMANDS:
server Start the headless HTTP server
client Connect to a remote server interactively
run Run a one-shot prompt and exit
tui Launch the server dashboard TUI
sessions List sessions from a running server
models List available AI models
providers List configured providers
agents List available agents
export Export a session as JSON
import Import session data from JSON file
completion Generate shell completion script

opencodeR-server

# Server dashboard TUI (default)
opencodeR-server
# Headless mode
opencodeR-server --headless --port 8081 --password mysecret

opencodeR-client

# Interactive REPL
opencodeR-client --base-url http://127.0.0.1:8081
# One-shot prompt
opencodeR-client --base-url http://127.0.0.1:8081 --one-shot "Refactor this"

API Endpoints

The server implements the full opencode HTTP API:

GroupEndpointsStatus
HealthGET /api/health
SessionsCRUD + prompt, events, history, messages, revert, interrupt, context, wait
AgentsGET /api/agent
ModelsGET /api/model
ProvidersGET /api/provider/:id
FilesystemGET /api/fs/read/*path, list, find
PTYCRUD + connect token, WebSocket connect✅ (real processes)
EventsGET /api/event (SSE)
IntegrationsList, connect key/OAuth, attempt flow
PermissionsRequest/reply flow, saved rules
QuestionsAsk/reply/reject
CommandsGET /api/command
SkillsGET /api/skill
AuthPassword-based Basic auth middleware

Architecture

 ┌─────────────────────────┐
│ opencodeR binary │
│ (CLI / TUI / Server) │
└─────────┬───────────────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Server │ │ Client │ │ TUI │
│ Crate │ │ Crate │ │ (ratatui)│
└────┬─────┘ └────┬─────┘ └──────────┘
│ │
└──────┬───────┘
▼
┌──────────────┐
│ Core Crate │
│ (traits + │
│ in-memory) │
└──────┬───────┘
│
┌──────┴───────┐
│ Schema + │
│ Protocol │
│ Crates │
└──────────────┘

Crate structure

CratePurpose
opencode-r-schemaData types (session, agent, model, provider, PTY, etc.)
opencode-r-protocolHTTP routes, error types, request/response payloads
opencode-r-coreService traits + in-memory implementations
opencode-r-serverAxum router, handlers, middleware (auth, access log)
opencode-r-clientHTTP client library for the API
opencode-r-cliBinary entry points + TUI
opencode-r-llmLLM provider abstraction (in progress)
opencode-r-pluginPlugin system (in progress)

Building from source

git clone https://github.com/grave0x/opencodeR.git
cd opencodeR
cargo build --release --bin opencodeR --bin opencodeR-server --bin opencodeR-client

The release binaries will be in target/release/.

Cross-compilation

# Linux ARM64
cargo build --release --target aarch64-unknown-linux-gnu --bin opencodeR
# Windows
cargo build --release --target x86_64-pc-windows-msvc --bin opencodeR

Packaging

FormatLocation
Arch Linuxpackaging/arch/PKGBUILD
Debian/Ubuntupackaging/debian/
RPM (Fedora/RHEL)packaging/rpm/opencodeR.spec
Cargocargo install opencode-r-cli

Configuration

Environment variableDefaultDescription
OPENCODE_PORT8081Server port
OPENCODE_PASSWORD(none)Enable Basic auth
OPENCODE_BASE_URLhttp://127.0.0.1:8081Server URL for client
RUST_LOGinfoLog level (e.g. debug, opencode_r_server=info)

Feature comparison

See features/feature-comparison.json for a detailed comparison between opencodeR and the original opencode.

See features/ROADMAP.md for the planned feature roadmap.

License

MIT — see LICENSE.

About

Rust port of the OpenCode AI coding agent — HTTP API server, CLI client, and TUI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages