Skip to main content
Salesforce lets you bring your own model (BYOLLM) to Agentforce through the LLM Open Connector. The connector speaks a subset of the OpenAI Chat Completions API, so Portkey’s /v1/chat/completions endpoint works with it directly. You don’t need middleware. With Portkey in between, Salesforce can use any model in your Model Catalog, and every request shows up in Portkey logs with cost, latency and token counts.

Prerequisites

  • Portkey API key
  • Provider configured in Model Catalog
  • Salesforce org with Data Cloud and Einstein generative AI enabled, and permission to use Model Builder

Setup

1

Configure Portkey

  1. Go to Model Catalog → Add Provider.
  2. Select your provider (OpenAI, Anthropic, Bedrock, etc.), enter its credentials, and set a slug like openai-prod.
  3. Go to API Keys → Create new key → Save.
The model ID you give Salesforce is @<provider-slug>/<model>, for example @openai-prod/gpt-5.
2

Test the endpoint

Salesforce sends a request like this one. Run it first to confirm the key and model work:
3

Add Portkey as a foundation model

  1. In Salesforce, open Einstein Studio (in the Data Cloud app) and go to Model Builder.
  2. Click Add Foundation Model, then choose to connect your own LLM with the LLM Open Connector.
  3. Fill in the connection:
  1. Save the connection.
Salesforce sends one auth header and nothing else, so you can’t add other x-portkey-* headers here. To route or add fallbacks, attach a default config to the API key (see below).
4

Create a configured model

  1. Select the new model in the Model Library and click New Configuration.
  2. Send a prompt in the Model Playground.
  3. Check that the request appears in Portkey Logs.
  4. Save the configuration.

Use the model in Salesforce

Once saved, the configured model is available wherever Salesforce lets you pick a generative model:
  • Prompt Builder: select it as the model for a prompt template.
  • Agentforce: add a prompt template that uses the model to an agent as an action.
  • Models API: call it by its API name from Apex or REST. Find the API name on the configured model’s detail page.
The LLM Open Connector supports text chat only. It doesn’t send tool definitions, images or streaming requests. Use the Portkey model for prompt templates and Models API calls, not for features that need tool calling.

Add fallbacks and routing

Salesforce can’t send x-portkey-config, so attach a default config to the API key you entered in Model Builder. Every request from Salesforce then uses that config. Example: try OpenAI first, fall back to Anthropic on errors:
  1. Create the config in Configs and copy its ID.
  2. Go to API Keys, edit the key Salesforce uses, and select the config.
override_params rewrites the model in each request, so the Model Name in Salesforce becomes a label. Keep it in @slug/model form anyway so the connection still works if the config is removed. To cap spend or rate for Salesforce traffic, set budget and rate limits on the provider in Model Catalog, or give Salesforce its own provider slug.

Troubleshooting

Resources


Portkey is now PRISMA AIRS AI Gateway. See it in action.

Contact Us
Last modified on October 17, 2026