opencode-sdk-rs 0.1.0

A Rust SDK for the OpenCode API with type-safe access to all endpoints, automatic retries, and streaming support
Documentation

OpenCode SDK for Rust

A Rust client library for the OpenCode API, providing type-safe access to all endpoints.

Quick Start

use opencode_sdk_rs::Opencode;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), opencode_sdk_rs::OpencodeError> {
    // Uses OPENCODE_BASE_URL env var or defaults to localhost:54321
    let client = Opencode::new()?;

    // Get app info
    let app = client.app().get(None).await?;
    println!("Connected to: {}", app.hostname);

    // List sessions
    let sessions = client.session().list(None).await?;
    println!("Found {} sessions", sessions.len());

    Ok(())
}