Creating a client
NewClient
Creates a new Modal client with default configuration from environment variables and~/.modal.toml.
*Client- The Modal client instanceerror- Error if initialization fails
NewClientWithOptions
Creates a new Modal client with custom configuration.Client configuration parameters
Modal token ID (overrides config file)
Modal token secret (overrides config file)
Environment name (e.g., “main”, “dev”)
Custom config object (advanced usage)
Custom logger instance
Custom gRPC client for testing
Underlying gRPC connection for ControlPlaneClient
Custom gRPC unary interceptors for telemetry and observability
Custom gRPC stream interceptors for telemetry and observability
*Client- The Modal client instanceerror- Error if initialization fails
Client methods
Close
Closes all gRPC connections. Should be called when done using the client.Version
Returns the SDK version.string- The SDK version string
Client services
The client exposes the following services for interacting with Modal resources:Service for mounting cloud storage buckets.
Service for working with Modal Functions. See Functions API.
Service for working with Function Calls.
Service for working with Modal Images. See Images API.
Service for working with Modal Proxies.
Service for working with Modal Queues. See Queues API.
Service for working with Modal Sandboxes. See Sandboxes API.
Service for working with Modal Secrets. See Secrets API.
Service for working with Modal Volumes. See Volumes API.