QPI Python Client API Reference
qpi_client
QPI Client SDK for Python.
A client library for interacting with the QPI quantum computing platform. Provides both a low-level HTTP client and Qiskit-compatible backend/job classes.
Usage::
from qpi_client import QPIClient
# Low-level client
client = QPIClient("http://localhost:8090", api_token="my-token")
job_id = client.submit_job([{"circuit": "OPENQASM 3.0; ..."}])
# Qiskit integration (preferred)
backend = client.get_backend(name="mock")
job = backend.run(circuit=my_circuit, shots=1024)
result = job.result()
# Or submit raw QASM
job = backend.run(qasm="OPENQASM 3.0; ...", params=[[0.5]])
result = job.result()
# Retrieve a past job
past_job = client.job(job_id)
past_job = backend.job(job_id)
QPIBackend
Bases: BackendV2
A Qiskit BackendV2 that submits circuits to the QPI orchestrator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
QPIClient
|
An authenticated :class: |
required |
name
|
str
|
Human-readable backend name (default |
'qpi'
|
**kwargs
|
Any
|
Forwarded to :class: |
{}
|
Source code in qpi-client/py/qpi_client/provider.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
max_circuits
property
No server-side limit on the number of circuits per job.
target
property
Return the transpiler :class:Target for this backend.
job(job_id)
Retrieve an existing job by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The server-assigned job ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
QPIJob
|
class: |
Source code in qpi-client/py/qpi_client/provider.py
354 355 356 357 358 359 360 361 362 363 | |
run(circuit=None, qasm=None, shots=1024, meas_level=2, meas_return='single', parameter_values=None, **kwargs)
Submit a quantum job to QPI.
Exactly one of circuit or qasm must be provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
circuit
|
QuantumCircuit | Sequence[QuantumCircuit] | None
|
A single :class: |
None
|
qasm
|
str | None
|
A raw OpenQASM string (alternative to |
None
|
shots
|
int
|
Number of shots. |
1024
|
meas_level
|
int
|
Measurement level ( |
2
|
meas_return
|
str
|
|
'single'
|
parameter_values
|
list[list[float]] | list[dict[Any, float]] | None
|
Parameter bindings. For circuits this may be a
list of dicts mapping :class: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
QPIJob
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither or both of |
Source code in qpi-client/py/qpi_client/provider.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
QPIClient
Low-level HTTP wrapper for the QPI orchestrator API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Root URL of the QPI orchestrator (e.g. |
required |
api_token
|
str | None
|
Optional API token used for authentication via the
|
None
|
Source code in qpi-client/py/qpi_client/client.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
allocate_qpu_time(user_id, seconds)
Allocate QPU time to a user (admin-only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
ID of the user. |
required |
seconds
|
int
|
Total allocated seconds. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The updated user record dict. |
Source code in qpi-client/py/qpi_client/client.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
auth_with_password(identity, password)
Authenticate as a regular user using email/password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identity
|
str
|
Email or username. |
required |
password
|
str
|
User password. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The auth response payload including token and record. |
Source code in qpi-client/py/qpi_client/client.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
cancel_job(job_id)
Request cancellation of job_id.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The updated job-record dict. |
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the server returns a non-2xx status. |
Source code in qpi-client/py/qpi_client/client.py
112 113 114 115 116 117 118 119 120 121 122 123 | |
close()
Close the underlying HTTP session.
Source code in qpi-client/py/qpi_client/client.py
488 489 490 | |
connect_qpu(name, access_token, executor_type=None, device_config=None)
Connect a QPU driver node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
QPU name. |
required |
access_token
|
str
|
The access token for the QPU. |
required |
executor_type
|
str | None
|
Type of executor. |
None
|
device_config
|
dict[str, Any] | None
|
Configuration dict for the device. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The connection response dict with NNG port assignments. |
Source code in qpi-client/py/qpi_client/client.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
create_qpu(name, executor_type=None, num_qubits=None, enabled=None)
Create a new QPU record (admin-only).
The server generates a random access_token and returns it in
plain text exactly once; only the hash is persisted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
QPU name. |
required |
executor_type
|
str | None
|
Type of executor. |
None
|
num_qubits
|
int | None
|
Number of qubits on the device. |
None
|
enabled
|
bool | None
|
Whether the QPU should be enabled (default |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dict containing at least |
dict[str, Any]
|
|
Source code in qpi-client/py/qpi_client/client.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
create_time_request(seconds, requested_reason=None)
Create a new QPU time request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
int
|
Requested duration in seconds. |
required |
requested_reason
|
str | None
|
Optional explanation. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The created QPU time request record dict. |
Source code in qpi-client/py/qpi_client/client.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
create_time_slot(start_time, end_time, booked_by=None)
Create a new booking slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_time
|
str
|
Start time RFC3339 string. |
required |
end_time
|
str
|
End time RFC3339 string. |
required |
booked_by
|
str | None
|
Optional ID of the user booking the slot. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The created booking slot dict. |
Source code in qpi-client/py/qpi_client/client.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
delete_time_slot(slot_id)
Delete a booking slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_id
|
str
|
ID of the booking slot. |
required |
Source code in qpi-client/py/qpi_client/client.py
360 361 362 363 364 365 366 367 368 369 | |
dismiss_notification(notification_id)
Dismiss a notification for the authenticated user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notification_id
|
str
|
ID of the notification. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Response dict. |
Source code in qpi-client/py/qpi_client/client.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
get_backend(name='qpi')
Return a :class:QPIBackend handle for the named QPU.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Backend / QPU name (e.g. |
'qpi'
|
Returns:
| Type | Description |
|---|---|
'QPIBackend'
|
A configured :class: |
Source code in qpi-client/py/qpi_client/client.py
127 128 129 130 131 132 133 134 135 136 137 138 | |
get_job(job_id)
Retrieve full details for job_id.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dict with at least |
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the server returns a non-2xx status. |
Source code in qpi-client/py/qpi_client/client.py
81 82 83 84 85 86 87 88 89 90 91 92 93 | |
get_qpu(name)
Retrieve a single QPU by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The QPU's unique name. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A QPU record dict. |
Source code in qpi-client/py/qpi_client/client.py
165 166 167 168 169 170 171 172 173 174 175 176 | |
job(job_id)
Retrieve an existing job by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The server-assigned job ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
'QPIJob'
|
class: |
Source code in qpi-client/py/qpi_client/client.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
list_jobs()
List all jobs belonging to the authenticated user.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of job-record dicts. |
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the server returns a non-2xx status. |
Source code in qpi-client/py/qpi_client/client.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
list_notifications()
List notifications visible to the authenticated user.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of notification record dicts. |
Source code in qpi-client/py/qpi_client/client.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
list_qpus()
List all online QPUs.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of QPU record dicts. |
Source code in qpi-client/py/qpi_client/client.py
155 156 157 158 159 160 161 162 163 | |
list_time_requests()
List QPU time requests.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of QPU time request record dicts. |
Source code in qpi-client/py/qpi_client/client.py
373 374 375 376 377 378 379 380 381 382 383 384 | |
list_time_slots()
List all booking slots.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of booking slot record dicts. |
Source code in qpi-client/py/qpi_client/client.py
296 297 298 299 300 301 302 303 304 305 | |
list_users()
List all registered users (admin-only).
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of user record dicts. |
Source code in qpi-client/py/qpi_client/client.py
435 436 437 438 439 440 441 442 443 444 | |
submit_job(circuits, shots=1024, meas_level=2, meas_return='single', qpu_target='')
Submit a quantum job to the orchestrator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
circuits
|
list[dict[str, Any]]
|
A list of circuit payload dicts. Each dict must
contain a |
required |
shots
|
int
|
Default number of shots for every circuit. |
1024
|
meas_level
|
int
|
Measurement level ( |
2
|
meas_return
|
str
|
|
'single'
|
qpu_target
|
str
|
Optional QPU routing hint. |
''
|
Returns:
| Type | Description |
|---|---|
str
|
The server-assigned job ID as a string. |
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the server returns a non-2xx status. |
Source code in qpi-client/py/qpi_client/client.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
toggle_qpu(qpu_id, enabled)
Toggle QPU driver state (admin-only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpu_id
|
str
|
ID of the QPU. |
required |
enabled
|
bool
|
Whether the QPU should be enabled. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Response dict. |
Source code in qpi-client/py/qpi_client/client.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
update_time_request(request_id, status, rejection_reason=None)
Update/Handle a QPU time request (admin-only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_id
|
str
|
ID of the time request. |
required |
status
|
str
|
"approved" or "rejected". |
required |
rejection_reason
|
str | None
|
Optional explanation if rejected. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The updated request record dict. |
Source code in qpi-client/py/qpi_client/client.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
update_time_slot(slot_id, start_time=None, end_time=None)
Update an existing booking slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_id
|
str
|
ID of the booking slot. |
required |
start_time
|
str | None
|
Optional start time RFC3339 string. |
None
|
end_time
|
str | None
|
Optional end time RFC3339 string. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The updated booking slot dict. |
Source code in qpi-client/py/qpi_client/client.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
QPIJob
Bases: JobV1
A Qiskit-compatible job handle backed by the QPI REST API.
Instances are created by :meth:QPIBackend.run or :meth:QPIClient.job;
you should not need to instantiate this class directly.
Source code in qpi-client/py/qpi_client/provider.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
id
property
Server-assigned job ID.
cancel()
Request cancellation of this job on the server.
Source code in qpi-client/py/qpi_client/provider.py
130 131 132 | |
result(timeout=None, wait=5.0)
Block until the job completes and return a :class:qiskit.result.Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | None
|
Maximum seconds to wait. None means wait indefinitely. |
None
|
wait
|
float
|
Polling interval in seconds. |
5.0
|
Returns:
| Type | Description |
|---|---|
Result
|
A Qiskit :class: |
Result
|
(optionally) memory from the QPI server response. |
Raises:
| Type | Description |
|---|---|
TimeoutError
|
If the job does not finish within timeout seconds. |
RuntimeError
|
If the job fails or is cancelled on the server. |
Source code in qpi-client/py/qpi_client/provider.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
status()
Return the current server-side status of the job.
Source code in qpi-client/py/qpi_client/provider.py
117 118 119 120 121 122 123 124 125 126 127 128 | |
submit()
No-op — the job was already submitted by the backend.
Source code in qpi-client/py/qpi_client/provider.py
67 68 | |