Adding Key Permission

After you create an API key in OCI Generative AI, you must give the Generative AI service permission to get information about this key. This section shows you what permissions you need to add to IAM policies.

Add the following IAM policy in your tenancy.

allow any-user to use generative-ai-chat in TENANCY where ALL 
{ request.principal.type='generativeaiapikey', 
  request.principal.id='<your-api-key-OCID>'
}

If you need help finding the API key OCID, see Getting an API Key's Details. An API key OCID starts with 'ocid1.generativeaiapikey.region-realm.<region-name>. If you need help with IAM policies, see Writing Policy Statements with the Policy Builder.