You can only apply for a Residence Card within the UK.
Outside of the UK, you could apply for a Family Permit, provided your EU sponsor (your girlfriend) is or is intending to, exercise treaty rights in the UK:
https://www.gov.uk/family-permit/eligibility
Unmarried partners can apply as Extended Family Members.
Children can apply as Family Members (providing all relevant documentation, such as birth certifficates and or DNA tests is supplied as applicable).
The Family permit is valid for 6 months, and is purpose is to allow entry into the UK. Once in the UK, Family Permit holders should seek to apply for a Residence Card.
My posts express what I believe are the facts, based on the best of my knowledge, about the topics discussed in this forum. They do not constitute immigration advice.