NexBlazers Logo
NexBlazers Learn • Build • Grow
Agentforce & AI

Bring Your Own LLM in Salesforce: Use Your Model, Keep the Platform

Written by NexBlazers Architecture Team December 1, 2026 9 min read
The basics

What is Bring Your Own LLM (BYOLLM)?

Bring Your Own LLM (BYOLLM) lets you connect a large language model (LLM) that you run in your own cloud account to Salesforce. You add it in AI Models (formerly Einstein Studio), and it then appears next to the Salesforce-managed models for Prompt Builder templates, the Models API and the actions your agents call. It works with OpenAI, Azure OpenAI, Google Vertex AI and Amazon Bedrock, plus any other model through the LLM Open Connector. This post covers when BYOLLM is worth it, how to set it up, and the trust and cost trade-offs.

Picture a typical case. Your data science team spent months fine-tuning a model on claims notes. Your cloud team already pays for an enterprise Azure OpenAI deployment. Then the Salesforce team builds a case summary in Prompt Builder on a different, Salesforce-managed model, and the company now runs two AI stacks that don't talk to each other.

BYOLLM closes that gap. Below we cover what it actually connects, the setup path, where the model shows up in Salesforce, how a developer calls it from Apex, and the questions an architect should ask before saying yes.

Where you add it
AI Models, Generative tab
Providers
OpenAI, Azure OpenAI, Vertex AI, Bedrock
Anything else
LLM Open Connector
Used by
Prompt Builder, Models API, agent actions

1. Your three model options

Salesforce gives you three ways to put an LLM behind your generative AI features, and the Trailhead unit on how Salesforce uses LLMs lays them out side by side:

  • Salesforce-managed models: ready out of the box. Some, such as the Anthropic and Amazon models on Amazon Bedrock, run entirely inside the Salesforce Trust Boundary.
  • Partner models through Salesforce: models such as OpenAI's, which Salesforce reaches through a shared trust partnership and its own agreements with the provider.
  • Bring your own: your model, in your account, on your infrastructure. Salesforce calls it, but the provider relationship and the contract are yours.

The Large Language Model Support article puts the typical case simply: your company has an LLM fine-tuned to its data. In practice we see four reasons to bring one:

  • A fine-tuned or domain model that already knows your products, policies or language.
  • An existing enterprise agreement with Azure, AWS, Google or OpenAI that you want Salesforce traffic to use.
  • Control over where the model runs: your region, your account, your security team's settings.
  • A model Salesforce doesn't offer, such as an open-weights or in-house model, through the LLM Open Connector.

2. What you can connect

Per Salesforce Help's Add a Foundation Model page, BYOLLM supports four providers directly, plus a fifth "Connect to your LLM" option:

OptionWhat to have ready
OpenAIYour API credentials. If it's a fine-tuned model, say so during setup and enter its model name.
Azure OpenAIThe deployment name from your Azure OpenAI deployments. For OAuth instead of a key, a named credential.
Google Vertex AIYour Google Cloud endpoint and authentication details, then the model version.
Amazon BedrockYour AWS endpoint and authentication details, then the model type (Help lists Anthropic).
LLM Open ConnectorAny model behind a REST endpoint that follows the Open Connector specification.

The LLM Open Connector is the escape hatch. Salesforce publishes the API specification and sample code in its Einstein AI Platform GitHub repository, and the spec closely follows the OpenAI API, so most gateways and model servers that expose a chat completions endpoint can fit it. The Open Connector launch post walks through Mistral and IBM Granite examples. One detail from Help: the endpoint URL should end in /chat/completions, and Salesforce adds that path if you leave it off.

3. Setting it up

Einstein generative AI has to be turned on in the org first. After that, the flow in AI Models is short:

  1. Open AI Models, go to the Generative tab and click Add Foundation Model.
  2. Pick the provider tile (or Connect to your LLM for the Open Connector).
  3. Enter the endpoint name and URL, your authentication details and the model information, then click Save & Test.
  4. Name the model, pick the version or type, and save. It lands in the model library as a foundation model.
  5. Create a model configuration from it, set hyperparameters such as temperature, and try prompts in the model playground before anyone builds on it.
Architecture Note: Salesforce reaches your endpoint over standard HTTPS on port 443, from a published set of IP addresses. If your security team locks the endpoint down with a strict network ACL, add the "BYO Models and Open Connector" IP ranges from Salesforce's IP allowlist article before you test, or the connection check will fail.

4. Where your model shows up

Once configured, a BYOLLM model is used like any other model in the library:

  • Prompt Builder: pick it as the model for a custom prompt template. Salesforce's own BYOLLM launch post calls Prompt Builder the key consumer of BYOLLM.
  • Models API: call it from Apex, REST, Lightning web components or Flow by its configured model name.
  • Agentforce custom actions: the Supported Models page says custom actions that run a prompt template, run Apex or call the Models API can use any Salesforce-managed or BYO model.

The gotcha: an agent's own reasoning engine is not a BYOLLM slot. You pick the agent's model option on the Agentforce Agents setup page, and the options listed there are Salesforce Default and AWS-Hosted, not your BYOLLM model. So your model can generate what a custom action returns, but it doesn't decide which action the agent runs.

