Skip to main content

Use Custom HTTP Clients

Speakeasy-managed SDKs will by default use an Axios HTTP Client instance created at runtime. However you may want to use a custom HTTP Client in order to use a proxy, enable custom telemetry, or use pre-configured global headers or additional configuration.

This can be done by providing a custom client when the SDK is initialized.

See below for per language examples:

The Go SDK will accept a client that provides the same interface as the standard library's http.Client

// Your custom HTTP Client
c := &http.Client{}

opts := []sdk.SDKOption{

s := sdk.New(opts)

The Python SDK will accept a client from the requests package:

s = sdk.SDK()

# Your custom HTTP Client
client = requests.Session()


The Typescript SDK will accept a client from the axios package:

// Your custom HTTP Client
const client = axios.create();

const opts = [WithClient(client)];

const s = new SDK(opts);

The Java SDK will accept a client that implements the HTTPClient interface in the utils package. This will wrap a instance and the call to send.

// Your custom HTTP Client
YouHttpClient client = new YourHttpClient();

SDK.Builder builder = SDK.builder();


SDK sdk =;