We study the compensation of gig workers in a natural field experiment. To derive testable predictions, this paper presents a formal model capturing a central feature of online freelance work: gig work- ers' ability to choose both how much to work and how big an effort to make. We analyse the set-up in a principal-agent model, showing that the optimal contract includes a sales-based commission and uses a gig-based piece rate to insure a risk-averse agent. This piece rate is in- creasing in her risk aversion, intrinsic motivation and ability. We then predict the effects of introducing a gig piece rate while reducing the commission rate. The effects on the agents' choices of quantity and quality are heterogeneous in their risk aversion, intrinsic motivation and ability.