pgfplots has a library units that allows to typeset units in axis labels provided through x unit=<unit>. Through the key \pgfplotsset{unit code/.code={\si{#1}}}, it can be made to typeset the units using the excellent siunitx.
My problem is the following: When I provide units with negative exponents, such as \metre\per\second, they are typeset as m/s, and not ms^{-1} as I would like (and as is the standard behaviour of siunitx). I've tried setting the unit code to \si[per-mode=reciprocal]{#1}, but it doesn't change the output. If I supply the unit using x unit=\si{\metre\per\second}, I get the desired output, but I would rather not call the \si command explicitly, as in my eyes it would defeat the purpose of using the units library if I end up typesetting the units myself anyway.
MWE:
\documentclass{article}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepgfplotslibrary{units}
\pgfplotsset{unit code/.code={\si{#1}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
x unit=\metre\per\second, %This doesn't do what I want
y unit=\si{\metre\per\second}] %This does, but I don't want to type "\si{...}"
\end{axis}
\end{tikzpicture}
\end{document}
