Hi Nicolas!
Thank you for your answer! It worked perfectly. In case someone runs into the same issue, I leave here an example to get the opacity of a given filter (slice1 in this case) and generate an animation with 5 keyframes
opacityTrack = GetAnimationTrack("Opacity", 0, slice1)
keyf0 = CompositeKeyFrame()
keyf0.Interpolation = 'Ramp'
keyf0.KeyTime = 0
keyf0.KeyValues=0
keyf1 = CompositeKeyFrame()
keyf1.Interpolation = 'Ramp'
keyf1.KeyTime=0.15
keyf1.KeyValues=0
keyf2 = CompositeKeyFrame()
keyf2.Interpolation = 'Ramp'
keyf2.KeyTime=0.2
keyf2.KeyValues=1
keyf3 = CompositeKeyFrame()
keyf3.Interpolation = 'Ramp'
keyf3.KeyTime=0.8
keyf3.KeyValues=1
keyf4 = CompositeKeyFrame()
keyf4.Interpolation = 'Ramp'
keyf4.KeyTime=0.85
keyf4.KeyValues=0
opacityTrack.KeyFrames=[keyf0,keyf1,keyf2,keyf3,keyf4]
Regards