The way I've done this in the past is by registering a company in my home country and billing through that. For the company procuring your services, it's no different than paying for a service like AWS. The company you registered is responsible for paying applicable service taxes for rendered services as well as payroll taxes and other contributions as required by law on behalf of the employee, aka your physical person.
Basically the benefit to the client company is that it lifts the burden of employment/taxation questions from them. The benefit for you is that since you now own a proper company, you have more tools to manage your finances, for example your company could conceivably pay for office expenses, effectively making those purchases pre-tax (as opposed to paying yourself the equivalent amount and being subject to income tax deductions).