The API key is just the key, it does not encode any kind of access information. The ability to use model = 'gpt-4'
is just a change in your function call, i.e. if you change the model name in your code from gpt-3.5-turbo to gpt-4 you will now be using gpt-4.
The two separate endpoints can be used with the same API key.