5. Calling it from Apex

The Models API Apex classes live in the aiplatform namespace. The only BYOLLM-specific part is modelName: use the API name of the model configuration you created in AI Models instead of a sfdc_ai__Default... name.

aiplatform.ModelsAPI.createChatGenerations_Request req =
    new aiplatform.ModelsAPI.createChatGenerations_Request();
// API name of YOUR configured BYOLLM model (placeholder)
req.modelName = 'YOUR_CONFIGURED_MODEL_API_NAME';
String claimNotes = 'Customer reports water damage...'; // your input text

aiplatform.ModelsAPI_ChatGenerationsRequest body =
    new aiplatform.ModelsAPI_ChatGenerationsRequest();
List<aiplatform.ModelsAPI_ChatMessageRequest> msgs =
    new List<aiplatform.ModelsAPI_ChatMessageRequest>();

aiplatform.ModelsAPI_ChatMessageRequest sys = new aiplatform.ModelsAPI_ChatMessageRequest();
sys.role = 'system';
sys.content = 'You summarize insurance claims in three bullet points.';
msgs.add(sys);

aiplatform.ModelsAPI_ChatMessageRequest usr = new aiplatform.ModelsAPI_ChatMessageRequest();
usr.role = 'user';
usr.content = 'Summarize: ' + claimNotes;
msgs.add(usr);

body.messages = msgs;
req.body = body;

try {
    aiplatform.ModelsAPI api = new aiplatform.ModelsAPI();
    aiplatform.ModelsAPI.createChatGenerations_Response res = api.createChatGenerations(req);
    System.debug(res.Code200.generationDetails.generations);
} catch (aiplatform.ModelsAPI.createChatGenerations_ResponseException e) {
    System.debug('Models API error ' + e.responseCode + ': ' + e.getMessage());
}

Two things to plan for. These methods count against the normal Apex callout limits, so treat them like any other callout in bulk or trigger contexts. And because the classes are generated by External Services, test them the way the docs recommend for External Services rather than expecting a live model in a unit test.

6. Trust: what still applies, and what moves to you

BYOLLM requests still go through Salesforce's LLM gateway and the Einstein Trust Layer. The Supported Models page says that although your provider runs the inference, the request is still routed through the Models API and Trust Layer features are fully supported.

What changes is the contract. Salesforce's zero data retention commitments are agreements it signed with its own model partners. Salesforce's Agentforce privacy FAQ says that with BYOLLM, the provider is your vendor, not a Salesforce sub-processor, and your own contract with that provider governs your data. Before go-live, have your legal, privacy and procurement teams confirm retention, training use and region terms in that contract. This article is general information, not legal advice.

Architecture Note: Data masking has a cost. When masking is on in the Einstein Trust Layer, the Models API data masking docs cap every model, BYO models included, at a 65,536-token context, even if the model itself supports much more. If you brought a long-context model for large documents, decide deliberately whether masking or context size matters more for that use case.

7. Cost: two bills, one smaller

With BYOLLM you pay twice, but less on the Salesforce side. Your provider bills you for the model calls under your own agreement, because they run in your account. Salesforce still counts the requests as Einstein Requests, and as of December 2026 the Supported Models page says a BYOLLM call consumes 30% fewer Einstein Requests than other models. Compare both bills on your real prompt volume before you pick a model; check the current Supported Models page, since rates change.

8. Questions to settle before you build

  • Does it actually beat the managed models? Run the same prompt templates through a Salesforce-managed model and your model in the playground, and compare quality and latency.
  • Who owns the endpoint? Keys rotate, deployments get renamed and quotas fill up. Name an owner on the cloud team, and prefer OAuth through a named credential where the provider supports it.
  • What happens when it's down? Your provider's outage is now a Salesforce feature outage. Plan a fallback configuration or a graceful error in the action.
  • Is the model being retired? Help already lists several older BYOLLM models (such as Claude 3 Opus on Bedrock and Gemini 1.5 Pro on Vertex) as retired by their providers. Track your provider's retirement dates.

Cheat sheet: BYOLLM at a glance

QuestionAnswer
Where do I add the model?AI Models → Generative → Add Foundation Model
Which providers are built in?OpenAI, Azure OpenAI, Vertex AI, Amazon Bedrock
My model isn't on that listLLM Open Connector
Where can I use it?Prompt Builder, Models API, custom agent actions
Can it power the agent's reasoning?No, that model is chosen from Salesforce-managed options
Does the Trust Layer still apply?Yes, but data retention follows your own provider contract
Context limit with data masking on65,536 tokens
Einstein Requests30% fewer than other models (Dec 2026)
Keep learning

Official Resources

Straight from Salesforce: the docs this article is based on.

Weighing your own model against Salesforce's?

Book a session with our architects to compare quality, trust and cost on your real prompts before you commit.

Book an AI Architecture Session

OpenAI, Microsoft Azure, Google Vertex AI, Amazon Bedrock, Anthropic, Mistral, IBM and other product names are trademarks of their respective owners. Features, limits and rates change by release; check the linked Salesforce documentation before you rely on them.

All information in this article was collected from publicly available resources, including official Salesforce documentation.