add code generation to API