With the way machine learning networks work, they don't really learn one-off high-entropy strings like API keys.
The weights powering the models are only so big, there simply isn't enough memory to waste storing that type of data.
Instead, it's learned the general pattern of what an API key looks like and the fact that it's high-entropy random jibberish, with no predictable pattern. And when auto-completing code, it's just going to generate a random string of characters in approximately the correct format.