AI Token-efficient workout analysis python script (MacOS & Claude)

Hey all!

Been enjoying intervals.icu for a while now and lurking on the forum. I’ve been using Claude AI to help me get back into some level of cycling fitness (lots of Zwift), and usually paste in various elements from my intervals.icu activities afterwards. I’ve been pasting the activity header (summary of a bunch of fields), the % in zones for power and HR, and sometimes uploading a .fit file.

What I realized quickly is all this activity and reliance on AI burns a lot of tokens. Then I burned more tokens to determine what would be the best bang for the buck for valuable training data. Then I had Claude build a nifty python script to hit the intervals.icu API and get the data it needs. Keep in mind this has fields and formats for my own needs. You’ll need to add in other fields and/or customize for your purposes.

After some frustrating debugging I got it working on my Mac and basically it gets the summary data from the API and I can paste it into a Claude session. This is vastly more token efficient than uploading a .fit file (~100 vs. ~10,000). Anyhow, for now it is running from the command line and I paste that into my chat. One thing I noted is that W’Bal is not available via the API, only in the UI.

Would love feedback, thoughts, ideas, etc. MIT License so feel free to do whatever you want with it.

1 Like