包详细信息

modal

modal-labs109.1kApache-2.00.5.0

Modal SDK for JavaScript/TypeScript

自述文件

Modal JavaScript SDK

Build Status JS Reference Documentation npm Version npm Downloads

The Modal JavaScript SDK provides convenient, on-demand access to serverless cloud compute on Modal from JS/TS projects. Use it to safely run arbitrary code in Modal Sandboxes, call Modal Functions, and interact with Modal resources.

It comes with built-in TypeScript type definitions.

We're approaching feature parity with the main Modal Python SDK, although defining Modal Functions will likely remain exclusive to Python.

Installation

Install this in any server-side Node.js / Deno / Bun project.

npm install modal

npm package: https://www.npmjs.com/package/modal

Requirements

Node 22 or later. We bundle both ES Modules and CommonJS formats, so you can load the package with either import or require() in any project.

Documentation

See the main Modal documentation and user guides for high-level overviews. For details, see the API reference documentation for for JS.

We also provide a number of examples:

Authenticating with Modal

You also need to authenticate with Modal (see Getting started). Either sign in with the Modal CLI using pip install modal && modal setup, or in machine environments set these environment variables:

# Replace these with your actual token!
export MODAL_TOKEN_ID=ak-NOTAREALTOKENSTRINGXYZ
export MODAL_TOKEN_SECRET=as-FAKESECRETSTRINGABCDEF

Support

For usage questions and other support, please reach out on the Modal Community Slack.