Embed a Rust agent runtime in Node.js
openclaw-node exposes the Rust core to Node.js via napi-rs — providers, credential store, event store, validation, and tool registry — with pre-built binaries.
- You have a Node.js app but want Rust-grade providers, secrets, and event storage.
- Rewriting your whole app in Rust to get those primitives is a non-starter.
- FFI bridges often mean type mismatches and hand-built native builds.
- napi-rs bindings
- openclaw-node exposes the Rust providers, credential store, event store, validation, config, and tool registry to Node.js.
- Pre-built binaries
- Ships pre-built binaries for Linux x64/arm64, macOS x64/arm64, and Windows x64 — npm install, no toolchain required.
- Shared types
- The Node SDK and the Rust core share types, so there is no impedance mismatch between the two layers.
You don’t have to rewrite a Node.js application in Rust to get Rust primitives
into it. openclaw-node uses napi-rs to expose the openclaw-rs core — the
provider clients, the AES-256-GCM credential store, the event store, validation,
config, and the tool registry — directly to Node.js, with pre-built binaries for
Linux x64/arm64, macOS x64/arm64, and Windows x64.
Because the Node SDK and the Rust core share types, there is no impedance mismatch: a provider call from Node hits the same code path as a provider call from Rust.
import { AnthropicProvider } from "openclaw-node";
const provider = new AnthropicProvider(process.env.ANTHROPIC_API_KEY);
const response = await provider.complete({
model: "claude-3-5-sonnet-20241022",
messages: [{ role: "user", content: "Hello!" }],
maxTokens: 1024,
});
That’s a Rust runtime doing the work, called from your existing Node app. See the napi-rs bindings deep dive for how the binding layer is built, or the providers page for the full provider matrix.
How it works, step by step
- 1 Install from npm
npm install openclaw-node pulls the pre-built binary for your platform.
- 2 Import a provider
import { AnthropicProvider } from "openclaw-node" and construct it with your API key.
- 3 Call complete()
Await provider.complete({ model, messages, maxTokens }) to run a completion from Node against the Rust core.
FAQ
- Do I need a Rust toolchain to use openclaw-node?
- No. openclaw-node ships pre-built binaries for Linux x64/arm64, macOS x64/arm64, and Windows x64 — a plain npm install is enough.
- What does openclaw-node expose?
- The Rust providers, credential store, event store, validation, config, and tool registry — with types shared between the Node SDK and the Rust core.