AutoTuneMPC

Constrained nonlinear MPC, tuned over HTTPS.

CasADi and IPOPT solve the constrained nonlinear program. Optuna tunes the weights. One JSON API covers the solve, the tuner, and three registered plants.

Measured differential drive position for the unit baseline and the autotuned weights

20-trial default (2.2 s): lower tracking error (0.177 vs 0.196), rougher control (0.056 vs 0.031).

View differential_drive.py

Live validator

These examples match the live checks. Differential drive, battery peak shaving, and root-zone irrigation are the three plants. Solve is the same check with the weights filled in. Edit the JSON and run it.

Open full workbench (/try)

Status — · Latency — ms

The formatted JSON response appears here.

Endpoints

Solve

POST /v1/solve

$0.02 USD

One constrained MPC step. Send your pack key or pay the HTTP 402 challenge.

Autotune

POST /v1/autotune

$1.50 USD

Queue a weight search. The reply includes a job id you can check until it finishes.

Plant autotune

POST /v1/templates/autotune

$2.00 USD

Differential drive, battery peak shaving, or root-zone irrigation.

free GET /health returns status ok. free POST /v1/validate checks the plant before a paid solve.

curl -sS -X POST https://api.autotunempc.com/v1/solve \
  -H "content-type: application/json" \
  -H "X-API-Key: $AUTOTUNE_API_KEY" \
  -d '{
    "system": {
      "kind": "nonlinear",
      "name": "double_integrator",
      "parameters": {"dt": 0.1},
      "N": 8,
      "u_min": [-2.0],
      "u_max": [2.0],
      "du_min": [-1.0],
      "du_max": [1.0]
    },
    "x0": [0.0, 0.0],
    "x_ref": [0.4, 0.0],
    "Q": [[10.0, 0.0], [0.0, 2.0]],
    "R": [[0.1]],
    "Rd": [[0.1]],
    "Qf": [[20.0, 0.0], [0.0, 4.0]]
  }'

Pricing

Prepaid API Credit Pack

$29.00 USD

One-time payment. No subscription.

  • 1000 solve credits. Solve spends 1.
  • 4 autotune credits. Autotune spends 1.
  • A plant autotune spends 2 autotune credits.

Solve and autotune credits are tracked separately (not a shared dollar balance). Your API key appears immediately after checkout.

x402 on Base USDC

Pay per call with x402 in Base USDC when a pack key has no credits left, or when you do not send a key.

  • Solve $0.02 USD
  • Autotune $1.50 USD
  • Plant autotune $2.00 USD

Connect an agent

The X-API-Key header can be omitted for free Validate.

Claude CLI

claude mcp add --transport http autotunempc https://api.autotunempc.com/mcp --header "X-API-Key: ${AUTOTUNE_API_KEY}"

.mcp.json

{
  "mcpServers": {
    "autotunempc": {
      "type": "http",
      "url": "https://api.autotunempc.com/mcp",
      "headers": {
        "X-API-Key": "${AUTOTUNE_API_KEY}"
      }
    }
  }
}

Cursor

{
  "mcpServers": {
    "autotunempc": {
      "url": "https://api.autotunempc.com/mcp",
      "headers": {
        "X-API-Key": "${env:AUTOTUNE_API_KEY}"
      }
    }
  }
}

Starter prompt

Read https://autotunempc.com/SKILL.md. Validate the plant with validate_problem. That call is free. Then call solve_mpc. Then call autotune_template or start_autotune_job. X-API-Key and x402 are the same gate.

Contact

Questions, custom plants, or lost pack keys? Email kaidenfield898@gmail.com.