AI Engine Help Center

Connect your AI provider

Create the External Credential and Named Credential for OpenAI, Anthropic or Azure OpenAI, and link them to AI Engine in the Org Profile.

AI Engine sends requests to your AI provider through a Salesforce Named Credential. Your API key is stored in an External Credential in your own org, and Salesforce adds it to each request. The key is not part of AI Engine's configuration and is not sent to Cloud Connected.

The setup has four parts:

  1. An External Credential that holds your key.
  2. A Named Credential with the provider URL.
  3. Access to the credential for everyone who uses AI Engine.
  4. The credential name in the AI Engine Org Profile.

Before you start#

  • An API key from OpenAI or Anthropic, or an Azure OpenAI resource with a model deployment and its key. For Azure OpenAI you can use a service principal instead of a key; see Service principal instead of an API key.
  • The AI Engine Admin and AI Engine User permission sets assigned to you. See Assign permission sets.

Step 1: Create the External Credential#

  1. Go to Setup → Named Credentials, open the External Credentials tab and click New.
  2. Enter a Label and Name, for example OpenAI, and set Authentication Protocol to Custom. Save.
  3. Under Principals, click New. Enter a Parameter Name such as Default, keep Identity Type as Named Principal, and save.
  4. Under Custom Headers, click New and add the header for your provider:
Provider Header name Header value
OpenAI Authorization Bearer YOUR_API_KEY
Anthropic x-api-key YOUR_API_KEY
Azure OpenAI api-key YOUR_API_KEY

Replace YOUR_API_KEY with your key. For Authorization, keep the word Bearer and one space before the key. For Anthropic you do not need an anthropic-version header: AI Engine sends it with every Anthropic request itself.

External Credential with the Custom protocol and the header that carries the key (value hidden).

External Credential with the Custom protocol and the header that carries the key (value hidden).

Step 2: Create the Named Credential#

  1. Go to Setup → Named Credentials, open the Named Credentials tab and click New.
  2. Enter a Label and Name, for example OpenAI, Anthropic or AzureOpenAI. You will type this exact name into AI Engine later.
  3. Set the URL:
Provider URL
OpenAI https://api.openai.com
Anthropic https://api.anthropic.com
Azure OpenAI https://YOUR_RESOURCE.openai.azure.com
  1. Select the External Credential from step 1.
  2. Make sure Enabled for Callouts is on.
  3. In the Managed Package Callout Allowlist section, enter CloudConnected in Allowed Namespaces for Callouts. AI Engine runs in the CloudConnected namespace, and without this entry Salesforce does not let it use a credential you created.
  4. Save.

Use only the base URL. AI Engine adds the path for each request itself.

Named Credential: URL, External Credential and, at the bottom, Allowed Namespaces for Callouts.

Named Credential: URL, External Credential and, at the bottom, Allowed Namespaces for Callouts.

Step 3: Give users access to the principal#

Every person who uses AI Engine, admins included, needs access to the principal from step 1. AI Engine User and AI Engine Admin come from a managed package, so your org may not let you edit them. The dependable way is a permission set of your own:

  1. Go to Setup → Permission Sets and click New.
  2. Enter a label such as AI Provider Access, leave License as --None--, and save.
  3. Open External Credential Principal Access, click Edit, add the principal from step 1 (for example OpenAI - Default) and save.
  4. Click Manage Assignments → Add Assignment, select every AI Engine user and admin, and assign.

Users also need the AI Engine User permission set, which includes the Read access to User External Credentials that Salesforce requires for the call. When you add AI Engine users later, assign them both permission sets.

External Credential Principal Access in your own permission set.

External Credential Principal Access in your own permission set.

AI Engine uses one Org Profile for the whole org. If a profile already exists, edit it rather than creating a second one.

  1. Open the Ai Agent Admin Setup tab, go to Org Profile, and click + New Profile, or click the existing profile to edit it.
  2. Select the AI Provider: OpenAI (Responses API), Azure OpenAI or Anthropic Claude. AI Engine fills in a suggested model and credential name.
  3. In Named Credential, enter the exact name from step 2.
  4. Choose the AI Model. For Azure OpenAI, type your deployment name, not the model family name.
  5. Optionally choose a Fast model (internal steps) from the same provider. AI Engine uses it for web search steps, such as Web Check and Company News, and for answers in Help mode; everything else runs on the main model. Leave it on the provider default (for Azure OpenAI, leave it blank) if you are unsure.
  6. Click Save.

