Skip to main content

Installation

Install the latest version of the Modal Go SDK:
go get -u github.com/modal-labs/modal-client/go
Import it in your Go application:
import modal "github.com/modal-labs/modal-client/go"
The Go SDK requires Go 1.23 or later.

Authentication

You need to authenticate with Modal before using the SDK. There are two ways to authenticate:
1
Using the Modal CLI
2
Install the Modal CLI and run the setup command:
3
pip install modal
modal setup
4
This creates a ~/.modal.toml file with your credentials.
5
Using environment variables
6
For machine environments (CI/CD, containers, etc.), set these environment variables:
7
export MODAL_TOKEN_ID=ak-YOUR_TOKEN_ID
export MODAL_TOKEN_SECRET=as-YOUR_TOKEN_SECRET
8
Replace the example values with your actual token credentials from modal.com/settings.

Package reference

The Go SDK is available at:

Module information

The Modal Go SDK uses the following module:
module github.com/modal-labs/modal-client/go

go 1.24.0

Telemetry and observability

The Modal Go SDK supports custom gRPC interceptors for telemetry, tracing, and observability. You can add custom unary and stream interceptors to:
  • Measure API call latency
  • Trace requests across your system
  • Integrate with observability tools like OpenTelemetry, DataDog, and others
See the telemetry example for implementation details.

Next steps

Now that you have the SDK installed and configured:

Build docs developers (and LLMs) love