Infery.ai
← All tools

Run Node.js code

Code

code.run_node

in: anyout: text

Execute Node.js in a sandboxed runtime.

Pricing

Price
6.25 cr / second

Prices in credits (1 credit = $0.01).

Run Node.js Code

Execute a Node.js snippet in an isolated sandbox and return the value of result.

When to use

  • JSON manipulation — parse, transform, or validate JSON payloads with native JS tooling.
  • String processing — use regex, template literals, or Buffer operations.
  • Lightweight scripting — run any logic that benefits from the Node.js standard library.

Inputs & outputs

Input modalityAny (named variable bindings via vars)
Output modalityText / JSON (the value of result after execution)
Max source length50 000 characters
Max timeout30 seconds

Parameters

ParamRequiredDescription
sourceyesNode.js source code (1–50 000 chars). Must assign to result.
timeout_secondsnoExecution time limit in seconds (1–30). Default: 5

Input

FieldDescription
varsDictionary of named bindings injected as local variables before execution. Values can be any JSON-serialisable type.

Examples

Simple arithmetic

{
  "type": "code.run_node",
  "input": { "vars": {} },
  "params": { "source": "result = 1 + 1", "timeout_seconds": 5 }
}

Transform an array with input variables

{
  "type": "code.run_node",
  "input": { "vars": { "items": ["foo", "bar", "baz"] } },
  "params": { "source": "result = items.map(s => s.toUpperCase()).join(', ')", "timeout_seconds": 5 }
}

Pricing

Billed per second of sandbox execution time (rounded up to the nearest second). See pricing dashboard for current rates.

Related capabilities

  • code.run_python — execute Python code in a sandbox
  • web.search — retrieve live data to process with this capability

Examples

Inline add

{
  "source": "result = 1 + 1",
  "timeout_seconds": 5
}