Api chat rewrite to callback from model