Skip to main content

GJQ-Client

gjq-client is the Python SDK for CETC International Cornerstone Quantum Industry (Suzhou) Co., Ltd. (CETC-ICQ) Cloud Platform. It provides access to quantum hardware and cloud simulators through Qiskit 2.3, with optional PennyLane integration.

What's New in 0.2.0

  • Exclusive execution with Sessions: Group related jobs in a Session to use exclusive backend resources while the Session is active, ideal for iterative quantum workloads.
  • MPS simulation up to 1,000 qubits: Run circuits on the new Matrix Product State (MPS) simulator with presets for speed and accuracy.
  • PennyLane integration: Run PennyLane QNodes on GJQ backends, including MPS, with parameter-shift gradients and Session support.

See the 0.2.0 changelog for details.

Project Structure

Main SDK modules:

src/gjq_client/
├── __init__.py          # Public API exports
├── _version.py          # SDK version
├── pennylane_device.py  # PennyLane device registered as "gjq"
├── gjq_runtime/         # Service, Sampler, Estimator, Sessions, and jobs
├── backend/             # Qiskit backend models and execution options
├── client/              # Authentication and cloud API communication
├── pqcrequests/         # PQC handshake and encrypted proxy transport
└── utils/               # Circuit conversion, transpilation, and errors

📦 Installation

Requirements: Python >= 3.12, Qiskit == 2.3.0, qiskit-ibm-runtime == 0.45.0, cryptography >= 48.0.0

This release requires Qiskit 2.3.0. The optional PennyLane integration requires PennyLane >= 0.45.1, < 0.46 and pennylane-qiskit == 0.45.0. The installation commands below install the required dependencies automatically.

# Install via PyPI
pip install gjq-client

# Or install from a local source checkout (run in the repository root)
pip install .

# Optional PennyLane integration
pip install "gjq-client[pennylane]"

🚀 Quick Start

Replace YOUR_API_KEY with your platform API key and target_quantum_machine with a backend name returned by service.list_backends().

Use an available FAS-CPU or FAS-GPU backend to run this example as written. MPS requires options['simulator_config'] (see below); SAS-CPU and SAS-GPU require amplitude_index when running a task.

from qiskit import QuantumCircuit
from gjq_client import GJQRuntimeService, Sampler, generate_preset_pass_manager

# 1. Authenticate and initialize RuntimeService
#    (API key required on first use, cached automatically afterwards.
#     Obtain your key from tiangongqs.com/cloud)
service = GJQRuntimeService(api_key="YOUR_API_KEY")

# 2. Select a quantum backend
backend = service.backend("target_quantum_machine")

# 3. Build a quantum circuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()

# 4. Transpile the circuit for the target backend
pm = generate_preset_pass_manager(backend=backend, optimization_level=2)
transpiled_qc = pm.run(qc)

# 5. Submit the job and retrieve results
sampler = Sampler(backend=backend)
job = sampler.run(transpiled_qc, shots=1024)

result = job.result()
print("Measurement results:", result.get("counts"))

Session: Exclusive Backend Resources

Use a Session to run related jobs with exclusive backend resources while the Session is active. Choose a backend whose job_mode includes session in service.list_backends().

The example below reuses backend and transpiled_qc from Quick Start. Run it with a Session-capable backend; the backend-specific settings above still apply:

from gjq_client import Sampler, Session

with Session(backend=backend, max_time=3600) as session:
    sampler = Sampler(mode=session)
    for shots in (512, 1024):
        result = sampler.run(transpiled_qc, shots=shots).result(timeout=300)
        print(result["counts"])

max_time is specified in seconds. The Session closes automatically when the with block ends. You can also use Estimator(mode=session) for expectation-value jobs.

MPS Simulator: Up to 1,000 Qubits

The Matrix Product State (MPS) simulator supports circuits with 2 to 1,000 qubits. Select the MPS backend and choose a simulation preset. This example creates a 10-qubit GHZ state:

from qiskit import QuantumCircuit
from gjq_client import GJQRuntimeService, Sampler

service = GJQRuntimeService(api_key="YOUR_API_KEY")
backend = service.backend("MPS")

circuit = QuantumCircuit(10)
circuit.h(0)
for qubit in range(9):
    circuit.cx(qubit, qubit + 1)
circuit.measure_all()

options = {
    "simulator_config": {
        "preset": "fast",
        "runtime": {"num_gpus": 1},
    }
}
sampler = Sampler(backend=backend, options=options)
result = sampler.run(circuit, shots=1024).result(timeout=300)
print("Probabilities:", result["counts"])

Use fast, balanced, or accurate to choose a speed/accuracy tradeoff; expert is available for custom settings. MPS performance and accuracy depend on circuit depth and entanglement, so the 1,000-qubit capacity does not imply that every circuit of that size is practical. MPS results expose probabilities in counts.

Attention: Only single-qubit observables with coefficient exactly 1 are currently supported: other coefficients are rejected before submission. Identity padding such as IZ is allowed, while multi-qubit observables such as ZZ and Hamiltonians (Pauli sums, including multi-term SparsePauliOp) are rejected before submission with an "under development" message. To batch independent single-qubit expectations, use a named observable list with one single-qubit term per entry.

The Estimator example below reuses backend and options from the MPS example.

from gjq_client import Estimator

bell = QuantumCircuit(2)
bell.h(0)
bell.cx(0, 1)

estimator = Estimator(backend=backend, options=options)
result = estimator.run(bell, observable="IZ", shots=0).result(timeout=300)
print("Expectation values:", result["evs"])

PennyLane Integration

Install the optional dependency with pip install "gjq-client[pennylane]". Then use the gjq device to run a PennyLane QNode on an available FAS backend or quantum hardware. For MPS, use the replacement device definition below:

