API Reference v4.2

Aṇu Astra Integration Guide

Welcome to the official developer documentation for Aṇu Astra. This guide comprehensively covers the integration of our 1024-Qubit Virtual Quantum Processor (VQP) into your enterprise logic.

Aṇu Astra operates exclusively over standard REST APIs, allowing developers to inject Quantum Randomness (QRNG), execute deep-shallowed Quantum Circuits (OpenQASM/JSON), and generate Post-Quantum Cryptographic keys (Kyber/Dilithium) without requiring specialized client-side hardware or cryogenic cooling systems.

pip install anuastra

Official Python SDK for QML & Research

npm install anuastra

Node.js/TypeScript High-Throughput Bridge

Security & Authentication

Every request to the Aṇu Astra API cluster must be cryptographically authenticated using an API Key. You can generate and rotate your keys within the Developer Dashboard.

Header Injection:
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxx

Quantum Circuit Execution

The Aṇu Astra cluster supports highly complex unitary evolution algorithms on our 1024-qubit Virtual Quantum Processor (VQP). Below is the mathematically rigorous dictionary of physical gates supported by the engine.

7-Category Universal Gate Map

Every method below is natively supported by the Aṇu Astra Python and Node.js SDKs with **Fluent Chaining** (e.g., qc.h(0).cx(0,1)).

1. Standard Gates

  • qc.h(q) — Hadamard
  • qc.x(q) / y(q) / z(q) — Pauli
  • qc.id(q) — Identity

2. Phase & Sqrt

  • qc.s(q) / sdg(q) — Phase
  • qc.t(q) / tdg(q) — T-Gate
  • qc.sx(q) / sxdg(q) — √X

3. Parameterized (QML)

  • qc.rx(q, th) / ry / rz — Rotations
  • qc.p(q, lam) / u1 — Phase Shift
  • qc.u3(q, th, ph, lam) — General U

4. 2-Qubit Entanglers

  • qc.cx(c, t) — CNOT
  • qc.cz(c, t) / cy / ch — Controlled
  • qc.swap(q1, q2) / iswap — Exchange
  • qc.ecr(q1, q2) / dcx — Native

5. Controlled-Parametric

  • qc.crx(c, t, th) / cry / crz — C-Rot
  • qc.cp(c, t, lam) — C-Phase
  • qc.cu(c, t, th, ph, lam, gm) — 4-Param

6. Multi-Qubit / NIST

  • qc.ccx(q1, q2, q3) — Toffoli
  • qc.fredkin(c, q1, q2) — Fredkin
  • qc.ccz(q1, q2, q3) / c3x / quadx

7. Hardware & Exotic

  • qc.ms(q1, q2, th) — M-S Interaction
  • qc.fsim(q1, q2, th, ph) — Fermionic
  • qc.deutsch(q1, q2, q3, th) — Deutsch
  • qc.rxx(q1, q2, th) / ryy / rzz

Quantum Hello World (Bell State)

Generating perfect entanglement between two qubits in just two operations. This is the industry-standard benchmark for hardware verification.

from anuastra import Client, QuantumCircuit

astra = Client(api_key='your_sk_live_key')
qc = QuantumCircuit(2)

# Generate a Bell State: |Φ⁺⟩ = (|00⟩ + |11⟩) / √2
qc.h(0)           # Create superposition on Qubit 0
qc.cx(0, 1)       # Entangle Qubit 0 with Qubit 1

result = astra.execute_quantum(qc, shots=1024)
print("Bell State Counts:", result['results']['counts'])
const { AṇuAstra, QuantumCircuit } = require('anuastra');
const astra = new AṇuAstra({ apiKey: 'your_sk_live_key' });

const qc = new QuantumCircuit(2);
qc.h(0).cx(0, 1); // Fluent entanglement

