Solve
POST /v1/solve
$0.02 USD
One constrained MPC step. Send your pack key or pay the HTTP 402 challenge.
CasADi and IPOPT solve the constrained nonlinear program. Optuna tunes the weights. One JSON API covers the solve, the tuner, and three registered plants.
20-trial default (2.2 s): lower tracking error (0.177 vs 0.196), rougher control (0.056 vs 0.031).
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.
The formatted JSON response appears here.
POST /v1/solve
$0.02 USD
One constrained MPC step. Send your pack key or pay the HTTP 402 challenge.
POST /v1/autotune
$1.50 USD
Queue a weight search. The reply includes a job id you can check until it finishes.
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]]
}'
import os
import requests
response = requests.post(
"https://api.autotunempc.com/v1/solve",
headers={"X-API-Key": os.environ["AUTOTUNE_API_KEY"]},
json={
"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]],
},
)
print(response.status_code)
print(response.json())
curl -sS -X POST https://api.autotunempc.com/v1/autotune \
-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
},
"scenario": {
"x0": [0.0, 0.0],
"step_reference": [1.0, 0.0],
"n_steps": 20
},
"kpi": {
"target_max_overshoot_pct": 20,
"settling_time_weight": 1,
"control_effort_weight": 0.01,
"slew_penalty_weight": 0.01,
"max_optuna_trials": 8,
"timeout_seconds": 30
}
}'
import os
import requests
response = requests.post(
"https://api.autotunempc.com/v1/autotune",
headers={"X-API-Key": os.environ["AUTOTUNE_API_KEY"]},
json={
"system": {
"kind": "nonlinear",
"name": "double_integrator",
"parameters": {"dt": 0.1},
"N": 8
},
"scenario": {"x0": [0.0, 0.0], "step_reference": [1.0, 0.0], "n_steps": 20},
"kpi": {
"target_max_overshoot_pct": 20,
"settling_time_weight": 1,
"control_effort_weight": 0.01,
"slew_penalty_weight": 0.01,
"max_optuna_trials": 8,
"timeout_seconds": 30,
},
},
)
print(response.status_code)
print(response.json())
curl -sS -X POST https://api.autotunempc.com/v1/templates/autotune \
-H 'content-type: application/json' \
-H "X-API-Key: $AUTOTUNE_API_KEY" \
-d '{"name":"differential_drive","max_trials":2}'
curl -sS -X POST https://api.autotunempc.com/v1/templates/autotune \
-H 'content-type: application/json' \
-H "X-API-Key: $AUTOTUNE_API_KEY" \
-d '{"name":"battery_peak_shaving","max_trials":2}'
curl -sS -X POST https://api.autotunempc.com/v1/templates/autotune \
-H 'content-type: application/json' \
-H "X-API-Key: $AUTOTUNE_API_KEY" \
-d '{"name":"root_zone_irrigation","max_trials":2}'
import os
import requests
for name in ("differential_drive", "battery_peak_shaving", "root_zone_irrigation"):
response = requests.post(
"https://api.autotunempc.com/v1/templates/autotune",
headers={"X-API-Key": os.environ["AUTOTUNE_API_KEY"]},
json={"name": name, "max_trials": 2},
)
print(name, response.status_code)
print(response.json())
$29.00 USD
One-time payment. No subscription.
Solve and autotune credits are tracked separately (not a shared dollar balance). Your API key appears immediately after checkout.
Pay per call with x402 in Base USDC when a pack key has no credits left, or when you do not send a key.
The X-API-Key header can be omitted for free Validate.
claude mcp add --transport http autotunempc https://api.autotunempc.com/mcp --header "X-API-Key: ${AUTOTUNE_API_KEY}"
{
"mcpServers": {
"autotunempc": {
"type": "http",
"url": "https://api.autotunempc.com/mcp",
"headers": {
"X-API-Key": "${AUTOTUNE_API_KEY}"
}
}
}
}
{
"mcpServers": {
"autotunempc": {
"url": "https://api.autotunempc.com/mcp",
"headers": {
"X-API-Key": "${env:AUTOTUNE_API_KEY}"
}
}
}
}
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.
Questions, custom plants, or lost pack keys? Email kaidenfield898@gmail.com.