Then run a first test.

Azure OpenAI#

  • AI Engine calls your deployment at /openai/deployments/<deployment name>/chat/completions, so the AI Model field must match the deployment name exactly. Deployment names may contain only letters, digits, dots, hyphens and underscores. Keep the model name in the deployment name (for example gpt-4.1-mini-prod or gpt-6-luna-1): AI Engine reads the model family from it to send the right request parameters.
  • The deployment type you choose in Azure decides where requests are processed. A Global Standard deployment may process data in any Azure region; choose Data Zone Standard or a regional Standard deployment if processing must stay in one geography.
  • From version 1.88, the features that search the web, such as Web Check and Company News, call the web search tool of your own Azure resource, through the same Named Credential and with your deployment. You do not need an OpenAI account for them. The tool has to be available for your Azure resource; if it is not, those features return an error and everything else keeps working. In version 1.87 and earlier these searches were sent to OpenAI through a Named Credential named exactly OpenAI. See Choosing a provider for compliance.

Azure portal, Keys and Endpoint: where the key and the resource URL come from.

Azure portal, Keys and Endpoint: where the key and the resource URL come from.

Microsoft Foundry, Models: the Name column is the deployment name to type into AI Model.

Microsoft Foundry, Models: the Name column is the deployment name to type into AI Model.

Service principal instead of an API key#

If your organisation does not allow API keys on Azure OpenAI, AI Engine can sign in with a Microsoft Entra ID service principal (OAuth 2.0 client credentials). Salesforce requests the token and adds it to each call; nothing changes in AI Engine itself. Tested with version 1.88, for chat and for the features that search the web.

In Azure:

  1. In Microsoft Entra ID → App registrations, register an application (single tenant, no redirect URI). Note its Application (client) ID and Directory (tenant) ID.
  2. Under Certificates & secrets, create a client secret and copy its Value (not the Secret ID).
  3. On your Azure OpenAI or Foundry resource, open Access control (IAM) and assign the role Cognitive Services OpenAI User to that application.

In Salesforce, replace steps 1 and 2 above with:

  1. An External Credential with Authentication Protocol OAuth 2.0 and Authentication Flow Type Client Credentials with Client Secret Flow. Set Scope to https://cognitiveservices.azure.com/.default, Identity Provider URL to https://login.microsoftonline.com/YOUR_TENANT_ID/oauth2/v2.0/token, and select Pass client credentials in request body. Do not add an api-key header.
  2. A principal on it with the application's Client ID and Client Secret.
  3. A Named Credential with your resource URL, this External Credential, Generate Authorization Header selected and CloudConnected in Allowed Namespaces for Callouts.

Steps 3 and 4 stay the same: give users access to the principal and type the Named Credential name into the Org Profile. A client secret expires on the date you chose in Azure; replace it in the principal before then.

Switching provider later#

You can switch provider at any time by creating credentials for the new provider and changing AI Provider, AI Model and Named Credential in the Org Profile. No reinstallation is needed. AI Engine does not switch providers automatically, but if you keep a second provider's credentials configured and tested, you can switch the Org Profile to it by hand if your main provider has an outage.

Troubleshooting#

What you see Likely cause
"AI provider is not configured. Please contact your Salesforce administrator." The Named Credential name in the Org Profile does not match Setup exactly, the Named Credential does not exist, or CloudConnected is missing from Allowed Namespaces for Callouts.
"AI provider access is not configured for your user." The user has no access to the External Credential principal (step 3), or does not have the AI Engine User permission set.
"AI provider timeout. Please try again in a moment." The provider did not answer in time, or the call could not be made. If it happens on every request, recheck the Named Credential URL and Allowed Namespaces for Callouts.
"AI provider returned an error." The provider rejected the request: usually a wrong or expired key, a missing header, a wrong model or deployment name, or no credit left on the provider account. Test the key in your provider's console to rule out the key itself.
"The AI service is busy right now. Please wait a few seconds and try again." The provider is rate-limiting your requests. If it keeps happening, check the usage limits and remaining credit on your provider account.

To replace a key, see API keys and Named Credentials.

Still stuck? Ask AI, or email contact@cloudconnected.pl with the exact error message, the page or action you used and roughly when it happened.