$basePath = JPATH_ADMINISTRATOR.'/components/com_content';
require_once $basePath.'/models/article.php';
$articlemodel = new ContentModelArticle(array('table_path' => $basePath . '/tables'));
$params = array(
'id' => 123, // Article being tagged
'tags' => array(7,8,9,14) // Tag IDs from #__tags to tag article with
);
if($articlemodel->save($params)){
echo 'Success!';
}
https://stackoverflow.com/questions/17886406/joomla-3-1-4-how-to-insert-tags-programmatically