Setting stack size

Nope, the stack size is "constant" at 6KB but when more RAM is used by the device OS the sum of available space for global variables and dynamic heap space will be reduced.

I don't know of any API or the actual STM32F function call to retrieve the current position of the stack pointer, but a general approach could be to write a simple function that just puts one dummy variable on the stack and then retrieve its position in RAM.
If you call that function in STARTUP(), you should get a good idea about the base line for your stack and should be able to calculate the distance.
This way you'd also not need to care whether you should look at the MSP (main stack pointer) or the PSP (process stack pointer).