"We've just seen the close of an incredible season. My 11th as a Blue. And I cannot believe I'm writing this but ... also my last as a Blue," the City captain wrote in an open letter to fans on his Facebook page.
"Man City has given me everything. I've tried to give back as much as I possibly could. How often does someone get the chance to end such an important chapter, representing a club with such great history and tradition, in such a great fashion?"
"The time has come for me to go now."
'An incredible year': Guardiola hails City's history boys
The 33-year-old central defender said he would be posting a second part of the letter "shortly" with details of his future plans.
City crushed Watford 6-0 in the FA Cup final on Saturday to complete the unprecedented treble, after which Kompany said they were the best team in the world.
Kompany scored with a thunderous long-range strike to decide their penultimate league match of the season against Leicester City, a key moment in their retaining the Premier League title.
Man City target landmark treble as UEFA probe looms
"It's cliché to say it but it's also so true: without my teammates I would have never been here today," he added. "We fought many battles together. Side by side. In good times and in bad. So to all of you, from the 2008-2009 squad to today's domestic Treble winners: I owe you guys!
"A special word also to (manager) Pep (Guardiola) and the backroom staff: you've been superb. You've followed me through so much hardship. You made me come back stronger every time. Thank you so much."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