# Quantum Circuit Local Gate Optimizer

> Quantum Circuit Local Gate Optimizer is a paid API for AI agents from quantum.halowerk.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-14).

Cancels adjacent identical self-inverse gates on the same qubits and merges adjacent RX/RY/RZ rotation gates on identical targets into single rotations.

## Facts

- Endpoint: POST https://quantum.halowerk.com/v1/circuit-optimize
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/quantum-circuit-local-gate-optimizer-34674a59
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1hW8cjqXD1Um-yrwTx45H

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability quantum-circuit-local-gate-optimizer-34674a59 -d '<json body>'
```

Example prompt: Optimize this quantum circuit for me — it has 6 qubits and the gate list is: H on qubit 0, H on qubit 0, RX(0.5) on qubit 1, RX(0.3) on qubit 1, CNOT on qubits 0 and 1. Cancel any redundant adjacent gates and fold the rotations.

## When to prefer this

Use this endpoint when you need fast, local gate count reduction on a quantum circuit — specifically to cancel adjacent self-inverse gates (X, H, CNOT, etc.) or merge consecutive same-axis rotations (RX, RY, RZ). It is ideal as a lightweight preprocessing step before hardware submission. Do not use it if you need commutativity-based reordering, hardware topology mapping, arbitrary unitary synthesis, or global optimality guarantees.

## Known failure modes

- Gate list exceeds 10000 gates — request rejected
- Qubit index exceeds qubit_count or exceeds maximum of 127
- RX/RY/RZ gate missing required angle_rad field
- Invalid gate type not in supported enum
- angle_rad outside allowed range [-1000000, 1000000]
- Empty gate list submitted

## How this service works

Cancels adjacent identical self-inverse gates on identical ordered targets and folds adjacent RX, RY or RZ rotations on identical targets. It preserves only these local identities; it does not commute gates, model hardware topology, synthesize arbitrary unitaries or prove global optimality.

## Output

Returns the optimized gate sequence with adjacent self-inverse gate pairs removed and consecutive same-axis rotation angles folded into single gates, reducing overall gate count while preserving the circuit's unitary operation.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "gates": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "gate",
     "targets"
    ],
    "properties": {
     "gate": {
      "enum": [
       "X",
       "Y",
       "Z",
       "H",
       "CNOT",
       "CZ",
       "SWAP",
       "RX",
       "RY",
       "RZ"
      ],
      "type": "string"
     },
     "targets": {
      "type": "array",
      "items": {
       "type": "integer",
       "maximum": 127,
       "minimum": 0
      },
      "maxItems": 2,
      "minItems": 1,
      "uniqueItems": true
     },
     "angle_rad": {
      "type": "number",
      "maximum": 1000000,
      "minimum": -1000000
     }
    },
    "additionalProperties": false
   },
   "maxItems": 10000,
   "minItems": 1
  },
  "qubit_count": {
   "type": "integer",
   "maximum": 128,
   "minimum": 1
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/quantum-circuit-local-gate-optimizer-34674a59/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from quantum.halowerk.com](https://www.zero.xyz/host/quantum.halowerk.com/llms.txt)
