Credits API and tests