Skip to content

TypeScript SDK

Terminal window
npm install @runplex/sylo
import { SyloClient } from "@runplex/sylo";
const sylo = new SyloClient({
apiUrl: "https://sylo.runplex.dev",
developerSecret: process.env.SYLO_SECRET,
gatewayHost: "sylo.runplex.dev:8443", // optional, derived from apiUrl
});
OptionTypeRequiredDescription
apiUrlstringYesPlatform API URL
developerSecretstringYesDeveloper secret (sylo_sk_...)
gatewayHoststringNoGateway tunnel host (default: {apiUrl hostname}:8443)
fetchtypeof fetchNoCustom fetch implementation

Create a session with credentials, policies, and configuration.

const session = await sylo.createSandboxToken({
tenantId: "acme",
userId: "user_123",
expiresIn: "10m",
credentials: [
{
name: "openai",
envVar: "OPENAI_API_KEY",
domain: "api.openai.com",
header: "Authorization",
value: `Bearer ${process.env.OPENAI_API_KEY}`,
},
],
mitm: ["api.openai.com"],
passthrough: ["your-api.com"],
policies: {
default: "deny",
rules: [{ domain: "api.openai.com" }],
rateLimit: { "api.openai.com": "20/min" },
},
pii: { action: "redact", patterns: ["ssn", "credit_card"] },
limits: { maxRequests: 1000, maxDuration: "30m" },
shadowMode: false,
});
// Returns: { token: "sylo_stk_...", expiresAt: "2026-...", credentials: [...] }

Get environment variables for tunnel mode:

const env = sylo.sandboxEnv(session);
// {
// SYLO_TOKEN: "sylo_stk_...",
// SYLO_GATEWAY: "sylo.runplex.dev:8443",
// SYLO_GATEWAY_API: "https://sylo.runplex.dev",
// NODE_EXTRA_CA_CERTS: "/etc/sylo/ca.crt",
// SSL_CERT_FILE: "/etc/sylo/ca.crt",
// REQUESTS_CA_BUNDLE: "/etc/sylo/ca.crt",
// OPENAI_API_KEY: "sylo_cred:openai", // from credentials[].envVar
// }

Get environment variables for proxy mode:

const env = sylo.proxyEnv(session);
// {
// HTTPS_PROXY: "https://sylo_stk_...:x@sylo.runplex.dev:8443",
// HTTP_PROXY: "https://sylo_stk_...:x@sylo.runplex.dev:8443",
// ...same as sandboxEnv
// }

Immediately revoke a session:

await sylo.revokeSession("sylo_stk_...");
const { sessions, total } = await sylo.listSessions({
status: "active",
limit: 50,
offset: 0,
});
const { events, total } = await sylo.queryAudit({
tenantId: "acme",
destination: "api.openai.com",
policyDecision: "allow",
limit: 100,
offset: 0,
});
import { SyloError } from "@runplex/sylo";
try {
await sylo.createSandboxToken({ tenantId: "acme" });
} catch (err) {
if (err instanceof SyloError) {
console.error(err.status); // HTTP status
console.error(err.code); // "unauthorized", "invalid_request", etc.
console.error(err.message);
}
}