Keep your thumb in a resting position and avoid straining it too much. Secondly, use anti-inflammatory medicines to help in the pain management. Lastly, opt for physical therapy by a doctor as it eliminates pain, stiffness and makes the joint flexible.
It may be overuse like a tendonitis or you may have start of arthritis if it is in joint. I would rather see if there is ointment to apply rather than pills. Ask a pharmacist for advice on creams to apply. They'll tell you more than a Doctor