You could create a Constant in your application holding a value (L for local, T for test, P for production). This constant can be different on each environment. in your flow just check on the value in that constant to use the correct settings for your API calls.
Marco,
Similar to the suggestions from David and Robert, I’ve used this module in the past → https://marketplace.mendix.com/link/component/110921
Easy to use functionality to accomplish what you are describing.
I would echo David’s suggestion of using Constants. These are meant for values that change on an environment level. This would make the most sense as it would switch automatically based on the value of the Constants.
Another alternative may be to look at the isInDevelopment and getApplicationUrl actions in Community Commons.
Good luck