Skip to main content

Quantum API Python SDK

Package-ready sync Python client for the Quantum API /v1 contract.

This SDK targets scripts, CLIs, service integrations, and backend-side automation. It keeps a sync httpx client as the default public surface and supports context-manager usage.

Current Scope

  • Full current /v1 method surface
  • Mounted base URL normalization:
    • http://127.0.0.1:8000 -> http://127.0.0.1:8000/v1
    • https://example.com/public-facing/api/quantum -> https://example.com/public-facing/api/quantum/v1
    • https://example.com/public-facing/api/quantum/v1 stays unchanged
  • Auth support for:
    • X-API-Key runtime endpoints
    • bearer-token /keys* and /ibm/profiles* flows
    • per-call auth override
  • Structured QuantumApiError

Install

pip install quantum-api-sdk

For local development in this repo:

python3 -m pip install -e sdk/python

Basic Usage

from quantum_api_sdk import QuantumApiClient, QuantumApiError

with QuantumApiClient(
    base_url="http://127.0.0.1:8000",
    api_key="your-runtime-key",
    bearer_token="your-supabase-jwt",
) as client:
    try:
        health = client.health()
        gate = client.run_gate({"gate_type": "rotation", "rotation_angle_rad": 1.57079632679})
        print(health["status"], gate["measurement"])
    except QuantumApiError as exc:
        print(exc.status_code, exc.code, exc.request_id, exc.details)

Auth Modes

The client defaults to auto auth mode:

  • health and portfolio.json -> public
  • /keys* and /ibm/profiles* -> bearer token
  • all other /v1 routes -> API key

Per-call override examples:

client.health(auth="none")
client.echo_types(auth="api_key")
client.list_keys(auth="bearer")

Account Setup (Public Identerest Sign-In)

If you are using the hosted Quantum API account flow (not self-hosting), credentials come from signing in at https://davidjgrimsley.com/public-facing/api/quantum.

  1. Open https://davidjgrimsley.com/public-facing/api/quantum and sign in with an Identerest account.
  2. In the Api Keys panel, create a Quantum API key and copy it immediately (raw key is shown once).
  3. In the IBM Credentials panel, create an IBM profile (profile_name, IBM API token, IBM instance/CRN, channel), then verify it.
  4. Optionally set one IBM profile as default on that same public page.

How those values map into the SDK:

  • bearer token from that Identerest-backed sign-in session -> bearer_token (used for /keys* and /ibm/profiles*).
  • created Quantum API key -> api_key (used for protected runtime /v1 routes).
  • selected IBM profile name -> ibm_profile in IBM backend/transpile/job requests.

IBM Profiles (Per-User IBM Credentials)

This is the flow behind profile cards/actions like Verify, Set Default, Edit, and Delete.

The Python SDK exposes full profile lifecycle methods:

  • list_ibm_profiles()
  • create_ibm_profile(payload)
  • update_ibm_profile(profile_id, payload)
  • verify_ibm_profile(profile_id)
  • delete_ibm_profile(profile_id)

Profile routes use bearer auth, so pass the bearer token issued after signing in at https://davidjgrimsley.com/public-facing/api/quantum with Identerest.

from quantum_api_sdk import QuantumApiClient

with QuantumApiClient(
  base_url="https://davidjgrimsley.com/public-facing/api/quantum",
  bearer_token=user_access_token,
) as client:
  created = client.create_ibm_profile(
    {
      "profile_name": "Echo Text Adventure Godot Game",
      "token": "your-ibm-token",
      "instance": "crn:v1:bluemix:public:quantum-computing:us-east:a/1234567890abcdef::",
      "channel": "ibm_quantum_platform",
      "is_default": True,
    }
  )

  verify_result = client.verify_ibm_profile(created["profile_id"])
  profiles = client.list_ibm_profiles()

  client.update_ibm_profile(
    created["profile_id"],
    {
      "profile_name": "Echo Text Adventure Godot Game (Prod)",
      "is_default": True,
    },
  )

  # Later, if needed:
  # client.delete_ibm_profile(created["profile_id"])

When you submit IBM jobs, pass ibm_profile as the selected saved profile name. If omitted, the backend can use the default profile.

job = client.submit_circuit_job(
  {
    "provider": "ibm",
    "backend_name": "ibm_brisbane",
    "ibm_profile": created["profile_name"],
    "circuit": {
      "qubits": 1,
      "operations": [{"gate": "h", "target": 0}],
    },
    "shots": 1024,
  }
)

For shipped production clients, keep IBM tokens server-side and run profile create/update/delete through your backend proxy.

Production Recommendation

For distributed apps and games, prefer a backend-proxy flow so secrets are not embedded in shipped clients. Direct API-key usage is best kept for local, prototype, demo workflows, or game jams.

Method Surface

  • Core:
    • health
    • portfolio
    • echo_types
    • run_gate
    • run_circuit
    • transform_text
  • Runtime:
    • list_backends
    • transpile
    • import_qasm
    • export_qasm
    • run_qasm
  • Auth:
    • list_keys
    • create_key
    • revoke_key
    • rotate_key
    • delete_revoked_keys
    • delete_key
    • list_ibm_profiles
    • create_ibm_profile
    • update_ibm_profile
    • delete_ibm_profile
    • verify_ibm_profile
  • Jobs:
    • submit_circuit_job
    • submit_qasm_job
    • get_circuit_job
    • get_circuit_job_result
    • cancel_circuit_job
  • Domains:
    • grover_search
    • amplitude_estimation
    • phase_estimation
    • time_evolution
    • qaoa
    • vqe
    • maxcut
    • knapsack
    • tsp
    • state_tomography
    • randomized_benchmarking
    • quantum_volume
    • t1
    • t2_ramsey
    • portfolio_optimization
    • portfolio_diversification
    • kernel_classifier
    • vqc_classifier
    • qsvr_regressor
    • ground_state_energy
    • fermionic_mapping_preview

Verification

The broader repo environment may not have uv or test dependencies installed. If you are validating the SDK locally, install the package first and then run your preferred build/test flow.

Metadata

Release files for quantum-api-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quantum-api-sdk 0.1.0
File Size Uploaded Provenance Actions
quantum_api_sdk-0.1.0.tar.gz 8.5 kB With provenance Details for quantum_api_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quantum-api-sdk 0.1.0
File Interpreter ABI Platform Actions
quantum_api_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for quantum_api_sdk-0.1.0-py3-none-any.whl

Total release size: 18.3 kB

Release files / quantum_api_sdk-0.1.0.tar.gz

Download URL quantum_api_sdk-0.1.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66ef58a7e447f1ce3c5a75c1a5de8f110cbf9b0d6539cbc14385d9e763487562
BLAKE2b-256 checksum
How to use checksums
09c39d9c828bef3f9512b26074a7956d1737d6ef2ed3ec67ea998bda6c4b51b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release files / quantum_api_sdk-0.1.0-py3-none-any.whl

Download URL quantum_api_sdk-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7003cd59433a0a4dd412b28f1353e285fc215f19e292b5b18ba19ebe07218bdc
BLAKE2b-256 checksum
How to use checksums
70792fb4defdc844c7210da90fdaa26b66ec876d7bbd42763b5c0c991bfc1278
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Security for quantum-api-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quantum_api_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page