const res = await astra.quantum.execute(qc, { shots: 1024 });
curl -X POST "https://astra.cryptopix.in/api/v1/quantum/execute" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "qubits": 2,
    "circuit": [
      { "gate": "H", "target": [0] },
      { "gate": "CX", "target": [0, 1] }
    ]
  }'
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
h q[0];
cx q[0], q[1];

Execution Telemetry & Response Schema

Every successful execution on the Aṇu Astra cluster returns a strongly-typed JSON envelope containing both computational results and cryptographic audit telemetry.

Standard JSON Response Object

{
  "status": "success",
  "data": {
    "execution_time_ms": 124,              // Simulation overhead in milliseconds
    "engine": "vqp-feynman-integral",       // Astra Core identification
    "num_qubits": 2,                       // Allocated hardware resources
    "results": {
      "counts": { "00": 512, "11": 512 },  // Raw measurable state frequencies
      "probabilities": { "00": 0.5, "11": 0.5 } // Born-rule statistical weights
    },
    "cost": 10,                            // Consumed Quantum Credits
    "remaining_credits": 9850              // Updated wallet balance
  },
  "metadata": {
    "transaction_id": "circ-req-uuid-...", // Audit trail identifier
    "generated_at": "2026-04-06T21:58Z"    // Chronological server time
  },
  "compliance": {
    "signature": "ed25519_sig_hex...",     // Digital proof of result integrity
    "verification_url": "https://..."      // Public verification endpoint
  }
}

The Results Object

The counts field maps observed bitstrings to their frequency over the total shots. The probabilities represent the theoretical amplitude squared |α|².

Compliance Signature

Every Aṇu Astra result is signed with an Ed25519 private key. This prevents "Man-in-the-Middle" manipulation of sensitive quantum research data.

SDK-OpenQASM 2.0 Execution

Executing industry-standard OpenQASM strings directly through the Aṇu Astra SDK for research portability.

from anuastra import Client

astra = Client(api_key='your_sk_live_key')

# Define industry-standard OpenQASM 2.0
qasm_str = """OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
h q[0];
cx q[0], q[1];
"""

# Execute directly via the .execute_qasm() method
result = astra.execute_qasm(qasm_str, shots=1024)
print("GHZ Counts:", result['results']['counts'])
const { AṇuAstra } = require('anuastra');
const astra = new AṇuAstra({ apiKey: 'your_sk_live_key' });

const qasm = "OPENQASM 2.0; qreg q[2]; h q[0]; cx q[0],q[1];";

// High-performance ingestion for research portability
const res = await astra.quantum.executeQasm(qasm, { shots: 1024 });
curl -X POST "https://astra.cryptopix.in/api/v1/quantum/qasm" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "qasm": "OPENQASM 2.0; include \"qelib1.inc\"; qreg q[2]; h q[0]; cx q[0],q[1];"
  }'

Industrial Portability: QASM Export

For research archival and peer-review, Aṇu Astra supports the Bridge Pattern—allowing you to build circuits natively and export them to OpenQASM 2.0 strings for cross-platform verification.

Example: Exporting a 3-Qubit GHZ State (Python)

from anuastra import QuantumCircuit

# 1. Build natively via SDK Builder
qc = QuantumCircuit(3)
qc.h(0).cx(0, 1).cx(1, 2)

# 2. Export to Industry-Standard QASM String
qasm_output = qc.to_qasm()
print(qasm_output)

# Expected Output:
# OPENQASM 2.0;
# include "qelib1.inc";
# qreg q[3];
# h q[0];
# cx q[0], q[1];
# cx q[1], q[2];

Pro-Tips for Production

Radians for Rotations

Parameterized gates (rx, ry, rz) expect values in radians. Always use math.pi in Python or Math.PI in Node.js for precision.

Shot Noise Calibration

For high-assurance research, we recommend ≥ 1024 shots to ensure Born-rule statistical convergence.

Post-Quantum Cryptography (PQC)

