Tipping is not a local custom, but it is expected of foreigners, especially at larger hotels and restaurants and for taxi rides. If you feel the service has been less than stellar, you are under no obligation to leave a tip, especially with crabby cabbies.
In Thailand tips are generally given for good service, except when a price has been negotiated in advance. If you hire a private driver for an excursion, do tip him. With metered taxis in Bangkok, however, the custom is to round the fare up to the nearest B5. Hotel porters expect at least a B20 tip, and hotel staff who have given good personal service are usually tipped. A 10% tip is appreciated at a restaurant when no service charge has been added to the bill.