Use this file to discover all available pages before exploring further.
The OneCLI Node.js SDK provides a programmatic interface for configuring Docker containers to route through the OneCLI gateway, so containerized agents can access external APIs without exposing credentials.
import { OneCLI } from "@onecli-sh/sdk";// Automatically reads from ONECLI_API_KEY (and ONECLI_URL if set)const onecli = new OneCLI();const active = await onecli.applyContainerConfig(args);
Organization-level API keys (oc_org_...) grant access across all projects in an org. Pass a projectId to specify which project to target.
import { OneCLI } from "@onecli-sh/sdk";// Set a default project for all operationsconst onecli = new OneCLI({ apiKey: "oc_org_your_org_key", projectId: "proj-123",});await onecli.createAgent({ name: "Bot", identifier: "bot" });// Override the project for a specific operationawait onecli.createAgent( { name: "Bot", identifier: "bot" }, { projectId: "proj-456" },);
The projectId can also be set via the ONECLI_PROJECT_ID environment variable. Per-operation overrides always take precedence over the constructor default.
Placeholder user ID (becomes the real user after claim)
projectId
string
Pre-created project ID
apiKey
string
API key for the provisioned project (usable immediately)
claimUrl
string
URL the user visits to claim the account
expiresAt
string
Expiration timestamp (ISO 8601)
ThrowsOneCLIError if called against an OSS instance. ThrowsOneCLIRequestError with status 403 if the API key doesn’t belong to an admin/owner.See the User Provisioning guide for the full workflow.
Register a callback that’s invoked whenever an agent request needs human approval. Starts background long-polling to the gateway. Returns a handle to stop polling.
const handle = onecli.configureManualApproval(async (request) => { console.log(`${request.method} ${request.url}`); console.log(`Agent: ${request.agent.name}`); if (request.bodyPreview) { console.log(`Body: ${request.bodyPreview}`); } // Return 'approve' to forward the request, 'deny' to block it return "approve";});// Stop polling on shutdownprocess.on("SIGTERM", () => handle.stop());
The callback is called once per pending approval. Multiple approvals are handled concurrently, and each callback runs independently without blocking the others.If the callback throws or the decision fails to submit, the same request is retried on the next poll cycle.Callback parameter: ApprovalRequest
Manual approval requires a policy rule with the Manual Approval action configured in the dashboard. Without a matching rule, no requests are held for approval.
OneCLI runs on the host machine and acts as a gateway for containerized agents. When a container makes HTTPS requests to intercepted domains (e.g. api.anthropic.com), OneCLI:
Terminates TLS using a local CA certificate
Inspects the request and injects real credentials (replacing placeholder tokens)
Forwards the request to the upstream service
Returns the response to the container
Containers never see real API keys. They only have placeholder tokens that OneCLI swaps out transparently.The SDK configures containers with the right environment variables (HTTPS_PROXY, HTTP_PROXY) and CA certificate mounts so this works automatically.