Dat Hoang Greetings!
Please find the below answers to your queries.
What is the expired time for the Azure OpenAI?
AFAIK, The expiration time for Azure OpenAI API keys is configurable and can be set by the user.
By default, Azure OpenAI API keys expire every six months. If an API key is expired, you need to regenerate it. It is recommended to set an expiration time for security reasons.
If you create a key programmatically using the Azure Management API, you can also specify an expiration date for the key.
You can find more information here Authenticate requests to Azure AI services.
Do both 2 keys have the same expired date?
Both API keys will have the same expiration time if you set an expiration time for them. If you do not set an expiration time, both keys will not expire.
When the expired time calculated, from the first use or base on the generation time?
The expiration time for the API keys is calculated based on the time when the keys were generated. It is not based on the first use of the keys.
To avoid running out of access tokens, either you can rotate the keys or you can implement a token refresh mechanism in your application or script that automatically obtains a new access token when the current token is about to expire. This can help ensure that your application or script can continue to access the OpenAI endpoint without interruption.
You can also use Azure Key Vault to securely store and manage your access tokens.
For more details, please refer Customer-managed keys with Azure Key Vault
Hope this helps. Do let me know if you have any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful.