Actually, with a bit of screen-scraping, most web-based games can be considered to have an "API".
WWW::Mechanize and
HTML::TreeBuilder will do enough of the work for you that you can concentrate mostly on coding the fun part: the AI. This rules out RTS games, though, unfortunately.