@mlubin asks:  The other approach is to do what AmplNLWriter does an wrap the model in an optimizer: https://github.com/jump-dev/AmplNLWriter.jl/blob/4e1edda22d272e3df27893eee7a7ca1e2da19ac9/src/AmplNLWriter.jl#L79-L80