Configuring API Access

OpenAI configuration does not have a dedicated tab in the Nextian Settings; instead, it uses standard Salesforce integration mechanisms.

Follow these steps to configure OpenAI API access:

Create External Credential

  1. Go to SetupSecurityNamed Credentials.
  2. Select External Credentials tab and click New.
  3. Fill the fields for the newly created credential as follows:
    1. Label = OpenAI
    2. Name = OpenAI
    3. Authentication Protocol = Custom
  4. Click Save. A new external credential is created.
  5. Open credential details and scroll down to the Principals
  6. Click New button in the Principals
  7. Fill the fields for the newly created principal as follows:
    1. Parameter Name = token
    2. Sequence Number = 1
    3. Identity Type = Named Principal
  8. Click Add to create Authentication Parameters and provide the following values:
    1. Name = token
    2. Value = <your OpenAI token>
  9. Click Save to save the principal.

Create Named Credential

  1. Go to SetupSecurityNamed Credential.
  2. Select Named Credentialstab and click on New
  3. Fill the fields for the newly created credential as follows:
    1. Label = OpenAI Configuration
    2. Name = OpenAIConfiguration
    3. URL = https://api.openai.com/v1/chat/completions
    4. Enabled for Callouts = <selected>
    5. Authentication = <OpenAI> (from dropdown menu)
    6. Generate Authorization Header = <selected>
    7. Allow Formulas in HTTP Header = <selected>
    8. Allow Formulas in HTTP Body = <selected>
  4. Click Save.
  5. Open credential details and scroll down to the Custom Headers
  6. Click New to create a new custom header.
  7. Fill the fields for the newly created custom header as follows:
    1. Name = Authorization
    2. Value = Bearer {!$Credential.OpenAI.token}
    3. Sequence Number = 1
  8. Click Save.
  9. Click New button again and add one more header with the following values:
    1. Name = Content-Type
    2. Value = application/json
    3. Sequence Number = 2
    4. Click Save.

Add External Named Credential to Permissions Set(s)

These steps depend on the organization’s user configuration and should be applied to the permission sets of users requiring OpenAI access.

  1. Go to SetupUsersPermission Sets.
  2. Select target permission set from the list.
  3. Click on External Credential Principal Access.
  4. Click on Edit.
  5. Move OpenAI – token from Available to Enabled.
  6. Click Save.
Important Tracing OpenAI REST API calls for debugging and troubleshooting is configured via REST Callout Logging.
Was this page helpful?