OpenDNS has a “un-official” (I didn’t find any docs at least) API for returning your public IP, by a normal DNS query.

dig @resolver1.opendns.com -t A -4 myip.opendns.com +short