# Quickstart

This guide takes you from nothing to a circuit run on the Amazon Braket SV1 simulator through the
router, with eigenkit or with plain HTTP.

## 1. Install eigenkit with the router client

```bash
pip install "eigenkit[router]"
```

The `router` extra of eigenkit installs the router client. New router features ship in the client,
so upgrade it by name:

```bash
pip install -U eigenorbit-router-client
```

You need nothing extra for HTTP: every call below is a `curl` command.

## 2. Create an API key

1. Sign in to the router web app at https://router.eigenorbit.com and accept the router terms.
2. Add funds on the Balance page. SV1 is an Amazon Braket device, so its jobs are paid from your
   balance.
3. Create an API key on the Keys page. The key is shown once: copy it then.

A job on SV1 holds `90000` micro-USD of your balance while it runs. Amounts are integers in
micro-USD, so that is 90000 / 1000000 = $0.09. A short job is then charged `4500` ($0.0045) and the
rest of the hold comes back. See [Balance, holds and charges](/docs/billing).

## 3. Put the key in an environment variable

```bash
export EIGENORBIT_ROUTER_API_KEY=eo_live_...
```

eigenkit reads the key from `EIGENORBIT_ROUTER_API_KEY` when `RouterConfig(api_key=...)` is not
set. The `curl` commands below read it from the same variable.

## 4. Run a circuit on `braket/sv1`

<CodeTabs syncKey="client">

```python title="eigenkit"
import numpy as np
from eigenkit import Circuit
from eigenkit.core.blocks import (
    AngleEncoding, BasicVariational, assemble,
)
from eigenkit.core.observables import all_z
from eigenorbit_router_client import RouterConfig

spec = assemble([
    AngleEncoding(in_features=2),
    BasicVariational(depth=1),
])

# The API key is read from EIGENORBIT_ROUTER_API_KEY.
# On a real QPU: device="braket/iqm_garnet" (see Devices)
provider = RouterConfig(device="braket/sv1", shots=1000)
circuit = Circuit(spec, all_z(2), provider=provider)

weights = np.linspace(-0.9, 1.1, spec.n_weights)
inputs = np.array([0.2, 0.6])
values = circuit(weights, inputs)  # one router job
print(values)
```

```bash title="HTTP"
curl https://router.eigenorbit.com/v1/jobs \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'EO-Protocol-Version: 1' \
  --header "Idempotency-Key: $(uuidgen)" \
  --header "Authorization: Bearer $EIGENORBIT_ROUTER_API_KEY" \
  --data '{
    "device": "braket/sv1",
    "method": "run",
    "shots": 0,
    "circuit_spec": {
      "n_qubits": 1,
      "n_weights": 1,
      "n_inputs": 0,
      "gates": [{"n": "RY", "q": [0], "p": [{"t": "WeightRef", "i": 0}]}]
    },
    "observables": [{"terms": [{"coeff": 1.0, "paulis": [["Z", 0]]}]}],
    "weights": [0.5],
    "inputs": []
  }'
```

</CodeTabs>

With eigenkit, building the circuit asks the router for an estimate and shows one `CostWarning` with
the price of a job. The call `circuit(weights, inputs)` then sends one job and blocks until it
finishes.

Over HTTP, the body is a one-qubit circuit `RY(w0)` measured with `Z0`, with `shots` 0 for an exact
result. eigenkit produces `circuit_spec` and `observables` in this form; their format is not
specified for hand-written requests. The router answers `202` with the new job:

```json
{
  "id": "01a0d3c5-6d70-7894-b00c-bf5998ca19fa",
  "status": "queued",
  "billing": "held",
  "device": "braket/sv1",
  "method": "run",
  "shots": 0,
  "estimate_usd_micro": 90000,
  "price_version": "braket/sv1@1",
  "error": null,
  "actual_cost_usd_micro": null,
  "vendor_cost_usd_micro": null,
  "fee_usd_micro": null,
  "created_at": "2026-09-24T14:12:03.512000Z",
  "updated_at": "2026-09-24T14:12:03.512000Z",
  "completed_at": null,
  "result_expires_at": null,
  "credential_source": null,
  "ibm_usage_seconds": null
}
```

## 5. Read the result

With eigenkit, `values` holds one expectation value per observable, as on any other eigenkit
provider. `sample(...)` and `probabilities(...)` work as well.

Over HTTP, poll the job until its `status` is `completed`, then read the result. Asking for the
result earlier answers `409 job_not_completed`. Use the `id` from the answer above:

```bash
JOB_ID=01a0d3c5-6d70-7894-b00c-bf5998ca19fa

curl https://router.eigenorbit.com/v1/jobs/$JOB_ID \
  --header 'EO-Protocol-Version: 1' \
  --header "Authorization: Bearer $EIGENORBIT_ROUTER_API_KEY"

curl https://router.eigenorbit.com/v1/jobs/$JOB_ID/result \
  --header 'EO-Protocol-Version: 1' \
  --header "Authorization: Bearer $EIGENORBIT_ROUTER_API_KEY"
```

The result of a `run` job is one expectation value per observable, as a float64 array:

```json
{
  "job_id": "01a0d3c5-6d70-7894-b00c-bf5998ca19fa",
  "method": "run",
  "bit_order": "qubit0_msb",
  "result": {
    "kind": "array",
    "dtype": "float64",
    "shape": [1],
    "data": [0.8775825618903728]
  }
}
```

The answer also carries `execution`, which this example omits: what the router ran on the vendor,
for SV1 the Amazon Braket task ID. See [Job lifecycle](/docs/jobs#what-the-router-ran).

## Next steps

- [API keys and budgets](/docs/api-keys): give each key a spend budget, rename and revoke keys.
- [Devices and prices](/docs/devices): pick a QPU and read its shot range and price.
- [Estimate cost before a run](/docs/estimates): price a job without running it.
- [Job lifecycle](/docs/jobs): statuses, polling, results, cancel and retention.
- [Errors, retries and idempotency](/docs/errors): what to do when a call fails.

## Reference

- [Submit a job](/docs/api/jobs#submit-a-job)
- [Get a job](/docs/api/jobs#get-a-job)
- [Get a job result](/docs/api/jobs#get-a-job-result)
