Python Library

You can use our Python API Client to call API endpoints.

Our Python API Client is available via pip, with source code on Github:

pip install sigopt

Sign up for an account at In order to use the API, you’ll need your SIGOPT_API_TOKEN from your user dashboard. Then, use your client token to instantiate a SigOpt Connection object:

# Pass your API token directly, overriding any environment variables
from sigopt import Connection
conn = Connection(client_token=SIGOPT_API_TOKEN)


If you are connecting to SigOpt behind a proxy, you may need to set environment variables. Here are some example values:

os.environ['HTTP_PROXY'] = ''
os.environ['HTTPS_PROXY'] = 'http://user:[email protected]:1080'

See the documentation for the requests module for more information.

Run Some Code

Now, you can run SigOpt's Optimization Loop.

First, setup the experiment:

# Run `pip install sigopt` to download the python API client
from sigopt import Connection
from sigopt.examples import franke_function

conn = Connection(client_token=SIGOPT_API_TOKEN)

experiment = conn.experiments().create(
    name='Franke Optimization (Python)',
        dict(name='x', type='double', bounds=dict(min=0.0, max=1.0)),
        dict(name='y', type='double', bounds=dict(min=0.0, max=1.0)),
print("Created experiment:" +

Then, run the optimization loop itself:

# Evaluate your model with the suggested parameter assignments
# Franke function -
def evaluate_model(assignments):
    return franke_function(assignments['x'], assignments['y'])

# Run the Optimization Loop between 10x - 20x the number of parameters
for _ in range(30):
    suggestion = conn.experiments(
    value = evaluate_model(suggestion.assignments)

Run More Code: Tune a Random Forest

Learn how to Tune a Random Forest using SigOpt's Python API Client. We even have an easy-to-follow notebook format! This simple example uses an open source machine learning library and can be extended to tune the hyperparameters of any machine learning model.

More Examples

To see more examples of how to use Sigopt and Python to tune machine learning models and more, clone our Github examples repository:

git clone


The SigOpt Python API Client returns Python objects. Here is an example where we fetch an experiment and print the name:

experiment = conn.experiments(experiment_id).fetch()

You can also refer to our complete API Object Reference.


Please refer to our complete API Endpoint Reference. Each page has a tab where you can view how to construct the endpoint call in Python. You can refer to the above section on objects for more information about the return type of the Python API Client calls.