added support for chat api. tentative.