Traditional RSA and ECC encryption schemes are mathematically vulnerable to Shor's Algorithm executed on mature Quantum Computers. Aṇu Astra provides immediate FIPS 203 & 204 compliant drops-ins for Post-Quantum generation architectures.

import requests

payload = {
    "algorithm": "kyber",          # 'kyber' (KEM) or 'dilithium' (DSA)
    "security_level": 768          # Equivalencies: 512, 768, 1024
}

response = requests.post(
    "https://astra.cryptopix.in/api/v1/quantum/pqc/keygen",
    json=payload,
    headers={"Authorization": "Bearer sk_live_xxx"}
)

keys = response.json()["data"]
print("Public Key:", keys["public_key"])
curl -X POST "https://astra.cryptopix.in/api/v1/quantum/pqc/keygen" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "algorithm": "kyber",
    "security_level": 768
  }'

Telemetry & Error Handling

Aṇu Astra returns standard JSON envelopes. On failure, status will be mapped to "error".

HTTP CodeSystem DesignationMeaning
401 Auth Failure The Bearer Token is missing, completely invalid, or has been forcefully revoked.
402 Quota Exceeded The account has critically depleted its Quantum Credits. Upgrade tier or await monthly chronological refresh.
400 Vector Out of Bounds Bad JSON array syntax, calling a gate parameter that does not exist, or requesting > 1024 qubits.

Quantum Random Number Generation (QRNG)

The cornerstone of unconditional cryptographic security is perfect entropy. Traditional PRNGs (Pseudo-Random Number Generators) rely on deterministic algorithms (like Mersenne Twister) which are theoretically predictable if the seed state is compromised or reverse-engineered.

Aṇu Astra's QRNG harnesses simulated superposition collapse. By placing a virtual qubit array into perfect superposition |ψ⟩ = (1/√2)(|0⟩ + |1⟩) and forcing an immediate measurement over entire blocks concurrently, we extract high bit-rate, theoretically perfect minimum entropy (H_min ≈ 7.99 bits/byte) that is non-deterministic and cryptographically flawless.

QRNG REST Endpoints

Retrieve raw entropy across multiple data structures using exactly one master endpoint.

POST /api/v1/quantum/qrng

Returns theoretically perfect quantum entropy based on the requested output type.

JSON Body Parameters

ParameterTypeDescription
type * string Must be one of: bytes, int, float, bits.
size integer Required for bytes and bits. Defaults to 32. Max 1024.
min integer Required for int. The minimum bound (inclusive).
max integer Required for int. The maximum bound (inclusive).

QRNG Implementation Examples

Using the official Aṇu Astra Native SDKs is the recommended pattern for production.

from anuastra import Client

astra = Client(api_key='sk_live_YourAstraKeyHere')

# Native Python wrappers cleanly format API telemetry under the hood
hex_seed = astra.qrng.get_random_bytes(length=32)
unbiased_int = astra.qrng.get_random_int(min=100, max=1000)
pure_float = astra.qrng.get_random_float()
bit_string = astra.qrng.get_random_bits(size=256)

print("Hexadecimal Seed:", hex_seed['entropy'])
print("Float Probability [0,1):", pure_float['entropy'])
import { AṇuAstra } from 'anuastra';

const astra = new AṇuAstra({ apiKey: 'sk_live_YourAstraKeyHere' });

async function generateEntropy() {
    // Strictly typed Promises for all QRNG forms
    const byteRes = await astra.qrng.getRandomBytes(64);
    const bitsRes = await astra.qrng.getRandomBits(1024);
    const intRes = await astra.qrng.getRandomInt(1, 10);
    const fRes = await astra.qrng.getRandomFloat();

    console.log(`Quantum Coin Toss: ${intRes.data.entropy === 1 ? 'Heads' : 'Tails'}`);
}
curl -X POST "https://astra.cryptopix.in/api/v1/quantum/qrng" \
  -H "Authorization: Bearer sk_live_YourAstraKey" \
  -H "Content-Type: application/json" \
  -d '{"type": "float"}'