Package-ready Python client for the Quantum API /v1 contract
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantum_api_sdk-0.1.0.tar.gz.
File metadata
- Download URL: quantum_api_sdk-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66ef58a7e447f1ce3c5a75c1a5de8f110cbf9b0d6539cbc14385d9e763487562
|
|
| MD5 |
e95701935946c0462c3742d76921d3a6
|
|
| BLAKE2b-256 |
09c39d9c828bef3f9512b26074a7956d1737d6ef2ed3ec67ea998bda6c4b51b6
|
Provenance
The following attestation bundles were made for quantum_api_sdk-0.1.0.tar.gz:
Publisher:
publish-sdk.yml on DavidJGrimsley/quantum-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantum_api_sdk-0.1.0.tar.gz -
Subject digest:
66ef58a7e447f1ce3c5a75c1a5de8f110cbf9b0d6539cbc14385d9e763487562 - Sigstore transparency entry: 1256443511
- Sigstore integration time:
-
Permalink:
DavidJGrimsley/quantum-api@91413abc6d0161b9a1ee3df9c2ff1324251c1c34 -
Branch / Tag:
refs/tags/sdk-v2026.04.08.1 - Owner: https://github.com/DavidJGrimsley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@91413abc6d0161b9a1ee3df9c2ff1324251c1c34 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quantum_api_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quantum_api_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7003cd59433a0a4dd412b28f1353e285fc215f19e292b5b18ba19ebe07218bdc
|
|
| MD5 |
7afb8ee7469b5517c1ed6269b2b0dc24
|
|
| BLAKE2b-256 |
70792fb4defdc844c7210da90fdaa26b66ec876d7bbd42763b5c0c991bfc1278
|
Provenance
The following attestation bundles were made for quantum_api_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-sdk.yml on DavidJGrimsley/quantum-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantum_api_sdk-0.1.0-py3-none-any.whl -
Subject digest:
7003cd59433a0a4dd412b28f1353e285fc215f19e292b5b18ba19ebe07218bdc - Sigstore transparency entry: 1256443600
- Sigstore integration time:
-
Permalink:
DavidJGrimsley/quantum-api@91413abc6d0161b9a1ee3df9c2ff1324251c1c34 -
Branch / Tag:
refs/tags/sdk-v2026.04.08.1 - Owner: https://github.com/DavidJGrimsley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@91413abc6d0161b9a1ee3df9c2ff1324251c1c34 -
Trigger Event:
push
-
Statement type: