# Op-Amp Gain API
> Operational-amplifier gain and bandwidth maths as an API, computed locally and deterministically. The gain endpoint computes the closed-loop gain of an inverting (Av = −Rf/Rin) or non-inverting (Av = 1 + Rf/Rin) amplifier from the feedback and input resistors, gives the gain in decibels (20·log₁₀|Av|) and the output voltage for an input, and solves the feedback resistor needed for a target gain. The summing endpoint computes the output of an inverting summing (adder) amplifier, Vout = −Rf·Σ(Vi/Ri), from any number of weighted inputs — the basis of analogue mixers and digital-to-analogue converters. The bandwidth endpoint applies the gain-bandwidth product, GBW = closed-loop gain × bandwidth, and solves any of the three (a 1 MHz op-amp at a gain of 10 has a 100 kHz bandwidth), and computes the full-power bandwidth from the slew rate and the peak output voltage, f = slew_rate/(2π·Vpeak). Everything is computed locally and deterministically, so it is instant and private. Ideal for analogue-electronics and circuit-design tools, amplifier, filter and sensor-conditioning design, audio and instrumentation apps, and electronics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is op-amp amplifier design; for Ohm's law, reactance and resonance use an Ohm's-law API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/opamp-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 30,000 calls/Mo, 6 req/s
- **Pro** ($22/Mo) — 150,000 calls/Mo, 20 req/s
- **Mega** ($69/Mo) — 750,000 calls/Mo, 60 req/s

## Endpoints

### Op-Amp

#### `GET /v1/bandwidth` — Gain-bandwidth product

**Parameters:**
- `gain_bandwidth_product` (query, optional, string) — GBW (Hz) Example: `1000000`
- `closed_loop_gain` (query, optional, string) — Closed-loop gain Example: `10`
- `bandwidth` (query, optional, string) — Bandwidth (Hz)
- `slew_rate_v_us` (query, optional, string) — Slew rate (V/µs) for full-power BW
- `peak_voltage` (query, optional, string) — Peak output voltage (V)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/opamp-api/v1/bandwidth?gain_bandwidth_product=1000000&closed_loop_gain=10"
```

**Response:**
```json
{
    "data": {
        "formula": "GBW = closed-loop gain × bandwidth.",
        "bandwidth_hz": 100000,
        "closed_loop_gain": 10,
        "gain_bandwidth_product_hz": 1000000
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:38.557Z",
        "request_id": "0181b8b1-b9db-44d1-9958-6fb90a3782d5"
    },
    "status": "ok",
    "message": "Gain-bandwidth product",
    "success": true
}
```

#### `GET /v1/gain` — Inverting / non-inverting gain

**Parameters:**
- `type` (query, optional, string) — inverting | non-inverting (default inverting) Example: `inverting`
- `feedback_resistance` (query, optional, string) — Feedback resistor Rf (Ω) Example: `100000`
- `input_resistance` (query, optional, string) — Input resistor Rin (Ω) Example: `10000`
- `gain` (query, optional, string) — Or a target gain to solve a resistor
- `input_voltage` (query, optional, string) — Input voltage for the output

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/opamp-api/v1/gain?type=inverting&feedback_resistance=100000&input_resistance=10000"
```

**Response:**
```json
{
    "data": {
        "gain": -10,
        "formula": "Av = −Rf/Rin.",
        "gain_db": 20,
        "configuration": "inverting",
        "gain_magnitude": 10,
        "input_resistance_ohm": 10000,
        "feedback_resistance_ohm": 100000
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:38.664Z",
        "request_id": "66fbddd3-d259-48c5-bb8c-5aad819b12ce"
    },
    "status": "ok",
    "message": "Inverting / non-inverting gain",
    "success": true
}
```

#### `GET /v1/summing` — Summing amplifier

**Parameters:**
- `feedback_resistance` (query, required, string) — Feedback resistor Rf (Ω) Example: `10000`
- `inputs` (query, optional, string) — JSON array of {voltage,resistance} Example: `[{"voltage":1,"resistance":10000},{"voltage":2,"resistance":10000}]`
- `v1` (query, optional, string) — Or input 1 voltage Example: `1`
- `r1` (query, optional, string) — Input 1 resistance Example: `10000`
- `v2` (query, optional, string) — Input 2 voltage Example: `2`
- `r2` (query, optional, string) — Input 2 resistance Example: `10000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/opamp-api/v1/summing?feedback_resistance=10000&inputs=%5B%7B%22voltage%22%3A1%2C%22resistance%22%3A10000%7D%2C%7B%22voltage%22%3A2%2C%22resistance%22%3A10000%7D%5D&v1=1&r1=10000&v2=2&r2=10000"
```

**Response:**
```json
{
    "data": {
        "inputs": [
            {
                "voltage_v": 1,
                "contribution_v": -1,
                "resistance_ohm": 10000
            },
            {
                "voltage_v": 2,
                "contribution_v": -2,
                "resistance_ohm": 10000
            }
        ],
        "formula": "Vout = −Rf·Σ(Vi/Ri).",
        "output_voltage_v": -3,
        "feedback_resistance_ohm": 10000
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:38.742Z",
        "request_id": "e4664066-32c1-4585-855f-4f1268059a08"
    },
    "status": "ok",
    "message": "Summing amplifier",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/opamp-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "api": "opamp",
        "note": "Op-amp gain & bandwidth — computed locally and deterministically, no key, no third-party service.",
        "endpoints": [
            "/v1/gain",
            "/v1/summing",
            "/v1/bandwidth",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:38.843Z",
        "request_id": "ebd49613-1b68-45eb-98f3-560dbbe53a10"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/opamp-api
OpenAPI spec: https://www.oanor.com/api/opamp-api/openapi.json
