Hevy
2026-03-30
新闻来源:网淘吧
围观:27
电脑广告
手机广告
Hevy 命令行界面
用于 Hevy 健身追踪 API 的命令行界面。可查询训练记录、训练计划、动作项目,并追踪进度。
设置
需要 Hevy Pro 订阅方可访问 API。

- 获取 API 密钥请前往https://hevy.com/settings?developer
- 设置环境变量:
export HEVY_API_KEY="your-key"
命令
状态
# Check configuration and connection
hevy status
训练记录
# List recent workouts (default 5)
hevy workouts
hevy workouts --limit 10
# Fetch all workouts
hevy workouts --all
# Show detailed workout
hevy workout <workout-id>
# JSON output
hevy workouts --json
hevy workout <id> --json
# Show weights in kg (default is lbs)
hevy workouts --kg
训练计划
# List all routines
hevy routines
# Show detailed routine
hevy routine <routine-id>
# JSON output
hevy routines --json
动作项目
# List all exercise templates
hevy exercises
# Search by name
hevy exercises --search "bench press"
# Filter by muscle group
hevy exercises --muscle chest
# Show only custom exercises
hevy exercises --custom
# JSON output
hevy exercises --json
动作历史记录
# Show history for specific exercise
hevy history <exercise-template-id>
hevy history <exercise-template-id> --limit 50
# JSON output
hevy history <exercise-template-id> --json
创建训练计划
# Create routine from JSON (stdin)
echo '{"routine": {...}}' | hevy create-routine
# Create routine from file
hevy create-routine --file routine.json
# Create a routine folder
hevy create-folder "Push Pull Legs"
# Update existing routine
echo '{"routine": {...}}' | hevy update-routine <routine-id>
# Create custom exercise (checks for duplicates first!)
hevy create-exercise --title "My Exercise" --muscle chest --type weight_reps
# Force create even if duplicate exists
hevy create-exercise --title "My Exercise" --muscle chest --force
⚠️ 重复创建预防: create-exercise命令会检查是否存在同名动作项目,若发现重复将报错。可使用--force参数强制创建(不推荐)。
训练计划 JSON 格式:
{
"routine": {
"title": "Push Day 💪",
"folder_id": null,
"notes": "Chest, shoulders, triceps",
"exercises": [
{
"exercise_template_id": "79D0BB3A",
"notes": "Focus on form",
"rest_seconds": 90,
"sets": [
{ "type": "warmup", "weight_kg": 20, "reps": 15 },
{ "type": "normal", "weight_kg": 60, "reps": 8 }
]
}
]
}
}
其他 使用示例
# Total workout count
hevy count
# List routine folders
hevy folders
Usage Examples
用户问:“我在健身房做了什么?”
hevy workouts
用户问:“给我看看我上次的胸部训练”
hevy workouts --limit 10 # Find relevant workout ID
hevy workout <id> # Get details
用户问:“我的卧推进展如何?”
hevy exercises --search "bench press" # Get exercise template ID
hevy history <exercise-id> # View progression
用户问:“我有哪些训练计划?”
hevy routines
hevy routine <id> # For details
用户问:“查找腿部练习”
hevy exercises --muscle quadriceps
hevy exercises --muscle hamstrings
hevy exercises --muscle glutes
用户问:“创建一个推日训练计划”
# 1. Find exercise IDs
hevy exercises --search "bench press"
hevy exercises --search "shoulder press"
# 2. Create routine JSON with those IDs and pipe to create-routine
备注
- 重复项预防:
create-exercise在创建前会检查是否存在同名练习。使用--force来覆盖(不推荐)。 - API 限制:Hevy API 不支持删除或编辑练习模板 – 仅支持创建。请在应用中手动删除练习。
- API 速率限制:获取所有数据时请注意(使用 --all 标志)
- 重量单位:默认使用磅,使用 --kg 表示千克
- 分页:大多数命令会自动分页,但限制标志有助于减少 API 调用
- ID:锻炼/计划/动作ID是UUID,在详细视图中显示
API参考
完整API文档:https://api.hevyapp.com/docs/
可用端点
GET /v1/workouts- 列出锻炼记录(分页)GET /v1/workouts/{id}- 获取单次锻炼记录GET /v1/workouts/count- 锻炼记录总数GET /v1/routines- 列出训练计划GET /v1/routines/{id}- 获取单个训练计划GET /v1/exercise_templates- 列出动作模板GET /v1/exercise_templates/{id}- 获取单个动作模板GET /v1/exercise_history/{id}- 动作历史记录GET /v1/routine_folders- 列出文件夹
写入操作(支持但请谨慎使用)
POST /v1/workouts- 创建训练PUT /v1/workouts/{id}- 更新训练POST /v1/routines- 创建常规训练PUT /v1/routines/{id}- 更新常规训练POST /v1/exercise_templates- 创建自定义练习POST /v1/routine_folders- 创建文件夹
CLI 主要专注于读取操作。写入操作可通过 API 客户端以编程方式使用。
文章底部电脑广告
手机广告位-内容正文底部
上一篇:serper-search
下一篇:Billclaw


微信扫一扫,打赏作者吧~