---
url: /tutorials/tutorial-qiskit-with-platform-sdk.md
description: >-
  Use HubQiskitProvider from the Quantum SDK to list backends and execute Qiskit
  circuits on quantum hardware and simulators.
---

# Execute Qiskit Circuits using the Quantum SDK

This tutorial describes how you can use the Quantum SDK to execute your Qiskit code on different quantum backends supported by the platform.
The SDK is a wrapper for Qiskit 2.2.
Hence, it provides the same functionality and syntax as the original Qiskit SDK.

You can use the SDK either directly from your favorite IDE or in a [service](../services/managed/introduction).

## Install the Quantum SDK

To install the Quantum SDK you need to have Python 3.11 or higher installed.
The package is released on PyPI and can be installed via `pip`:

```bash
pip install qhub-quantum
```

## Create an Access Token

To access the quantum backends from your Qiskit code you need to have a valid Kipu Quantum Hub account and a quantum access token.
This token is used to authenticate your requests to the platform and to track the usage costs of your quantum executions.

Log in to [Kipu Quantum Hub](https://dashboard.hub.kipu-quantum.com/home) and copy your personal access token to the clipboard.
Optionally, you may create a dedicated access token in your user [settings](https://dashboard.hub.kipu-quantum.com/settings/access-tokens) that you can use for your Qiskit code.

Copy your new token and store it in a safe place.

## Backend Selection and Execution

In your Qiskit code you can access the Kipu Quantum Hub quantum backends through the `HubQiskitProvider` object.
You need to import this object and pass your access token to it, as shown in the example below.

```python
from qhub.quantum.sdk import HubQiskitProvider

# set your access token
token = "YOUR_ACCESS_TOKEN"
provider = HubQiskitProvider(access_token=token)
```

::: tip NOTE
If your Qiskit code is executed in a service, the access token is automatically set by the platform.
In this case the `access_token` parameter can be omitted.
If it is set it is replaced by the service token.
:::

After you have created the provider object you can list all backends supported by the platform and select the one you want to use, e.g., the `azure.ionq.simulator` backend:

```python
# list all available quantum backends
backends = qhub_provider.backends()

# select certain backend
backend = provider.get_backend("azure.ionq.simulator")
```

Now you can execute your Qiskit circuit on the selected backend, retrieve its `job` object, retrieve its results, cancel it etc.

```python
from qiskit import QuantumCircuit, transpile

# create a qiskit circuit
circuit = QuantumCircuit(3, 3)
circuit.h(0)
circuit.cx(0, 1)
circuit.cx(1, 2)
circuit.measure(range(3), range(3))

# transpile circuit for backend
circuit = transpile(circuit, backend)

# execute circuit on selected backend
job = backend.run(circuit, shots=1000)
```

::: tip NOTE
Executing your Qiskit code on the platform may lead to execution costs depending on selected backend and number of shots.
Please find an overview about the costs for each backend on [our pricing page](https://kipu-quantum.com/platform/pricing/).
:::
