Insert keyframe for active material slot with python
If you cannot keyframe the property from UI, you cannot from python either.

The solution is to have a material assigned to all the object behaving in such a way that its color is not constant but dynamic based on something else. It can be:


vertex colors
place in UV space
object index pass
... (with drivers almost anything, but they don't update always nicely)


Let's use the object index pass, because it is just a single property you can animate, it is unique to each object and you have access to it from the material nodes:



Now if you change it for single object the material on that object will behave differently:

activeObject.pass_index = 1
activeObject.keyframe_insert("pass_index")




For Blender Internal the node setup is very similar (switch the material into node material):



There is also another solution available - you can set unique color for every object that is multiplied with the material (to get exactly the color have white material):



You set the color in python this way:

activeObject.color = (1.0, 0.0, 0.0, 1.0)   #RGBA red