Ja'far bin Ma'bad (may Allah have mercy on him), the nephew of Humayd bin Abd al-Rahman al-Himyari (may Allah have mercy on him), narrates: I went with Humayd (may Allah have mercy on him) to Sayyiduna Anas (may Allah be pleased with him), and he said: "When the people pledged allegiance to the Messenger of Allah (peace and blessings be upon him), or (he said) when we pledged allegiance to the Messenger of Allah (peace and blessings be upon him), he (peace and blessings be upon him) would prompt us (with these words), or he would say to us: 'In what I am able.'"
Affan (may Allah have mercy on him) narrated it from Shu'bah (may Allah have mercy on him).
Ja'far bin Ma'bad (may Allah have mercy on him) narrates that he and Humayd bin Abd al-Rahman (may Allah have mercy on him) went to Sayyiduna Anas bin Malik (may Allah be pleased with him); Ja'far (may Allah have mercy on him) said: I heard Sayyiduna Anas (may Allah be pleased with him) say: "When we pledged allegiance to the Messenger of Allah (peace and blessings be upon him), he (peace and blessings be upon him) would prompt us (with these words): 'It (hearing and obeying) is to the extent that I am able.'"
Bishr bin Umar (may Allah have mercy on him) narrated it from Shu'bah (may Allah have mercy on him).
It is narrated from Sayyiduna Anas (may Allah be pleased with him) that he said: "When we pledged allegiance to the Messenger of Allah (peace and blessings be upon him) to hear and obey, he (peace and blessings be upon him) would say (prompting us): 'In what you are able.'"
Attab, the freed slave of Hurmuz (may Allah have mercy on him), also narrated it from Sayyiduna Anas (may Allah be pleased with him) in a similar way.
Something like it is also narrated in the Sahih (al-Bukhari and Muslim) from Sayyiduna Jarir bin Abdullah (may Allah be pleased with him).