OpenCode SDK for Rust
A Rust client library for the OpenCode API, providing type-safe access to all endpoints.
Quick Start
use Opencode;
async
OpenCode SDK for RustA Rust client library for the OpenCode API, providing type-safe access to all endpoints.
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(())
}