Configuring Access to Leap’s Solvers

D-Wave’s Solver API (SAPI) provides access to the solvers—compute resources for solving problems, such as a D-Wave quantum computers and quantum-classical hybrid solvers—hosted in the Leap quantum cloud.1


SAPI is used similarly for on-premises systems. Differences for such systems are noted below.

This page provides the following information:

Interacting with SAPI

SAPI is an application layer that provides resource discovery, permissions, and scheduling for D-Wave solvers. Problem submission through SAPI requires the following information, typically provided by your work environment from either Ocean’s default values or your configuration.

  • API Token (required)

    An authentication token used to authenticate the client session when you connect to the remote environment.

  • Solver (default: feature-based selection)

    A D-Wave resource to be used to solve your submitted problems; for example, a quantum-classical hybrid solver or an Advantage quantum computer.

  • Region/Endpoint (default: North American URL)

    A URL for a region’s remote resources.

    By default, Ocean connects to North American (region na-west-1) Leap quantum cloud resources at URL

    For information about using solvers in alternative geographical regions, see the Accessing Solvers in Multiple Regions section below.

Create a Configuration File

The simplest way to configure solver access is to use the interactive CLI, which is installed as part of the dwave-ocean-sdk installation.

If you did not already do so with the dwave setup command in the Set Up Your Environment section, or want to make changes at a later time, you can use the dwave config command.

$ dwave config --help
Usage: dwave config [OPTIONS] COMMAND [ARGS]...

Create, update or inspect cloud client configuration file(s).

  --help  Show this message and exit.

  create   Create and/or update cloud client configuration file.
  inspect  Inspect existing configuration/profile.
  ls       List configuration files detected (and/or examined paths).

Creating a configuration file using the dwave config is done as follows (the dwave setup command of the Set Up Your Environment section runs these same configuration steps):

  1. In the virtual environment you created as part of Installing Ocean Tools, run the dwave config create command2 (the output shown below includes the interactive prompts and placeholder replies).

$ dwave config create --auto-token
Using the simplified configuration flow.
Try 'dwave config create --full' for more options.

Creating new configuration file: /home/jane/.config/dwave/dwave.conf
Updating existing profile: defaults
Access token expired (or expires soon), refreshing it.
Fetched SAPI token for project 'ABC' (ABC) from Leap API.
Configuration saved.

You can use the --auto-token option if you have authorized Leap access.

  1. If needed, enter SAPI information (e.g. your API token) found as described in the Interacting with SAPI section above. To get started, create a minimum configuration by accepting the command’s defaults (pressing Enter) for all prompts3. You can in the future update the file if needed.


Users of on-premises systems should also enter the SAPI endpoint. Users interested in using solvers hosted outside their default region can also configure the SAPI endpoint (see the Accessing Solvers in Multiple Regions section for the recommended way of configuring such access).

Alternatively, you can create and edit a D-Wave Cloud Client configuration file manually.

You can always set or override your configurations in your code or with environment variables. For more information, see the examples in this document or D-Wave Cloud Client.

Verify Your Configuration

You can test that your solver access is configured correctly with the interactive CLI.

  1. In your virtual environment, run the dwave ping command (the output shown below is illustrative only).

The example below, for a Bash Unix shell, pings only QPU solvers.

$ dwave ping --client qpu
Using endpoint:
Using solver: DW_2000Q_6
Submitted problem ID: 34f773f7-77dc-7fa5-a7d5-7e397d90fc4a

Wall clock time:
 * Solver definition fetch: 1888.499 ms
 * Problem submit and results fetch: 1038.042 ms
 * Total: 2926.541 ms

QPU timing:
 * post_processing_overhead_time = 307.0 us
 * qpu_access_overhead_time = 1185.96 us
 * qpu_access_time = 10995.04 us
 * qpu_anneal_time_per_sample = 20.0 us
 * qpu_delay_time_per_sample = 20.54 us
 * qpu_programming_time = 10756.1 us
 * qpu_readout_time_per_sample = 198.4 us
 * qpu_sampling_time = 238.94 us
 * total_post_processing_time = 307.0 us
  1. Optionally, run the dwave sample --random-problem command to submit a random problem to a remote solver (the output shown below is illustrative only).

$ dwave sample --random-problem
Using endpoint: https://my.dwavesys.url/
Using solver: My_DWAVE_2000Q
Using qubit biases: {0: -1.0345257941434953, 1: -0.5795618633919246, 2: 0.9721956399428491, 3: 1....
Using qubit couplings: {(1634, 1638): 0.721736584181423, (587, 590): 0.9611623181258304, (642, 64...
Number of samples: 1
Samples: [[1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1,...
Occurrences: [1]
Energies: [-2882.197791239335]

Accessing Solvers in Multiple Regions

Leap quantum cloud service is distributed across multiple geographic regions. You can see the supported regions and the solvers available in each for your account in your Leap dashboard. Ocean’s dwave-cloud-client enables you to select solvers from a particular region using one or more of the following options:

  • Select a default region in your dwave-cloud-client configuration file. You can run the dwave config CLI command with the --full option or edit an existing configuration file to set a preferred region.

  • Set the appropriate environment variable (for example, export DWAVE_API_REGION=eu-central-1 in a Unix shell) for your current terminal or working session to select solvers from a preferred region.

  • Explicitly select the region in your code. For example, the region parameter in the code line sampler = DWaveSampler(region="na-west-1") selects a D-Wave quantum computer located in North America.


Keep in mind the relative priorities of configurations set at various levels (in the above bullets, the configuration file, environment variables, and explicit parameters in your code), as described in the dwave-cloud-client documentation. For example, while the setting of both an endpoint and region on the same level (either two lines in the configuration file or two environment variables or two explicit parameters) results in selection based on the endpoint, setting a region explicitly overrides an endpoint configured using an environment variable or in the configuration file.

Example: Viewing a Region’s Solvers

You can use interactive CLI to query solvers in a particular region.

$ dwave solvers --list --region eu-central-1

Example: Using Configuration-File Profiles for Multiple Regions

You can set up your configuration file with profiles for multiple regions, as shown below.

token = ABC-123456789123456789123456789

region = eu-central-1

You can then set the profile when instantiating a sampler, as below.

>>> from dwave.system import DWaveSampler, EmbeddingComposite
>>> sampler = EmbeddingComposite(DWaveSampler(profile="europe"))