It's really complicated. H1B visas require sponsorship from a company that wants to hire you, they are not valid for freelance work.
Your only option is a E-2, but you need to create a company and there are a few requirements:
1.- A 'substantial' amount of money. For some businesses $50k can work, but they can refuse your application investing $100k.
2.- An office lease
3.- Must have US citizens employeed
More info: https://www.uscis.gov/eir/visa-guide/e-2-treaty-investor/understanding-e-2-requirements