I am not your doctor and the following is not medical advice. This is a very common issue for those who struggle with addiction especially to pain medications; that is to also have some sort of chronic pain. Often the pain leads to the medication use, at times leads to tolerance to the medication effect and overuse and at times leads to addiction. It would be important for any treatment program to address the pain medicine addiction with an evidence based model, including potentially use of medication-assisted treatment, therapy (both group and individual settings are appropriate). Along with such, it would also be important not to forget about the pain treatment as well. Some types of medications utilized for pain medication addiction can help with pain as well, however it may be beneficial to work with either a neurologist or pain management group who are aware of your pain medication addiction history, to adequately address pain needs with alternatives to narcotic type medications. This might include use of alternate strategies for pain management even including non-mediation options you could discuss with pain specialists (things like acupuncture for example). Lastly, it would be important to consider any potential need for mental health treatment as pain and addiction are often intertwined with mental health conditions like depression, anxiety, PTSD, and others. A multimodal approach targeting all of these facets may prove most useful. Also consider different types of addiction treatment programs exist, they are not all created equal, and they are not one-size fits all. There is hope, and not everyone gets it on their first try. Best of luck.
I do believe there is help for you. Not knowing where you live, look into programs or therapists such as medical family therapy. Most often they can be found in hospitals. The program/therapists work with your doctor and a program doctor to set up the best treatment for you. They take your pain and need for the medication into consideration when working with you.
I'm so sorry this happened to you. Do they know what the cause of your headaches is? Have you had a full work-up for them? What sort of treatment have you undergone for your addiction? Detox, rehab, buprenorphine, methadone? Buprenorphine does provide relief from pain so that may be an option for you. Also, there are some powerful painkillers (such as diclofenac) that aren't addicting. Your doctor does have some weapons in his arsenal that can help you. Just sit down and talk to him or her.