Hevy now works inside ChatGPT. Type @hevy and it reads your training history and builds routines for you. But if you live in OpenCode like I do, you can wire Hevy's public API to your own agent and get the same thing, with full control over what it knows about you. That includes the stuff ChatGPT won't ask you about, like an injury or surgery.
What the Hevy API gives you
Hevy has a public REST API at api.hevyapp.com. It needs a Hevy Pro account. The API key is a UUID you grab from the site.
With it you can read and write almost everything in the app:
| Endpoint | What it does |
|---|---|
GET /v1/user/info |
Account, units, Pro status |
GET /v1/workouts |
Every logged session with sets and weights |
GET /v1/exercise_templates |
The full exercise library |
GET /v1/routines |
Your saved routines and folders |
POST /v1/routines |
Create a routine |
GET /v1/exercise_history/{id} |
History for one exercise |
GET/POST/PUT /v1/body_measurements |
Weight, waist, thigh, body fat |
That's the whole story. Your agent reads what you've done and writes back routines you can follow.
The official way first
If you want zero setup, use the official path. Hevy built it on top of MCP.
- Open ChatGPT and install the Hevy app (or use the Claude connector).
- Type
@hevyand ask for a plan or an analysis of your last sessions. - It saves routines straight to your Hevy account.
It's free on both sides. The catch for me is it lives inside ChatGPT. My training notes, my injury history, and my agent all live somewhere else. So I went the API route.
How I connect Hevy to OpenCode
My setup is one small script plus one skill. The script talks to the API. The skill tells the agent who I am.
1. Get your API key
Hevy Pro only. Sign in at api.hevyapp.com, grab the key. It's a UUID.
2. Auth is api-key, not Bearer
This is the first gotcha. Most APIs want Authorization: Bearer. Hevy wants a custom header:
curl -s https://api.hevyapp.com/v1/user/info \
-H "api-key: $HEVY_TOKEN"
That returns your username, units, and Pro status. If you send Bearer it 401s.
3. Everything is paginated, pageSize caps at 10
This one will bite you. Hevy caps pageSize at 10 on every endpoint. A year of training is hundreds of workouts, so you page through them and cache the result.
curl -s "https://api.hevyapp.com/v1/workouts?page=1&pageSize=10" \
-H "api-key: $HEVY_TOKEN"
My script loops until page >= page_count, then writes everything to a local cache so the agent isn't hammering the API every time it wants to think.
4. Writing a routine
Creating a routine is a POST with the exercises as template IDs. You look up the ID from /v1/exercise_templates, you never invent one.
curl -s -X POST https://api.hevyapp.com/v1/routines \
-H "api-key: $HEVY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"routine": {
"title": "Lower A - Quad Bias",
"folder_id": 0,
"notes": "Example block. Surgical leg leads.",
"exercises": [
{
"exercise_template_id": "{TEMPLATE_ID}",
"superset_id": null,
"rest_seconds": 120,
"notes": "Surgical leg leads.",
"sets": [
{ "type": "normal", "weight_kg": 40, "reps": 10 }
]
}
]
}
}'
That creates a reusable routine in Hevy, same as if you built it in the app.
Note: updating a routine is a PUT that replaces the whole exercise list. Read it first, change what you need, send it back. Don't PUT half an object, or you'll wipe the exercises.
What I share with my agent
The API gives the agent my history. But the agent can't program me properly unless it also knows the things Hevy doesn't store. So I hand it a short profile:
| What I share | Example | Why the agent needs it |
|---|---|---|
| Goal | Lean bulk, gain 3 kg | Sets calorie and volume targets |
| Injury | ACL reconstruction, right knee | No plyos, surgical leg leads, slower progression |
| Body | 170 cm, 70 kg, 85 cm waist | Tracks the bulk against a waist budget |
| Equipment | Kettlebell + dumbbells, no bench | Builds routines you can actually do at home |
| Schedule | 3 gym days + 1 home day | Splits volume across the week |
The injury line is the important one. A generic AI coach would hand me box jumps a few months after an ACL reconstruction. My agent knows the surgery and the graft type, so it programs around the knee instead of through it.
What the agent does with it
On every run it pulls my history and answers with real numbers, not memory. This is the kind of thing I get back for a week:
## Weekly working sets per muscle
| Muscle | Total sets | Per week | vs 10-20 target |
|---------|-----------|----------|-----------------|
| quads | 12 | 6.0 | under |
| chest | 16 | 8.0 | in range |
| back | 8 | 4.0 | well under |
That table is how I spot that one muscle is getting skipped while another is trained twice. I can ask it to review a week, spot a weak point, then build a routine to fix it, all saved back to Hevy.
Here's the flow:
Hevy app (you log) ──> Hevy API ──> your script ──> OpenCode + skill ──> writes routines back to Hevy
Why bother when ChatGPT does it?
The official integration is the right tool for most people. It's free and it's one click. The API route is for when you want the agent to know more than Hevy logs. My injury, my graft type, my home equipment, my calorie target. That context is what turns a workout generator into an actual coach.
The other reason is control. The API gives you body measurements, exercise history, and your full workout log, not just routines. You decide what the agent sees and what it writes. Nothing is shared unless you wire it up yourself.
Top comments (0)