import pennylane as qml
from pennylane import numpy as np
from gjq_client import GJQRuntimeService

service = GJQRuntimeService(api_key="YOUR_API_KEY")
backend = service.backend("target_quantum_machine")
dev = qml.device("gjq", wires=2, backend=backend, timeout=300)

@qml.set_shots(1024)
@qml.qnode(dev, diff_method="parameter-shift")
def circuit(theta):
    qml.RY(theta, wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.Z(1))

theta = np.array(0.5, requires_grad=True)
print("Expectation value:", circuit(theta))
print("Gradient:", qml.grad(circuit)(theta))

To run the same QNode on MPS, replace the device definition above with:

dev = qml.device(
    "gjq",
    wires=2,
    backend=service.backend("MPS"),
    options={
        "simulator_config": {
            "preset": "fast",
            "runtime": {"num_gpus": 1},
        }
    },
    timeout=300,
)

For Session execution, create the device with mode=session instead of backend=backend, and call the QNode inside the Session's with block. PennyLane execution requires positive, finite shots and supports expval, var, probs, sample, and counts. The SAS-CPU and SAS-GPU single-amplitude backends are not supported by the PennyLane device.

🔐 PQC Encrypted Channel

When you need quantum-safe encryption for all API communication, enable PQC mode:

from gjq_client import GJQRuntimeService

# Enable PQC transport with ML-KEM768 key exchange and AES-256-GCM encryption
service = GJQRuntimeService(
    api_key="YOUR_API_KEY",
    pqc=True,
    pq_server_fingerprint="sha256:...",  # from Gateway operator
)

A local PQC Gateway must be running. The SDK routes every request (authentication, backend queries, task submission, result retrieval) through the Gateway's AES-256-GCM encrypted proxy channel.

How it works: The SDK performs a 2-step handshake (GET /cert → POST /handshake) to negotiate an ephemeral AES-256 session key via ML-KEM768 key encapsulation. All subsequent API calls are encrypted with AES-256-GCM and proxied through the Gateway, which decrypts, forwards to the real cloud backend, and encrypts the response.

Security: The server certificate fingerprint is pinned on the client side — any mismatch is rejected immediately (equivalent to TLS certificate-chain verification failure).

Changelog

📬 Contact

📄 License

Apache License 2.0

Metadata

Release files for gjq-client 0.2.0

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

Built distributions (wheels)

Table of built distributions (wheels) for gjq-client 0.2.0
File
gjq_client-0.2.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details
gjq_client-0.2.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
gjq_client-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
gjq_client-0.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
gjq_client-0.2.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
gjq_client-0.2.0-cp312-abi3-macosx_10_13_x86_64.whl CPython 3.12 abi3 macOS 10.13+ x86-64 Details
gjq_client-0.2.0-cp312-abi3-macosx_10_13_universal2.whl CPython 3.12 abi3 macOS 10.13+ universal2 (ARM64, x86-64) Details

Total release size: 3.0 MB

Release files / gjq_client-0.2.0-cp312-abi3-win_arm64.whl

Download URL gjq_client-0.2.0-cp312-abi3-win_arm64.whl
Size 201.9 kB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
5ebbae2870507038b1e34c62595f21dd7cc5ecf61580349880590cb50e450af4
BLAKE2b-256 checksum
How to use checksums
e880faa1020bfed5adafbe7ba5c95801f6cc8d14d6ffe5b8e456a336e1f6b2c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-win_amd64.whl

Download URL gjq_client-0.2.0-cp312-abi3-win_amd64.whl
Size 212.7 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
01de4ee96259bb7bc8977f347085669b41df6fce83d65ffd75d5fa6ae9f1367b
BLAKE2b-256 checksum
How to use checksums
82194994a151faf1be80b519279350bf3bbde5867557cec9b2af531b9a0500e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL gjq_client-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 877.5 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
a88a4e95fed39a892acebdb8c72f49f9f9baf1e41c55b9be9fb2d785388f2df5
BLAKE2b-256 checksum
How to use checksums
ddcc224722d73cf3bc1932362abade0e9676f639b0e8764a928a5a26b35d2152
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL gjq_client-0.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 885.9 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
c441c21277c3b062c9641e3fbdbea690f31a0c5caecb77aaf038885b98d2b858
BLAKE2b-256 checksum
How to use checksums
5acde82f901fdeec0fae2a878a90c188087f4c865aee3dca629cb71bc168c836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL gjq_client-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Size 218.2 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4fa5c2570d522ddb8c88f933f86667453ee0a050f621f4a21250f919e8945d3f
BLAKE2b-256 checksum
How to use checksums
ad18b3cfa95c7ed48a20d74e008de8338bc51c26fe9b314c7448887d74249020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-macosx_10_13_x86_64.whl

Download URL gjq_client-0.2.0-cp312-abi3-macosx_10_13_x86_64.whl
Size 220.6 kB
Tags CPython 3.12 abi3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
bbfac6e17a647c932c8f0c0fb76d7aa2f339c222cedaf9b3aad2428c76a88b9c
BLAKE2b-256 checksum
How to use checksums
db465af7e12f26074bd2a99624c404cd2ff2e4dd0bdec7c3b3ac5b8303c0f929
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / gjq_client-0.2.0-cp312-abi3-macosx_10_13_universal2.whl

Download URL gjq_client-0.2.0-cp312-abi3-macosx_10_13_universal2.whl
Size 348.4 kB
Tags CPython 3.12 abi3 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
343871e169046d301b0678df026535ab7ac1664e103cbea7d633712849e20508
BLAKE2b-256 checksum
How to use checksums
d5321508e7fc705acb5e1adbc08973c2d6ac4464d3eb6a7cb884b9c2b3e0ef7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for gjq-client 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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