TypeScript SDK
Use the TypeScript SDK in Node.js applications and automation. It provides a curated sandbox API and a raw generated client for the full gateway RPC surface. Use the SDK and gateway from the same OpenShell release when possible.
Install the SDK
The package requires Node.js 20.3 or later and is currently distributed through
GitHub Packages. Configure the @nvidia scope in your project .npmrc:
Authenticate npm with a GitHub token that has read:packages, then install the
package:
Connect to a Gateway
OpenShellClient.connect() accepts a gateway URL. It constructs a lazy client,
so call health() when startup must verify connectivity:
For long-running OIDC service automation, use a renewable client-credentials provider:
The provider retains credentials and tokens in memory and renews the access token before expiry.
Create and Use a Sandbox
The curated client uses the default workspace unless you pass workspace in
an operation’s options:
client.sandbox also supports streaming and interactive exec, TCP forwarding,
SSH sessions, sandbox provider attachment, configuration, and policy. Close
operation-scoped streams and forwarding handles when finished. The root client
does not retain a dedicated session and has no close() method.
Use the Raw Client
Use client.raw for RPCs that the curated clients do not yet wrap. Import
generated message schemas and types from @nvidia/openshell-sdk/raw. Raw calls
return protobuf wire shapes, while curated calls return SDK-specific types.
Next Steps
- Review Gateway Authentication for OIDC and service authentication.
- Review API Errors for structured error handling.
- See the TypeScript SDK source documentation for streaming, forwarding, and raw client examples.