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
/v1method surface - Mounted base URL normalization:
http://127.0.0.1:8000->http://127.0.0.1:8000/v1https://example.com/public-facing/api/quantum->https://example.com/public-facing/api/quantum/v1https://example.com/public-facing/api/quantum/v1stays unchanged
- Auth support for:
X-API-Keyruntime 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:
healthandportfolio.json-> public/keys*and/ibm/profiles*-> bearer token- all other
/v1routes -> 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.
- Open
https://davidjgrimsley.com/public-facing/api/quantumand sign in with an Identerest account. - In the
Api Keyspanel, create a Quantum API key and copy it immediately (raw key is shown once). - In the
IBM Credentialspanel, create an IBM profile (profile_name, IBM API token, IBM instance/CRN, channel), then verify it. - 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/v1routes). - selected IBM profile name ->
ibm_profilein 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:
healthportfolioecho_typesrun_gaterun_circuittransform_text
- Runtime:
list_backendstranspileimport_qasmexport_qasmrun_qasm
- Auth:
list_keyscreate_keyrevoke_keyrotate_keydelete_revoked_keysdelete_keylist_ibm_profilescreate_ibm_profileupdate_ibm_profiledelete_ibm_profileverify_ibm_profile
- Jobs:
submit_circuit_jobsubmit_qasm_jobget_circuit_jobget_circuit_job_resultcancel_circuit_job
- Domains:
grover_searchamplitude_estimationphase_estimationtime_evolutionqaoavqemaxcutknapsacktspstate_tomographyrandomized_benchmarkingquantum_volumet1t2_ramseyportfolio_optimizationportfolio_diversificationkernel_classifiervqc_classifierqsvr_regressorground_state_energyfermionic_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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.